feat: Add sing-geoip database support

This commit is contained in:
H1JK
2023-07-14 22:28:24 +08:00
parent 5dd57bab67
commit 081e94c738
7 changed files with 73 additions and 19 deletions

View File

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