From dae391fa416d69c91814d3fbf26a785b06c1bd27 Mon Sep 17 00:00:00 2001 From: Shelikhoo Date: Wed, 13 Apr 2022 23:00:46 +0100 Subject: [PATCH] Fix Simplified Router Bug in Processing Rules --- app/router/router.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/router/router.go b/app/router/router.go index 2314228c9..051c54dfa 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -223,7 +223,7 @@ func init() { rule.Domain = append(rule.Domain, geo.Domain...) } } - { + if v.PortList != "" { portList := &cfgcommon.PortList{} err := portList.UnmarshalText(v.PortList) if err != nil { @@ -231,7 +231,7 @@ func init() { } rule.PortList = portList.Build() } - { + if v.SourcePortList != "" { portList := &cfgcommon.PortList{} err := portList.UnmarshalText(v.SourcePortList) if err != nil { @@ -240,12 +240,21 @@ func init() { rule.SourcePortList = portList.Build() } rule.Domain = v.Domain - rule.Networks = net.ParseNetworks(v.Networks) + if v.Networks != "" { + rule.Networks = net.ParseNetworks(v.Networks) + } rule.Protocol = v.Protocol rule.Attributes = v.Attributes rule.UserEmail = v.UserEmail rule.InboundTag = v.InboundTag rule.DomainMatcher = v.DomainMatcher + switch s := v.TargetTag.(type) { + case *SimplifiedRoutingRule_Tag: + rule.TargetTag = &RoutingRule_Tag{s.Tag} + case *SimplifiedRoutingRule_BalancingTag: + rule.TargetTag = &RoutingRule_BalancingTag{s.BalancingTag} + } + routingRules = append(routingRules, rule) } fullConfig := &Config{