balancer

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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

type CreateBalancerHandler func(proxies []proxy.Proxy, params any) (Balancer, error)

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL