1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

fix strategy selector

This commit is contained in:
Shelikhoo 2021-06-19 13:00:18 +01:00
parent fc8d23bcc5
commit 8adb3dc5a6
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316

View File

@ -160,7 +160,7 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
// Build builds the balancing rule
func (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatcher) (*Balancer, error) {
switch br.Strategy {
case "leastPing":
case "leastping":
i, err := br.StrategySettings.GetInstance()
if err != nil {
return nil, err
@ -174,7 +174,7 @@ func (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatch
strategy: &LeastPingStrategy{config: s},
ohm: ohm,
}, nil
case "leastLoad":
case "leastload":
i, err := br.StrategySettings.GetInstance()
if err != nil {
return nil, err
@ -191,11 +191,13 @@ func (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatch
}, nil
case "random":
fallthrough
default:
case "":
return &Balancer{
selectors: br.OutboundSelector,
ohm: ohm, fallbackTag: br.FallbackTag,
strategy: &RandomStrategy{},
}, nil
default:
return nil, newError("unrecognized balancer type")
}
}