Documentation ¶
Index ¶
- type ClientSession
- type Dialer
- type LbMethod
- type LoadBalancer
- func (lb *LoadBalancer) AddUpstream(u *Upstream)
- func (lb *LoadBalancer) Close()
- func (lb *LoadBalancer) Listen() error
- func (lb *LoadBalancer) Next(ip string, retry *Upstream) (us *Upstream)
- func (lb *LoadBalancer) RemoveUpstream(u *Upstream)
- func (lb *LoadBalancer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type Options
- type Upstream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientSession ¶
type ClientSession struct {
// contains filtered or unexported fields
}
type LoadBalancer ¶
type LoadBalancer struct { Options Upstreams []*Upstream // contains filtered or unexported fields }
func NewLoadBalancer ¶
func NewLoadBalancer(opt Options) (lb *LoadBalancer)
func (*LoadBalancer) AddUpstream ¶
func (lb *LoadBalancer) AddUpstream(u *Upstream)
func (*LoadBalancer) Close ¶
func (lb *LoadBalancer) Close()
func (*LoadBalancer) Listen ¶
func (lb *LoadBalancer) Listen() error
func (*LoadBalancer) RemoveUpstream ¶
func (lb *LoadBalancer) RemoveUpstream(u *Upstream)
func (*LoadBalancer) ServeHTTP ¶
func (lb *LoadBalancer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Options ¶
type Options struct { Host string `json:"host"` // The host header to set. Listen string `json:"listen"` // The listen address. Sticky bool `json:"sticky"` // If true, the same upstream is chosen for the same client if possible. Method LbMethod `json:"method"` // The load balancing method. RetryMax int `json:"retry_max"` // The maximum number of retries. RetryBackoff util.ParsableDuration `json:"retry_delay"` // The delay between retries. }
Click to show internal directories.
Click to hide internal directories.