Fix private ip will never be matched

This commit is contained in:
zakuwaki 2023-02-24 13:31:49 +08:00 committed by 世界
parent ef73c6f2a9
commit 593fc97c65
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4

View File

@ -63,11 +63,10 @@ func (r *GeoIPItem) Match(metadata *adapter.InboundContext) bool {
func (r *GeoIPItem) match(metadata *adapter.InboundContext, destination netip.Addr) bool {
var geoipCode string
geoReader := r.router.GeoIPReader()
if geoReader != nil {
geoipCode = geoReader.Lookup(destination)
}
if geoipCode == "" && !N.IsPublicAddr(destination) {
if !N.IsPublicAddr(destination) {
geoipCode = "private"
} else if geoReader != nil {
geoipCode = geoReader.Lookup(destination)
}
if geoipCode == "" {
return false