Documentation
¶
Overview ¶
Package proxy ... this file mainly to load from file and set proxy rules
Index ¶
- Variables
- func GCD(a, b int) int
- type Balancer
- type Proxy
- func (p *Proxy) Enable(enabled bool)
- func (p *Proxy) Enabled() bool
- func (p *Proxy) Handle(c *plugin.Context)
- func (p *Proxy) LoadPathRuler(rules []rule.PathRuler)
- func (p *Proxy) LoadReverseServer(cfgs map[string][]rule.ReverseServer)
- func (p *Proxy) LoadServerRuler(rules []rule.ServerRuler)
- func (p *Proxy) Name() string
- func (p *Proxy) Status() plugin.PlgStatus
- type ServerCfgInterface
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBalancerNotMatched plugin.Proxy balancer not matched ErrBalancerNotMatched = errors.New("plugin.Proxy balancer not matched") // ErrPageNotFound can not found page ErrPageNotFound = errors.New("404 Page Not Found") // ErrNoReverseServer ... ErrNoReverseServer = errors.New("could not found reverse proxy") )
View Source
var ( // ErrTimeout ... ErrTimeout = errors.New("combineReq timeout error") )
Functions ¶
Types ¶
type Balancer ¶
type Balancer struct {
// contains filtered or unexported fields
}
Balancer ...
func NewBalancer ¶
func NewBalancer(servers []ServerCfgInterface) *Balancer
NewBalancer ... 初始化调度器 Notice: https://github.com/golang/go/wiki/InterfaceSlice
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy ...
func New ¶
func New( reverseServers map[string][]rule.ReverseServer, pathRules []rule.PathRuler, srvRules []rule.ServerRuler, ) *Proxy
New ... load configs from outter to generate a new proxy plugin
func (*Proxy) Handle ¶
Handle ... proxy to handle with request ... 1. single path 2. all server proxy
func (*Proxy) LoadPathRuler ¶ added in v1.1.0
LoadPathRuler to load rules (type []proxy.PathRule) to initial
func (*Proxy) LoadReverseServer ¶ added in v1.1.0
func (p *Proxy) LoadReverseServer(cfgs map[string][]rule.ReverseServer)
LoadReverseServer to load cfgs (type []proxy.ReverseServerCfg) to initial Proxy.Balancers
func (*Proxy) LoadServerRuler ¶ added in v1.1.0
func (p *Proxy) LoadServerRuler(rules []rule.ServerRuler)
LoadServerRuler to load rules (type []proxy.ServerRule) to initial
type ServerCfgInterface ¶
type ServerCfgInterface interface {
// W means weight
W() int
}
ServerCfgInterface ...
Click to show internal directories.
Click to hide internal directories.