From 334cbd3962a70cbe1caa6561c0fc0b868f0113a5 Mon Sep 17 00:00:00 2001 From: "./gray" Date: Thu, 24 Oct 2024 20:08:49 +0800 Subject: [PATCH] fix(routing): Fix MergeAndSortRulesOptimizer (#682) --- component/routing/optimizer.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/component/routing/optimizer.go b/component/routing/optimizer.go index 02e3484..3264a08 100644 --- a/component/routing/optimizer.go +++ b/component/routing/optimizer.go @@ -7,15 +7,16 @@ package routing import ( "fmt" + "net/netip" + "sort" + "strings" + "github.com/daeuniverse/dae/common/assets" "github.com/daeuniverse/dae/common/consts" "github.com/daeuniverse/dae/pkg/config_parser" "github.com/daeuniverse/dae/pkg/geodata" "github.com/mohae/deepcopy" "github.com/sirupsen/logrus" - "net/netip" - "sort" - "strings" ) type RulesOptimizer interface { @@ -87,6 +88,7 @@ func (o *MergeAndSortRulesOptimizer) Optimize(rules []*config_parser.RoutingRule if len(mergingRule.AndFunctions) == 1 && len(rules[i].AndFunctions) == 1 && mergingRule.AndFunctions[0].Name == rules[i].AndFunctions[0].Name && + mergingRule.AndFunctions[0].Not == rules[i].AndFunctions[0].Not && rules[i].Outbound.String(true, false, true) == mergingRule.Outbound.String(true, false, true) { mergingRule.AndFunctions[0].Params = append(mergingRule.AndFunctions[0].Params, rules[i].AndFunctions[0].Params...) } else {