mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-12-01 14:18:36 +00:00
Fix sniffers clearing reverse mapped domain
This commit is contained in:
@@ -23,6 +23,8 @@ func HTTPHost(_ context.Context, metadata *adapter.InboundContext, reader io.Rea
|
||||
}
|
||||
}
|
||||
metadata.Protocol = C.ProtocolHTTP
|
||||
metadata.Domain = M.ParseSocksaddr(request.Host).Fqdn
|
||||
if domain := M.ParseSocksaddr(request.Host).Fqdn; domain != "" {
|
||||
metadata.Domain = domain
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
C "github.com/sagernet/sing-box/constant"
|
||||
"github.com/sagernet/sing/common/buf"
|
||||
E "github.com/sagernet/sing/common/exceptions"
|
||||
M "github.com/sagernet/sing/common/metadata"
|
||||
|
||||
"golang.org/x/crypto/hkdf"
|
||||
)
|
||||
@@ -309,7 +310,9 @@ find:
|
||||
metadata.SniffContext = fragments
|
||||
return E.Cause1(ErrNeedMoreData, err)
|
||||
}
|
||||
metadata.Domain = fingerprint.ServerName
|
||||
if domain := M.ParseSocksaddrHostPort(fingerprint.ServerName, 0).Fqdn; domain != "" {
|
||||
metadata.Domain = domain
|
||||
}
|
||||
for metadata.Client == "" {
|
||||
if len(frameTypeList) == 1 {
|
||||
metadata.Client = C.ClientFirefox
|
||||
|
||||
+3
-1
@@ -23,7 +23,9 @@ func TLSClientHello(ctx context.Context, metadata *adapter.InboundContext, reade
|
||||
}).HandshakeContext(ctx)
|
||||
if clientHello != nil {
|
||||
metadata.Protocol = C.ProtocolTLS
|
||||
metadata.Domain = M.ParseSocksaddrHostPort(clientHello.ServerName, 0).Fqdn
|
||||
if domain := M.ParseSocksaddrHostPort(clientHello.ServerName, 0).Fqdn; domain != "" {
|
||||
metadata.Domain = domain
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if errors.Is(err, io.ErrUnexpectedEOF) {
|
||||
|
||||
Reference in New Issue
Block a user