Versions in this module Expand all Collapse all v1 v1.16.1 Dec 14, 2025 v1.16.0 Nov 15, 2025 Changes in this version + var ErrNoHealthyBackends = errors.New("no healthy backends available") + func AnyRelativePath(prefixPath string) string + func Chain(h http.Handler, middlewares ...Middleware) http.Handler + func DefaultTransport() *http.Transport + func SetLogger(l *zap.Logger) + func StartHealthChecks(backends []*Backend, config HealthCheckConfig) + type Backend struct + URL *url.URL + func NewBackend(prefixPath string, u *url.URL) *Backend + func ParseBackends(prefixPath string, targets []string) ([]*Backend, error) + func (b *Backend) DecrementActiveConns() + func (b *Backend) GetActiveConns() int64 + func (b *Backend) IncrementActiveConns() + func (b *Backend) IsHealthy() bool + func (b *Backend) SetHealthy(healthy bool) + func (b *Backend) StopHealthCheck() + type Balancer interface + AddBackend func(b *Backend) + GetBackends func() []*Backend + Next func(r *http.Request) (*Backend, error) + RemoveBackend func(b *Backend) + type HealthCheckConfig struct + Interval time.Duration + Timeout time.Duration + type IPHash struct + func NewIPHash(backends []*Backend) *IPHash + func (h *IPHash) AddBackend(b *Backend) + func (h *IPHash) GetBackends() []*Backend + func (h *IPHash) Next(r *http.Request) (*Backend, error) + func (h *IPHash) RemoveBackend(b *Backend) + type LeastConnections struct + func NewLeastConnections(backends []*Backend) *LeastConnections + func (lc *LeastConnections) AddBackend(b *Backend) + func (lc *LeastConnections) GetBackends() []*Backend + func (lc *LeastConnections) Next(_ *http.Request) (*Backend, error) + func (lc *LeastConnections) RemoveBackend(b *Backend) + type ManagementRequest struct + HealthCheck HealthCheckConfig + PrefixPath string + Targets []string + type Middleware func(http.Handler) http.Handler + type Proxy struct + func NewProxy(balancer Balancer) (*Proxy, error) + func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) + type RoundRobin struct + func NewRoundRobin(backends []*Backend) *RoundRobin + func (r *RoundRobin) AddBackend(b *Backend) + func (r *RoundRobin) GetBackends() []*Backend + func (r *RoundRobin) Next(_ *http.Request) (*Backend, error) + func (r *RoundRobin) RemoveBackend(b *Backend) + type Route struct + Backends []*Backend + Balancer Balancer + PrefixPath string + Proxy *Proxy + type RouteManager struct + func NewRouteManager() *RouteManager + func (m *RouteManager) AddRoute(prefixPath string, balancer Balancer) (*Route, error) + func (m *RouteManager) GetRoute(prefixPath string) (*Route, bool) + func (m *RouteManager) HandleAddBackends(w http.ResponseWriter, r *http.Request) + func (m *RouteManager) HandleGetBackend(w http.ResponseWriter, r *http.Request) + func (m *RouteManager) HandleListBackends(w http.ResponseWriter, r *http.Request) + func (m *RouteManager) HandleRemoveBackends(w http.ResponseWriter, r *http.Request)