chore: Add read deadline implementation
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/Dreamacro/clash/adapter/inbound"
|
||||
N "github.com/Dreamacro/clash/common/net"
|
||||
C "github.com/Dreamacro/clash/constant"
|
||||
LC "github.com/Dreamacro/clash/listener/config"
|
||||
"github.com/Dreamacro/clash/transport/shadowsocks/core"
|
||||
@ -99,7 +100,7 @@ func (l *Listener) AddrList() (addrList []net.Addr) {
|
||||
}
|
||||
|
||||
func (l *Listener) HandleConn(conn net.Conn, in chan<- C.ConnContext, additions ...inbound.Addition) {
|
||||
conn = l.pickCipher.StreamConn(conn)
|
||||
conn = N.NewDeadlineConn(l.pickCipher.StreamConn(conn))
|
||||
|
||||
target, err := socks5.ReadAddr(conn, make([]byte, socks5.MaxAddrLen))
|
||||
if err != nil {
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"net"
|
||||
|
||||
"github.com/Dreamacro/clash/adapter/inbound"
|
||||
N "github.com/Dreamacro/clash/common/net"
|
||||
"github.com/Dreamacro/clash/common/pool"
|
||||
"github.com/Dreamacro/clash/common/sockopt"
|
||||
C "github.com/Dreamacro/clash/constant"
|
||||
@ -29,7 +30,7 @@ func NewUDP(addr string, pickCipher core.Cipher, in chan<- C.PacketAdapter) (*UD
|
||||
}
|
||||
|
||||
sl := &UDPListener{l, false}
|
||||
conn := pickCipher.PacketConn(l)
|
||||
conn := N.NewDeadlinePacketConn(pickCipher.PacketConn(l))
|
||||
go func() {
|
||||
for {
|
||||
buf := pool.Get(pool.RelayBufferSize)
|
||||
|
Reference in New Issue
Block a user