From a2abe31298d3061c4a54ec51f6ad44fc1a960308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 31 Oct 2022 13:30:10 +0800 Subject: [PATCH] Fix uTLS config --- common/tls/utls_client.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/tls/utls_client.go b/common/tls/utls_client.go index a5ae6b65..28fa6298 100644 --- a/common/tls/utls_client.go +++ b/common/tls/utls_client.go @@ -14,6 +14,7 @@ import ( E "github.com/sagernet/sing/common/exceptions" utls "github.com/refraction-networking/utls" + "context" ) type utlsClientConfig struct { @@ -34,13 +35,17 @@ func (e *utlsClientConfig) Config() (*STDConfig, error) { } func (e *utlsClientConfig) Client(conn net.Conn) Conn { - return &utlsConnWrapper{utls.UClient(conn, e.config, e.id)} + return &utlsConnWrapper{utls.UClient(conn, e.config.Clone(), e.id)} } type utlsConnWrapper struct { *utls.UConn } +func (c *utlsConnWrapper) HandshakeContext(ctx context.Context) error { + return c.UConn.HandshakeContext(ctx) +} + func (c *utlsConnWrapper) ConnectionState() tls.ConnectionState { state := c.Conn.ConnectionState() return tls.ConnectionState{