From 913ed62095428f99f93697274f7efd30a18e2d4f Mon Sep 17 00:00:00 2001 From: H1JK Date: Fri, 10 Mar 2023 20:53:39 +0800 Subject: [PATCH] fix: ALPN not applied in uTLS/REALITY --- component/tls/reality.go | 1 + component/tls/utls.go | 1 + transport/gun/gun.go | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/component/tls/reality.go b/component/tls/reality.go index 732613d8..dbd4bf41 100644 --- a/component/tls/reality.go +++ b/component/tls/reality.go @@ -41,6 +41,7 @@ func GetRealityConn(ctx context.Context, conn net.Conn, ClientFingerprint string } uConfig := &utls.Config{ ServerName: tlsConfig.ServerName, + NextProtos: tlsConfig.NextProtos, InsecureSkipVerify: true, SessionTicketsDisabled: true, VerifyPeerCertificate: verifier.VerifyPeerCertificate, diff --git a/component/tls/utls.go b/component/tls/utls.go index a7189aa8..e08ca7ee 100644 --- a/component/tls/utls.go +++ b/component/tls/utls.go @@ -89,6 +89,7 @@ func copyConfig(c *tls.Config) *utls.Config { return &utls.Config{ RootCAs: c.RootCAs, ServerName: c.ServerName, + NextProtos: c.NextProtos, InsecureSkipVerify: c.InsecureSkipVerify, VerifyPeerCertificate: c.VerifyPeerCertificate, } diff --git a/transport/gun/gun.go b/transport/gun/gun.go index 8eafdc50..ae2ea6a4 100644 --- a/transport/gun/gun.go +++ b/transport/gun/gun.go @@ -217,7 +217,7 @@ func NewHTTP2Client(dialFn DialFn, tlsConfig *tls.Config, Fingerprint string, re return utlsConn, nil } } else { - realityConn, err := tlsC.GetRealityConn(ctx, pconn, Fingerprint, tlsConfig, realityConfig) + realityConn, err := tlsC.GetRealityConn(ctx, pconn, Fingerprint, cfg, realityConfig) if err != nil { pconn.Close() return nil, err