From 166392fe17c4a81a555d79a1d912d89f3ef10451 Mon Sep 17 00:00:00 2001 From: ayanamist Date: Tue, 24 Jun 2025 21:44:26 +0800 Subject: [PATCH] chore: sniffer replace domain only if domain is valid (#2122) --- component/sniffer/dispatcher.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/component/sniffer/dispatcher.go b/component/sniffer/dispatcher.go index eaf3401f..1dafcf1f 100644 --- a/component/sniffer/dispatcher.go +++ b/component/sniffer/dispatcher.go @@ -6,6 +6,8 @@ import ( "net/netip" "time" + "github.com/metacubex/sing/common/metadata" + "github.com/metacubex/mihomo/common/lru" N "github.com/metacubex/mihomo/common/net" C "github.com/metacubex/mihomo/constant" @@ -164,6 +166,9 @@ func replaceDomain(metadata *C.Metadata, host string, overrideDest bool) { } func (sd *Dispatcher) domainCanReplace(host string) bool { + if host == "." || !metadata.IsDomainName(host) { + return false + } for _, matcher := range sd.skipDomain { if matcher.MatchDomain(host) { return false