From d478728cb728bd7a3c540bd28ba596a14aae3b97 Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Mon, 21 Nov 2022 10:33:42 +0800 Subject: [PATCH] fix: geosite match --- rules/common/geoip.go | 4 ++-- rules/common/geosite.go | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/rules/common/geoip.go b/rules/common/geoip.go index ada862d2..72e77045 100644 --- a/rules/common/geoip.go +++ b/rules/common/geoip.go @@ -2,10 +2,10 @@ package common import ( "fmt" - "github.com/Dreamacro/clash/component/geodata" - "github.com/Dreamacro/clash/component/geodata/router" "strings" + "github.com/Dreamacro/clash/component/geodata" + "github.com/Dreamacro/clash/component/geodata/router" "github.com/Dreamacro/clash/component/mmdb" "github.com/Dreamacro/clash/component/resolver" C "github.com/Dreamacro/clash/constant" diff --git a/rules/common/geosite.go b/rules/common/geosite.go index ad3cbae5..e5a0b9f7 100644 --- a/rules/common/geosite.go +++ b/rules/common/geosite.go @@ -2,13 +2,14 @@ package common import ( "fmt" + "github.com/Dreamacro/clash/component/geodata" _ "github.com/Dreamacro/clash/component/geodata/memconservative" "github.com/Dreamacro/clash/component/geodata/router" _ "github.com/Dreamacro/clash/component/geodata/standard" C "github.com/Dreamacro/clash/constant" "github.com/Dreamacro/clash/log" - _ "unsafe" + "github.com/Dreamacro/clash/transport/socks5" ) type GEOSITE struct { @@ -24,6 +25,10 @@ func (gs *GEOSITE) RuleType() C.RuleType { } func (gs *GEOSITE) Match(metadata *C.Metadata) (bool, string) { + if metadata.AddrType() != socks5.AtypDomainName { + return false, "" + } + domain := metadata.Host return gs.matcher.ApplyDomain(domain), gs.adapter }