Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterPolicy ¶
Types ¶
type BodyHash ¶
type BodyHash struct { Args []string `json:"args"` // contains filtered or unexported fields }
BodyHash is a policy that selects hosts based on hashing the request args
func (*BodyHash) Select ¶
func (r *BodyHash) Select(pool HostPool, ctx *fasthttp.RequestCtx) *fasthttputil.Proxy
type First ¶
type First struct{}
First is a policy that selects hosts based front active host
func (*First) Select ¶
func (r *First) Select(pool HostPool, ctx *fasthttp.RequestCtx) *fasthttputil.Proxy
type HostPool ¶
type HostPool []*fasthttputil.Proxy
type IPHash ¶
type IPHash struct{}
IPHash is a policy that selects hosts based on hashing the request ip
func (*IPHash) Select ¶
func (r *IPHash) Select(pool HostPool, ctx *fasthttp.RequestCtx) *fasthttputil.Proxy
type Policy ¶
type Policy interface { Select(pool HostPool, ctx *fasthttp.RequestCtx) *fasthttputil.Proxy Init() error }
type Proxy ¶
type Proxy struct { Balance map[string]interface{} `json:"balance"` Targets []*fasthttputil.Target `json:"targets"` // contains filtered or unexported fields }
func (*Proxy) Handler ¶
func (p *Proxy) Handler() fasthttp.RequestHandler
func (*Proxy) Process ¶
func (p *Proxy) Process(h fasthttp.RequestHandler) fasthttp.RequestHandler
type ProxyHeader ¶
type ProxyHeader struct { Set map[string]string `json:"set"` Add map[string]string `json:"add"` Del []string `json:"del"` }
func (*ProxyHeader) Handler ¶
func (p *ProxyHeader) Handler() fasthttp.RequestHandler
func (*ProxyHeader) Init ¶
func (p *ProxyHeader) Init(c *middleware.Config) (err error)
func (*ProxyHeader) Process ¶
func (p *ProxyHeader) Process(h fasthttp.RequestHandler) fasthttp.RequestHandler
func (*ProxyHeader) UnInit ¶
func (p *ProxyHeader) UnInit()
type Random ¶
type Random struct{}
Random is a policy that selects up hosts from a pool at random.
func (*Random) Select ¶
func (r *Random) Select(pool HostPool, ctx *fasthttp.RequestCtx) *fasthttputil.Proxy
Select selects an up host at random from the specified pool.
type Ratelimit ¶
type Ratelimit struct { Methods map[string]string `json:"methods"` Headers map[string]string `json:"headers"` Args map[string]string `json:"args"` Max int `json:"max"` Duration string `json:"duration"` Timeout string `json:"timeout"` Message struct { ContentType string `json:"content_type"` Message string `json:"message"` StatusCode string `json:"status_code"` } `json:"message"` // contains filtered or unexported fields }
func (*Ratelimit) Handler ¶
func (p *Ratelimit) Handler() fasthttp.RequestHandler
func (*Ratelimit) Process ¶
func (p *Ratelimit) Process(h fasthttp.RequestHandler) fasthttp.RequestHandler
type RoundRobin ¶
type RoundRobin struct {
// contains filtered or unexported fields
}
RoundRobin is a policy that selects hosts based on round robin ordering.
func (*RoundRobin) Init ¶
func (r *RoundRobin) Init() error
func (*RoundRobin) Select ¶
func (r *RoundRobin) Select(pool HostPool, ctx *fasthttp.RequestCtx) *fasthttputil.Proxy
Select selects an up host from the pool using a round robin ordering scheme.
Click to show internal directories.
Click to hide internal directories.