API - Add | Remove Routing Rules (#3189)

* add RuleTag to routing rules

* add router pb commands

* add and remove routing rules api

* cleanup

* fix

* improve error msg

* add append flag
apply balancer config
This commit is contained in:
Hossin Asaadi 2024-03-29 19:17:36 +04:00 committed by GitHub
parent 8a439bf3f2
commit 53e5814d19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 901 additions and 269 deletions

View file

@ -139,6 +139,7 @@ func (c *RouterConfig) Build() (*router.Config, error) {
}
type RouterRule struct {
RuleTag string `json:"ruleTag"`
Type string `json:"type"`
OutboundTag string `json:"outboundTag"`
BalancerTag string `json:"balancerTag"`
@ -560,6 +561,7 @@ func parseFieldRule(msg json.RawMessage) (*router.RoutingRule, error) {
}
rule := new(router.RoutingRule)
rule.RuleTag = rawFieldRule.RuleTag
switch {
case len(rawFieldRule.OutboundTag) > 0:
rule.TargetTag = &router.RoutingRule_Tag{