diff --git a/constant/metadata.go b/constant/metadata.go index f1c68f68..599a6055 100644 --- a/constant/metadata.go +++ b/constant/metadata.go @@ -165,7 +165,7 @@ func (m *Metadata) SourceDetail() string { func (m *Metadata) AddrType() int { switch true { - case m.Host != "" || m.SniffHost != "" || !m.DstIP.IsValid(): + case m.Host != "" || !m.DstIP.IsValid(): return socks5.AtypDomainName case m.DstIP.Is4(): return socks5.AtypIPv4 diff --git a/rules/common/geosite.go b/rules/common/geosite.go index c0a3a1da..e89dc19b 100644 --- a/rules/common/geosite.go +++ b/rules/common/geosite.go @@ -9,7 +9,6 @@ import ( _ "github.com/Dreamacro/clash/component/geodata/standard" C "github.com/Dreamacro/clash/constant" "github.com/Dreamacro/clash/log" - "github.com/Dreamacro/clash/transport/socks5" ) type GEOSITE struct { @@ -25,11 +24,10 @@ func (gs *GEOSITE) RuleType() C.RuleType { } func (gs *GEOSITE) Match(metadata *C.Metadata) (bool, string) { - if metadata.AddrType() != socks5.AtypDomainName { + domain := metadata.RuleHost() + if len(domain) == 0 { return false, "" } - - domain := metadata.RuleHost() return gs.matcher.ApplyDomain(domain), gs.adapter }