[build test]

This commit is contained in:
MetaCubeX
2022-03-16 00:43:08 +08:00
parent f01ac69654
commit 1034780e8e
15 changed files with 70 additions and 25 deletions

View File

@@ -4,6 +4,8 @@ import (
"fmt"
"github.com/Dreamacro/clash/component/geodata"
"github.com/Dreamacro/clash/component/geodata/router"
"github.com/Dreamacro/clash/component/mmdb"
"github.com/Dreamacro/clash/config"
"strings"
C "github.com/Dreamacro/clash/constant"
@@ -18,6 +20,10 @@ type GEOIP struct {
geoIPMatcher *router.GeoIPMatcher
}
func (g *GEOIP) ShouldFindProcess() bool {
return false
}
func (g *GEOIP) RuleType() C.RuleType {
return C.GEOIP
}
@@ -31,7 +37,10 @@ func (g *GEOIP) Match(metadata *C.Metadata) bool {
if strings.EqualFold(g.country, "LAN") || C.TunBroadcastAddr.Equal(ip) {
return ip.IsPrivate()
}
if !config.GeodataMode {
record, _ := mmdb.Instance().Country(ip)
return strings.EqualFold(record.Country.IsoCode, g.country)
}
return g.geoIPMatcher.Match(ip)
}