diff --git a/transport/hysteria/conns/faketcp/obfs.go b/transport/hysteria/conns/faketcp/obfs.go index 9897accc..35f7d013 100644 --- a/transport/hysteria/conns/faketcp/obfs.go +++ b/transport/hysteria/conns/faketcp/obfs.go @@ -1,7 +1,6 @@ package faketcp import ( - "github.com/Dreamacro/clash/log" "github.com/Dreamacro/clash/transport/hysteria/obfs" "net" "sync" @@ -14,7 +13,6 @@ const udpBufferSize = 65535 type ObfsFakeTCPConn struct { orig *TCPConn obfs obfs.Obfuscator - closed bool readBuf []byte readMutex sync.Mutex writeBuf []byte @@ -33,13 +31,7 @@ func NewObfsFakeTCPConn(orig *TCPConn, obfs obfs.Obfuscator) *ObfsFakeTCPConn { func (c *ObfsFakeTCPConn) ReadFrom(p []byte) (int, net.Addr, error) { for { c.readMutex.Lock() - if c.closed { - log.Infoln("read faketcp obfs before") - } n, addr, err := c.orig.ReadFrom(c.readBuf) - if c.closed { - log.Infoln("read faketcp obfs after") - } if n <= 0 { c.readMutex.Unlock() return 0, addr, err @@ -69,7 +61,6 @@ func (c *ObfsFakeTCPConn) WriteTo(p []byte, addr net.Addr) (n int, err error) { } func (c *ObfsFakeTCPConn) Close() error { - c.closed = true return c.orig.Close() } diff --git a/transport/hysteria/conns/udp/obfs.go b/transport/hysteria/conns/udp/obfs.go index da637d0f..d63034b5 100644 --- a/transport/hysteria/conns/udp/obfs.go +++ b/transport/hysteria/conns/udp/obfs.go @@ -1,7 +1,6 @@ package udp import ( - "github.com/Dreamacro/clash/log" "github.com/Dreamacro/clash/transport/hysteria/obfs" "net" "sync" @@ -17,7 +16,6 @@ type ObfsUDPConn struct { readMutex sync.Mutex writeBuf []byte writeMutex sync.Mutex - closed bool } func NewObfsUDPConn(orig net.PacketConn, obfs obfs.Obfuscator) *ObfsUDPConn { @@ -32,13 +30,7 @@ func NewObfsUDPConn(orig net.PacketConn, obfs obfs.Obfuscator) *ObfsUDPConn { func (c *ObfsUDPConn) ReadFrom(p []byte) (int, net.Addr, error) { for { c.readMutex.Lock() - if c.closed { - log.Infoln("read udp obfs before") - } n, addr, err := c.orig.ReadFrom(c.readBuf) - if c.closed { - log.Infoln("read udp obfs after") - } if n <= 0 { c.readMutex.Unlock() return 0, addr, err @@ -68,7 +60,6 @@ func (c *ObfsUDPConn) WriteTo(p []byte, addr net.Addr) (n int, err error) { } func (c *ObfsUDPConn) Close() error { - c.closed = true return c.orig.Close() } diff --git a/transport/hysteria/conns/wechat/obfs.go b/transport/hysteria/conns/wechat/obfs.go index a63b85d4..815aa52f 100644 --- a/transport/hysteria/conns/wechat/obfs.go +++ b/transport/hysteria/conns/wechat/obfs.go @@ -15,7 +15,6 @@ const udpBufferSize = 65535 type ObfsWeChatUDPConn struct { orig net.PacketConn obfs obfs.Obfuscator - closed bool readBuf []byte readMutex sync.Mutex writeBuf []byte @@ -37,13 +36,7 @@ func NewObfsWeChatUDPConn(orig net.PacketConn, obfs obfs.Obfuscator) *ObfsWeChat func (c *ObfsWeChatUDPConn) ReadFrom(p []byte) (int, net.Addr, error) { for { c.readMutex.Lock() - if c.closed { - log.Infoln("read wechat obfs before") - } n, addr, err := c.orig.ReadFrom(c.readBuf) - if c.closed { - log.Infoln("read wechat obfs after") - } if n <= 13 { c.readMutex.Unlock() return 0, addr, err @@ -84,7 +77,6 @@ func (c *ObfsWeChatUDPConn) WriteTo(p []byte, addr net.Addr) (n int, err error) } func (c *ObfsWeChatUDPConn) Close() error { - c.closed = true return c.orig.Close() } diff --git a/transport/hysteria/transport/client.go b/transport/hysteria/transport/client.go index b4b52501..9d0158e5 100644 --- a/transport/hysteria/transport/client.go +++ b/transport/hysteria/transport/client.go @@ -15,10 +15,7 @@ import ( ) type ClientTransport struct { - Dialer *net.Dialer - PrefEnabled bool - PrefIPv6 bool - PrefExclusive bool + Dialer *net.Dialer } func (ct *ClientTransport) quicPacketConn(proto string, server string, obfs obfs.Obfuscator, dialer PacketDialer) (net.PacketConn, error) {