From 965ab075d95aee30fec9e3f748bdc3e47ed62bab Mon Sep 17 00:00:00 2001 From: dyhkwong <50692134+dyhkwong@users.noreply.github.com> Date: Sun, 24 Mar 2024 19:06:02 +0800 Subject: [PATCH] Fix source_ip_is_private matching --- route/rule_item_ip_is_private.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/route/rule_item_ip_is_private.go b/route/rule_item_ip_is_private.go index 4d511fdf..6592a9d3 100644 --- a/route/rule_item_ip_is_private.go +++ b/route/rule_item_ip_is_private.go @@ -24,12 +24,14 @@ func (r *IPIsPrivateItem) Match(metadata *adapter.InboundContext) bool { } else { destination = metadata.Destination.Addr } - if destination.IsValid() && !N.IsPublicAddr(destination) { - return true + if destination.IsValid() { + return !N.IsPublicAddr(destination) } - for _, destinationAddress := range metadata.DestinationAddresses { - if !N.IsPublicAddr(destinationAddress) { - return true + if !r.isSource { + for _, destinationAddress := range metadata.DestinationAddresses { + if !N.IsPublicAddr(destinationAddress) { + return true + } } } return false