Refactor: metadata use netip.Addr

This commit is contained in:
yaling888
2022-04-20 01:52:51 +08:00
parent 29c775331a
commit cd62daccb0
45 changed files with 369 additions and 360 deletions

View File

@@ -21,7 +21,7 @@ func (g *GEOIP) RuleType() C.RuleType {
func (g *GEOIP) Match(metadata *C.Metadata) bool {
ip := metadata.DstIP
if ip == nil {
if !ip.IsValid() {
return false
}
@@ -34,7 +34,7 @@ func (g *GEOIP) Match(metadata *C.Metadata) bool {
resolver.IsFakeBroadcastIP(ip)
}
record, _ := mmdb.Instance().Country(ip)
record, _ := mmdb.Instance().Country(ip.AsSlice())
return strings.EqualFold(record.Country.IsoCode, g.country)
}