Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WeightedBalancer ¶
type WeightedBalancer struct {
// contains filtered or unexported fields
}
WeightedBalancer implements a weighted random load balancing algorithm.
func NewBalancer ¶
func NewBalancer(proxies []proxy.Proxy) (*WeightedBalancer, error)
NewBalancer creates a new WeightedBalancer instance. It calculates the total weight and ensures it doesn't exceed MaxInt32.
func (*WeightedBalancer) Proxies ¶
func (b *WeightedBalancer) Proxies() []proxy.Proxy
Proxies returns the list of proxies managed by the balancer.
func (*WeightedBalancer) Select ¶
func (b *WeightedBalancer) Select(ctx context.Context, hzCtx *app.RequestContext) (proxy.Proxy, error)
Select picks a proxy based on weights.
Click to show internal directories.
Click to hide internal directories.