From 78d8070aa65a300dfa527d0d28ed8d77e37fb938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Fri, 3 Mar 2023 16:41:51 +0800 Subject: [PATCH] Fix client dial --- client.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index 141be0f..b955ba3 100644 --- a/client.go +++ b/client.go @@ -66,7 +66,12 @@ func (c *Client) DialContext(ctx context.Context) (net.Conn, error) { if err != nil { return nil, err } - return c.DialContextConn(ctx, conn) + shadowTLSConn, err := c.DialContextConn(ctx, conn) + if err != nil { + conn.Close() + return nil, err + } + return shadowTLSConn, nil } func (c *Client) DialContextConn(ctx context.Context, conn net.Conn) (net.Conn, error) {