mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-12 19:39:35 +03: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:
@ -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
|
||||
|
Reference in New Issue
Block a user