Documentation ¶
Index ¶
- Variables
- func ContainsSlice[T comparable](slice []T, target T) bool
- func CopySlice[T any](slice []T) []T
- func Hash(input string) uint
- func RewriteURL(url *url.URL) func(*httputil.ProxyRequest)
- func RewriteXForwarded(p *httputil.ProxyRequest)
- type Forwarder
- type Frontend
- type GracefulShutdown
- type HashingAlgorithm
- type HealthCheck
- type HealthChecker
- type LoadBalancingAlgorithm
- type RPFactory
- type Request
- type RequestForwarder
- type ReverseProxyFactory
- type Server
- type ServerPool
- type ServerPoolImplementation
- func (b *ServerPoolImplementation) HealthyServers() []string
- func (b *ServerPoolImplementation) RegisterServer(server string) error
- func (b *ServerPoolImplementation) Servers() []Server
- func (b *ServerPoolImplementation) SetServerStatus(server string, status ServerStatus) error
- func (b *ServerPoolImplementation) UnhealthyServers() []string
- func (b *ServerPoolImplementation) UnregisterServer(server string) error
- type ServerStatus
- type TLSOptions
- type TransFactory
- type TransportFactory
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ContainsSlice ¶
func ContainsSlice[T comparable](slice []T, target T) bool
func RewriteURL ¶
func RewriteURL(url *url.URL) func(*httputil.ProxyRequest)
func RewriteXForwarded ¶
func RewriteXForwarded(p *httputil.ProxyRequest)
Types ¶
type Forwarder ¶
type Forwarder struct {
// contains filtered or unexported fields
}
func NewForwarder ¶
func NewForwarder(lbAlgo LoadBalancingAlgorithm, rpFactory ReverseProxyFactory, logger *zap.Logger) *Forwarder
type Frontend ¶
type Frontend struct {
// contains filtered or unexported fields
}
func NewFrontend ¶
func NewFrontend(listenAddr string, tls *TLSOptions, reqForwarder RequestForwarder, logger *zap.Logger) *Frontend
type GracefulShutdown ¶
type GracefulShutdown interface {
Shutdown() error
}
type HashingAlgorithm ¶
type HealthCheck ¶
type HealthCheck struct {
// contains filtered or unexported fields
}
func NewHealthCheck ¶
func NewHealthCheck(endPoint string, interval time.Duration, serverPool ServerPool, expectedStatusCode int, client *http.Client, logger *zap.Logger) *HealthCheck
func (*HealthCheck) Run ¶
func (h *HealthCheck) Run()
func (*HealthCheck) Shutdown ¶
func (h *HealthCheck) Shutdown() error
type HealthChecker ¶
type HealthChecker interface {
Run()
}
type LoadBalancingAlgorithm ¶
type RPFactory ¶
type RPFactory struct {
// contains filtered or unexported fields
}
func NewRPFactory ¶
func NewRPFactory(transportFactory TransportFactory) *RPFactory
type RequestForwarder ¶
type RequestForwarder interface {
Forward(http.ResponseWriter, *http.Request) error
}
type ReverseProxyFactory ¶
type ReverseProxyFactory interface {
Create(string) (*httputil.ReverseProxy, error)
}
type Server ¶
type Server struct { Address string Status ServerStatus }
type ServerPool ¶
type ServerPoolImplementation ¶
type ServerPoolImplementation struct {
// contains filtered or unexported fields
}
func NewServerPool ¶
func NewServerPool(servers []string, logger *zap.Logger) *ServerPoolImplementation
func (*ServerPoolImplementation) HealthyServers ¶
func (b *ServerPoolImplementation) HealthyServers() []string
func (*ServerPoolImplementation) RegisterServer ¶
func (b *ServerPoolImplementation) RegisterServer(server string) error
func (*ServerPoolImplementation) Servers ¶
func (b *ServerPoolImplementation) Servers() []Server
func (*ServerPoolImplementation) SetServerStatus ¶
func (b *ServerPoolImplementation) SetServerStatus(server string, status ServerStatus) error
func (*ServerPoolImplementation) UnhealthyServers ¶
func (b *ServerPoolImplementation) UnhealthyServers() []string
func (*ServerPoolImplementation) UnregisterServer ¶
func (b *ServerPoolImplementation) UnregisterServer(server string) error
type ServerStatus ¶
type ServerStatus int
const ( Healthy ServerStatus = iota + 1 Unhealthy )
func (ServerStatus) String ¶
func (s ServerStatus) String() string
type TLSOptions ¶
type TransFactory ¶
type TransFactory struct {
// contains filtered or unexported fields
}
func NewTransportFactory ¶
func (*TransFactory) Create ¶
func (t *TransFactory) Create() *http.Transport
type TransportFactory ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.