From 0d264e4ec70e7ded460e5568aa5d2a0ae34b9d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 21 Oct 2026 23:17:00 +0800 Subject: [PATCH] Fix TLS sniffer storing IP literal server names as domain --- common/sniff/tls.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/sniff/tls.go b/common/sniff/tls.go index 613086e8..e994c8aa 100644 --- a/common/sniff/tls.go +++ b/common/sniff/tls.go @@ -10,6 +10,7 @@ import ( C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing/common/bufio" E "github.com/sagernet/sing/common/exceptions" + M "github.com/sagernet/sing/common/metadata" ) func TLSClientHello(ctx context.Context, metadata *adapter.InboundContext, reader io.Reader) error { @@ -22,7 +23,7 @@ func TLSClientHello(ctx context.Context, metadata *adapter.InboundContext, reade }).HandshakeContext(ctx) if clientHello != nil { metadata.Protocol = C.ProtocolTLS - metadata.Domain = clientHello.ServerName + metadata.Domain = M.ParseSocksaddrHostPort(clientHello.ServerName, 0).Fqdn return nil } if errors.Is(err, io.ErrUnexpectedEOF) {