You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
303 B
16 lines
303 B
3 years ago
|
package balancer
|
||
|
|
||
|
type Balancer interface {
|
||
|
NextPeer(nodes interface{}) (error, interface{})
|
||
|
}
|
||
|
|
||
|
// NewBalancer 根据策略标识返回新的负载均衡器
|
||
|
func NewBalancer(strategy string) Balancer {
|
||
|
switch strategy {
|
||
|
case "RoundRobin":
|
||
|
return &RoundRobin{}
|
||
|
default:
|
||
|
return &RoundRobin{}
|
||
|
}
|
||
|
}
|