mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
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:
parent
8a439bf3f2
commit
53e5814d19
13 changed files with 901 additions and 269 deletions
|
@ -2,6 +2,7 @@ package routing
|
|||
|
||||
import (
|
||||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
"github.com/xtls/xray-core/features"
|
||||
)
|
||||
|
||||
|
@ -13,6 +14,8 @@ type Router interface {
|
|||
|
||||
// PickRoute returns a route decision based on the given routing context.
|
||||
PickRoute(ctx Context) (Route, error)
|
||||
AddRule(config *serial.TypedMessage, shouldAppend bool) error
|
||||
RemoveRule(tag string) error
|
||||
}
|
||||
|
||||
// Route is the routing result of Router feature.
|
||||
|
@ -49,6 +52,16 @@ func (DefaultRouter) PickRoute(ctx Context) (Route, error) {
|
|||
return nil, common.ErrNoClue
|
||||
}
|
||||
|
||||
// AddRule implements Router.
|
||||
func (DefaultRouter) AddRule(config *serial.TypedMessage, shouldAppend bool) error {
|
||||
return common.ErrNoClue
|
||||
}
|
||||
|
||||
// RemoveRule implements Router.
|
||||
func (DefaultRouter) RemoveRule(tag string) error {
|
||||
return common.ErrNoClue
|
||||
}
|
||||
|
||||
// Start implements common.Runnable.
|
||||
func (DefaultRouter) Start() error {
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue