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

@ -24,8 +24,13 @@ var geoIPMatcher *router.GeoIPMatcher
func (gf *geoipFilter) Match(ip netip.Addr) bool {
if !C.GeodataMode {
code := mmdb.Instance().LookupCode(ip.AsSlice())
return !strings.EqualFold(code, gf.code) && !ip.IsPrivate()
codes := mmdb.Instance().LookupCode(ip.AsSlice())
for _, code := range codes {
if !strings.EqualFold(code, gf.code) && !ip.IsPrivate() {
return true
}
}
return false
}
if geoIPMatcher == nil {