fix: geosite match

This commit is contained in:
wwqgtxx 2022-11-21 10:33:42 +08:00
parent 18d62c4a17
commit d478728cb7
2 changed files with 8 additions and 3 deletions

View file

@ -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"

View file

@ -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
}