From e766f25d55626805e51d88f598dc428058efb409 Mon Sep 17 00:00:00 2001 From: zakuwaki <79925675+zakuwaki@users.noreply.github.com> Date: Fri, 24 Feb 2023 13:31:49 +0800 Subject: [PATCH] Fix private ip will never be matched --- route/rule_geoip.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/route/rule_geoip.go b/route/rule_geoip.go index 040e7a28..3611613a 100644 --- a/route/rule_geoip.go +++ b/route/rule_geoip.go @@ -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