diff --git a/go.mod b/go.mod index 904f9ef5..38d9cfee 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,7 @@ require ( github.com/sagernet/sing v0.1.8-0.20230303052048-c875a4ffab1a github.com/sagernet/sing-dns v0.1.4 github.com/sagernet/sing-shadowsocks v0.1.2-0.20230221080503-769c01d6bba9 - github.com/sagernet/sing-shadowtls v0.0.0-20230221123345-78e50cd7b587 + github.com/sagernet/sing-shadowtls v0.1.0 github.com/sagernet/sing-tun v0.1.2-0.20230226091124-0cdb0eed74d9 github.com/sagernet/sing-vmess v0.1.3-0.20230303082804-627cc46ae68b github.com/sagernet/smux v0.0.0-20220831015742-e0f1988e3195 diff --git a/go.sum b/go.sum index 13b9ef42..624b276a 100644 --- a/go.sum +++ b/go.sum @@ -139,8 +139,8 @@ github.com/sagernet/sing-dns v0.1.4 h1:7VxgeoSCiiazDSaXXQVcvrTBxFpOePPq/4XdgnUDN github.com/sagernet/sing-dns v0.1.4/go.mod h1:1+6pCa48B1AI78lD+/i/dLgpw4MwfnsSpZo0Ds8wzzk= github.com/sagernet/sing-shadowsocks v0.1.2-0.20230221080503-769c01d6bba9 h1:qS39eA4C7x+zhEkySbASrtmb6ebdy5v0y2M6mgkmSO0= github.com/sagernet/sing-shadowsocks v0.1.2-0.20230221080503-769c01d6bba9/go.mod h1:f3mHTy5shnVM9l8UocMlJgC/1G/zdj5FuEuVXhDinGU= -github.com/sagernet/sing-shadowtls v0.0.0-20230221123345-78e50cd7b587 h1:OjIXlHT2bblZfp+ciupM4xY9+Ccpj9FsuHRtKRBv+Pg= -github.com/sagernet/sing-shadowtls v0.0.0-20230221123345-78e50cd7b587/go.mod h1:Kn1VUIprdkwCgkS6SXYaLmIpKzQbqBIKJBMY+RvBhYc= +github.com/sagernet/sing-shadowtls v0.1.0 h1:05MYce8aR5xfKIn+y7xRFsdKhKt44QZTSEQW+lG5IWQ= +github.com/sagernet/sing-shadowtls v0.1.0/go.mod h1:Kn1VUIprdkwCgkS6SXYaLmIpKzQbqBIKJBMY+RvBhYc= github.com/sagernet/sing-tun v0.1.2-0.20230226091124-0cdb0eed74d9 h1:tq1kc0HFj/jfhLfVC1NJI6lex2g6w2W+gVsFu6H2Kis= github.com/sagernet/sing-tun v0.1.2-0.20230226091124-0cdb0eed74d9/go.mod h1:KnRkwaDHbb06zgeNPu0LQ8A+vA9myMxKEgHN1brCPHg= github.com/sagernet/sing-vmess v0.1.3-0.20230303082804-627cc46ae68b h1:NZeF0ATeJwe4W3gTJNeIfTB6yBxai665q1HvDOaWmmU= 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 690d97bb..b30d88d5 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 bdae7d90..6d0af0ee 100644 --- a/outbound/vless.go +++ b/outbound/vless.go @@ -134,6 +134,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 fdbf83f3..07e035ab 100644 --- a/outbound/vmess.go +++ b/outbound/vmess.go @@ -157,6 +157,7 @@ func (h *vmessDialer) DialContext(ctx context.Context, network string, destinati } } if err != nil { + common.Close(conn) return nil, err } switch N.NetworkName(network) {