fix: geosite match
This commit is contained in:
parent
271ae04f1e
commit
add8f84da3
2 changed files with 8 additions and 3 deletions
|
@ -2,10 +2,10 @@ package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Dreamacro/clash/component/geodata"
|
|
||||||
"github.com/Dreamacro/clash/component/geodata/router"
|
|
||||||
"strings"
|
"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/mmdb"
|
||||||
"github.com/Dreamacro/clash/component/resolver"
|
"github.com/Dreamacro/clash/component/resolver"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/Dreamacro/clash/constant"
|
||||||
|
|
|
@ -2,13 +2,14 @@ package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/geodata"
|
"github.com/Dreamacro/clash/component/geodata"
|
||||||
_ "github.com/Dreamacro/clash/component/geodata/memconservative"
|
_ "github.com/Dreamacro/clash/component/geodata/memconservative"
|
||||||
"github.com/Dreamacro/clash/component/geodata/router"
|
"github.com/Dreamacro/clash/component/geodata/router"
|
||||||
_ "github.com/Dreamacro/clash/component/geodata/standard"
|
_ "github.com/Dreamacro/clash/component/geodata/standard"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/Dreamacro/clash/constant"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/Dreamacro/clash/log"
|
||||||
_ "unsafe"
|
"github.com/Dreamacro/clash/transport/socks5"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GEOSITE struct {
|
type GEOSITE struct {
|
||||||
|
@ -24,6 +25,10 @@ func (gs *GEOSITE) RuleType() C.RuleType {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gs *GEOSITE) Match(metadata *C.Metadata) (bool, string) {
|
func (gs *GEOSITE) Match(metadata *C.Metadata) (bool, string) {
|
||||||
|
if metadata.AddrType() != socks5.AtypDomainName {
|
||||||
|
return false, ""
|
||||||
|
}
|
||||||
|
|
||||||
domain := metadata.Host
|
domain := metadata.Host
|
||||||
return gs.matcher.ApplyDomain(domain), gs.adapter
|
return gs.matcher.ApplyDomain(domain), gs.adapter
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue