feat: Add Meta-geoip V0 database support

This commit is contained in:
H1JK
2023-07-17 10:33:20 +08:00
parent a82745f544
commit b0e76ec791
5 changed files with 54 additions and 14 deletions

View File

@ -40,8 +40,13 @@ func (g *GEOIP) Match(metadata *C.Metadata) (bool, string) {
resolver.IsFakeBroadcastIP(ip), g.adapter
}
if !C.GeodataMode {
code := mmdb.Instance().LookupCode(ip.AsSlice())
return strings.EqualFold(code, g.country), g.adapter
codes := mmdb.Instance().LookupCode(ip.AsSlice())
for _, code := range codes {
if strings.EqualFold(code, g.country) {
return true, g.adapter
}
}
return false, g.adapter
}
return g.geoIPMatcher.Match(ip.AsSlice()), g.adapter
}