mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-02-20 23:47:21 -05:00
fix strategy selector
This commit is contained in:
parent
fc8d23bcc5
commit
8adb3dc5a6
@ -160,7 +160,7 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
|
|||||||
// Build builds the balancing rule
|
// Build builds the balancing rule
|
||||||
func (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatcher) (*Balancer, error) {
|
func (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatcher) (*Balancer, error) {
|
||||||
switch br.Strategy {
|
switch br.Strategy {
|
||||||
case "leastPing":
|
case "leastping":
|
||||||
i, err := br.StrategySettings.GetInstance()
|
i, err := br.StrategySettings.GetInstance()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -174,7 +174,7 @@ func (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatch
|
|||||||
strategy: &LeastPingStrategy{config: s},
|
strategy: &LeastPingStrategy{config: s},
|
||||||
ohm: ohm,
|
ohm: ohm,
|
||||||
}, nil
|
}, nil
|
||||||
case "leastLoad":
|
case "leastload":
|
||||||
i, err := br.StrategySettings.GetInstance()
|
i, err := br.StrategySettings.GetInstance()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -191,11 +191,13 @@ func (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatch
|
|||||||
}, nil
|
}, nil
|
||||||
case "random":
|
case "random":
|
||||||
fallthrough
|
fallthrough
|
||||||
default:
|
case "":
|
||||||
return &Balancer{
|
return &Balancer{
|
||||||
selectors: br.OutboundSelector,
|
selectors: br.OutboundSelector,
|
||||||
ohm: ohm, fallbackTag: br.FallbackTag,
|
ohm: ohm, fallbackTag: br.FallbackTag,
|
||||||
strategy: &RandomStrategy{},
|
strategy: &RandomStrategy{},
|
||||||
}, nil
|
}, nil
|
||||||
|
default:
|
||||||
|
return nil, newError("unrecognized balancer type")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user