Refactor: metadata use netip.Addr
This commit is contained in:
@ -26,7 +26,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
|
||||
}
|
||||
|
||||
@ -39,10 +39,10 @@ func (g *GEOIP) Match(metadata *C.Metadata) bool {
|
||||
resolver.IsFakeBroadcastIP(ip)
|
||||
}
|
||||
if !C.GeodataMode {
|
||||
record, _ := mmdb.Instance().Country(ip)
|
||||
record, _ := mmdb.Instance().Country(ip.AsSlice())
|
||||
return strings.EqualFold(record.Country.IsoCode, g.country)
|
||||
}
|
||||
return g.geoIPMatcher.Match(ip)
|
||||
return g.geoIPMatcher.Match(ip.AsSlice())
|
||||
}
|
||||
|
||||
func (g *GEOIP) Adapter() string {
|
||||
|
Reference in New Issue
Block a user