diff --git a/transport/v2raygrpclite/client.go b/transport/v2raygrpclite/client.go index a6120c89..acf83abc 100644 --- a/transport/v2raygrpclite/client.go +++ b/transport/v2raygrpclite/client.go @@ -36,6 +36,12 @@ type Client struct { } func NewClient(ctx context.Context, dialer N.Dialer, serverAddr M.Socksaddr, options option.V2RayGRPCOptions, tlsConfig tls.Config) adapter.V2RayClientTransport { + var host string + if tlsConfig != nil && tlsConfig.ServerName() != "" { + host = M.ParseSocksaddrHostPort(tlsConfig.ServerName(), serverAddr.Port).String() + } else { + host = serverAddr.String() + } client := &Client{ ctx: ctx, dialer: dialer, @@ -48,7 +54,7 @@ func NewClient(ctx context.Context, dialer N.Dialer, serverAddr M.Socksaddr, opt }, url: &url.URL{ Scheme: "https", - Host: serverAddr.String(), + Host: host, Path: "/" + options.ServiceName + "/Tun", RawPath: "/" + url.PathEscape(options.ServiceName) + "/Tun", },