Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotAvailable is returned when no available upstream is found. ErrNotAvailable = errors.New("no available upstream at the moment") )
Functions ¶
func Register ¶
func Register(names []string, h CreateBalancerHandler) error
Register registers a new balancer creation handler for the given names.
Types ¶
type Balancer ¶
type Balancer interface {
Proxies() []proxy.Proxy
Select(ctx context.Context, hzCtx *app.RequestContext) (proxy.Proxy, error)
}
Balancer defines the interface for load balancing strategies.
type CreateBalancerHandler ¶
CreateBalancerHandler is a function type that creates a new Balancer.
func Factory ¶
func Factory(name string) CreateBalancerHandler
Factory returns a CreateBalancerHandler for the given balancer name.
Click to show internal directories.
Click to hide internal directories.