Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartHealthCheck ¶
func StartHealthCheck(lb *LoadBalancer)
Types ¶
type LeastConnections ¶
type LeastConnections struct{}
func NewLeastConnections ¶
func NewLeastConnections() *LeastConnections
func (*LeastConnections) GetNextServer ¶
func (lc *LeastConnections) GetNextServer(servers []*Server, req *http.Request) *Server
type LoadBalancer ¶
type LoadBalancer struct {
// contains filtered or unexported fields
}
func NewLoadBalancer ¶
func NewLoadBalancer(strategy LoadBalancingStrategy, conf *config.Config) *LoadBalancer
func (*LoadBalancer) AddServer ¶
func (lb *LoadBalancer) AddServer(host string, respTime time.Duration)
func (*LoadBalancer) ForwardRequest ¶
func (lb *LoadBalancer) ForwardRequest(res http.ResponseWriter, req *http.Request)
type LoadBalancingStrategy ¶
type RoundRobin ¶
type RoundRobin struct {
// contains filtered or unexported fields
}
func NewRoundRobin ¶
func NewRoundRobin() *RoundRobin
func (*RoundRobin) GetNextServer ¶
func (rr *RoundRobin) GetNextServer(servers []*Server, req *http.Request) *Server
type Server ¶
type Server struct { Proxy *proxy.Proxy Health bool ResponseTimeThreshold time.Duration // contains filtered or unexported fields }
Server represents a backend server.
func (*Server) CheckHealth ¶
CheckHealth checks the health of the server.
func (*Server) DecrementConnections ¶
func (s *Server) DecrementConnections()
func (*Server) GetActiveConnections ¶
func (*Server) IncrementConnections ¶
func (s *Server) IncrementConnections()
Click to show internal directories.
Click to hide internal directories.