Skip to content

Commit 166392f

Browse files
authored
chore: sniffer replace domain only if domain is valid (MetaCubeX#2122)
1 parent 5c6aa43 commit 166392f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

component/sniffer/dispatcher.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
"net/netip"
77
"time"
88

9+
"github.com/metacubex/sing/common/metadata"
10+
911
"github.com/metacubex/mihomo/common/lru"
1012
N "github.com/metacubex/mihomo/common/net"
1113
C "github.com/metacubex/mihomo/constant"
@@ -164,6 +166,9 @@ func replaceDomain(metadata *C.Metadata, host string, overrideDest bool) {
164166
}
165167

166168
func (sd *Dispatcher) domainCanReplace(host string) bool {
169+
if host == "." || !metadata.IsDomainName(host) {
170+
return false
171+
}
167172
for _, matcher := range sd.skipDomain {
168173
if matcher.MatchDomain(host) {
169174
return false

0 commit comments

Comments
 (0)