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

@ -11,6 +11,7 @@ import (
type Rule struct {
Tag string
RuleTag string
Balancer *Balancer
Condition Condition
}
@ -150,7 +151,7 @@ func (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatch
leastLoadStrategy := NewLeastLoadStrategy(s)
return &Balancer{
selectors: br.OutboundSelector,
ohm: ohm,
ohm: ohm,
fallbackTag: br.FallbackTag,
strategy: leastLoadStrategy,
}, nil
@ -159,7 +160,7 @@ func (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatch
case "":
return &Balancer{
selectors: br.OutboundSelector,
ohm: ohm,
ohm: ohm,
fallbackTag: br.FallbackTag,
strategy: &RandomStrategy{},
}, nil