Rename LbStrategyFastest to LbStrategyFirst

This commit is contained in:
Frank Denis 2019-06-02 13:24:24 +02:00
parent 3f2656dbe3
commit 2e89c8da01
3 changed files with 5 additions and 4 deletions

View File

@ -309,7 +309,8 @@ func ConfigLoad(proxy *Proxy, svcFlag *string) error {
case "ph":
lbStrategy = LBStrategyPH
case "fastest":
lbStrategy = LBStrategyFastest
case "first":
lbStrategy = LBStrategyFirst
case "random":
lbStrategy = LBStrategyRandom
default:

View File

@ -118,7 +118,7 @@ keepalive = 30
refused_code_in_responses = false
## Load-balancing strategy: 'p2' (default), 'ph', 'fastest' or 'random'
## Load-balancing strategy: 'p2' (default), 'ph', 'first' or 'random'
# lb_strategy = 'p2'

View File

@ -56,7 +56,7 @@ const (
LBStrategyNone = LBStrategy(iota)
LBStrategyP2
LBStrategyPH
LBStrategyFastest
LBStrategyFirst
LBStrategyRandom
)
@ -192,7 +192,7 @@ func (serversInfo *ServersInfo) getOne() *ServerInfo {
}
}
switch serversInfo.lbStrategy {
case LBStrategyFastest:
case LBStrategyFirst:
candidate = 0
case LBStrategyPH:
candidate = rand.Intn(Min(Min(serversCount, 2), serversCount/2))