diff --git a/go.mod b/go.mod index d30c59a6..1024af4e 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/refraction-networking/utls v1.2.2 github.com/sagernet/cloudflare-tls v0.0.0-20221031050923-d70792f4c3a0 github.com/sagernet/quic-go v0.0.0-20230202071646-a8c8afb18b32 - github.com/sagernet/sing v0.1.7 + github.com/sagernet/sing v0.1.8-0.20230309082535-3ccf42b7d589 github.com/sagernet/sing-dns v0.1.4 github.com/sagernet/sing-shadowsocks v0.1.1 github.com/sagernet/sing-tun v0.1.1 diff --git a/go.sum b/go.sum index d8767a85..d9d4f7e2 100644 --- a/go.sum +++ b/go.sum @@ -102,8 +102,8 @@ github.com/sagernet/quic-go v0.0.0-20230202071646-a8c8afb18b32 h1:tztuJB+giOWNRK github.com/sagernet/quic-go v0.0.0-20230202071646-a8c8afb18b32/go.mod h1:QMCkxXAC3CvBgDZVIJp43NWTuwGBScCzMLVLynjERL8= github.com/sagernet/sing v0.0.0-20220812082120-05f9836bff8f/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY= github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY= -github.com/sagernet/sing v0.1.7 h1:g4vjr3q8SUlBZSx97Emz5OBfSMBxxW5Q8C2PfdoSo08= -github.com/sagernet/sing v0.1.7/go.mod h1:jt1w2u7lJQFFSGLiRrRIs5YWmx4kAPfWuOejuDW9qMk= +github.com/sagernet/sing v0.1.8-0.20230309082535-3ccf42b7d589 h1:McKwXuB22ibRW+o0uP42xcJEPiVZxapOd9BgljcJhUw= +github.com/sagernet/sing v0.1.8-0.20230309082535-3ccf42b7d589/go.mod h1:jt1w2u7lJQFFSGLiRrRIs5YWmx4kAPfWuOejuDW9qMk= github.com/sagernet/sing-dns v0.1.4 h1:7VxgeoSCiiazDSaXXQVcvrTBxFpOePPq/4XdgnUDN+0= github.com/sagernet/sing-dns v0.1.4/go.mod h1:1+6pCa48B1AI78lD+/i/dLgpw4MwfnsSpZo0Ds8wzzk= github.com/sagernet/sing-shadowsocks v0.1.1 h1:uFK2rlVeD/b1xhDwSMbUI2goWc6fOKxp+ZeKHZq6C9Q= diff --git a/outbound/shadowsocksr.go b/outbound/shadowsocksr.go index 61dd5721..b85c0fed 100644 --- a/outbound/shadowsocksr.go +++ b/outbound/shadowsocksr.go @@ -109,11 +109,13 @@ func (h *ShadowsocksR) DialContext(ctx context.Context, network string, destinat conn = h.cipher.StreamConn(h.obfs.StreamConn(conn)) writeIv, err := conn.(*shadowstream.Conn).ObtainWriteIV() if err != nil { + conn.Close() return nil, err } conn = h.protocol.StreamConn(conn, writeIv) err = M.SocksaddrSerializer.WriteAddrPort(conn, destination) if err != nil { + conn.Close() return nil, E.Cause(err, "write request") } return conn, nil diff --git a/outbound/trojan.go b/outbound/trojan.go index 7c11d445..6ea675e0 100644 --- a/outbound/trojan.go +++ b/outbound/trojan.go @@ -124,6 +124,7 @@ func (h *trojanDialer) DialContext(ctx context.Context, network string, destinat } } if err != nil { + common.Close(conn) return nil, err } switch N.NetworkName(network) { diff --git a/outbound/vless.go b/outbound/vless.go index 4805608a..7bceb894 100644 --- a/outbound/vless.go +++ b/outbound/vless.go @@ -123,6 +123,7 @@ func (h *VLESS) ListenPacket(ctx context.Context, destination M.Socksaddr) (net. } } if err != nil { + common.Close(conn) return nil, err } if h.xudp { diff --git a/outbound/vmess.go b/outbound/vmess.go index 428f9b77..95482762 100644 --- a/outbound/vmess.go +++ b/outbound/vmess.go @@ -154,6 +154,7 @@ func (h *vmessDialer) DialContext(ctx context.Context, network string, destinati } } if err != nil { + common.Close(conn) return nil, err } switch N.NetworkName(network) {