From 37401b39f866d24c37bbab6a79a31cdc21a10bad Mon Sep 17 00:00:00 2001 From: Vladislav Yarmak Date: Sun, 25 Feb 2024 00:56:37 +0200 Subject: [PATCH] utls: even more fixes --- plaintext.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plaintext.go b/plaintext.go index 3f314c5..7e001f4 100644 --- a/plaintext.go +++ b/plaintext.go @@ -47,7 +47,7 @@ func (d *PlaintextDialer) DialContext(ctx context.Context, network, address stri if d.hideSNI { sni = "" } - conn = tls.UClient(conn, &tls.Config{ + tlsConn := tls.UClient(conn, &tls.Config{ ServerName: sni, InsecureSkipVerify: true, VerifyConnection: func(cs tls.ConnectionState) error { @@ -62,7 +62,12 @@ func (d *PlaintextDialer) DialContext(ctx context.Context, network, address stri _, err := cs.PeerCertificates[0].Verify(opts) return err }, - }, tls.HelloRandomized) + }, tls.HelloAndroid_11_OkHttp) + if err := tlsConn.HandshakeContext(ctx); err != nil { + conn.Close() + return nil, err + } + return tlsConn, nil } return conn, nil }