From db3e1b9ed56756225d65265b8f0a253a82fe0a2c Mon Sep 17 00:00:00 2001 From: Skyxim Date: Sun, 19 Feb 2023 16:20:30 +0800 Subject: [PATCH] feat: add sni field for tuic --- adapter/outbound/tuic.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/adapter/outbound/tuic.go b/adapter/outbound/tuic.go index 0ca13670..5b7bde6e 100644 --- a/adapter/outbound/tuic.go +++ b/adapter/outbound/tuic.go @@ -51,6 +51,7 @@ type TuicOption struct { ReceiveWindowConn int `proxy:"recv-window-conn,omitempty"` ReceiveWindow int `proxy:"recv-window,omitempty"` DisableMTUDiscovery bool `proxy:"disable-mtu-discovery,omitempty"` + SNI string `proxy:"sni,omitempty"` } // DialContext implements C.ProxyAdapter @@ -106,12 +107,14 @@ func (t *Tuic) dialWithDialer(ctx context.Context, dialer C.Dialer) (pc net.Pack func NewTuic(option TuicOption) (*Tuic, error) { addr := net.JoinHostPort(option.Server, strconv.Itoa(option.Port)) serverName := option.Server - tlsConfig := &tls.Config{ ServerName: serverName, InsecureSkipVerify: option.SkipCertVerify, MinVersion: tls.VersionTLS13, } + if option.SNI != "" { + tlsConfig.ServerName = option.SNI + } var bs []byte var err error