0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

moved init to policy.go

This commit is contained in:
Austin 2015-05-28 18:16:23 -07:00
parent 593aec9ab1
commit dd946f8ab5
2 changed files with 6 additions and 6 deletions

View file

@ -13,6 +13,12 @@ type Policy interface {
Select(pool HostPool) *UpstreamHost Select(pool HostPool) *UpstreamHost
} }
func init() {
RegisterPolicy("random", func() Policy { return &Random{} })
RegisterPolicy("least_conn", func() Policy { return &LeastConn{} })
RegisterPolicy("round_robin", func() Policy { return &RoundRobin{} })
}
// Random is a policy that selects up hosts from a pool at random. // Random is a policy that selects up hosts from a pool at random.
type Random struct{} type Random struct{}

View file

@ -27,12 +27,6 @@ type staticUpstream struct {
} }
} }
func init() {
RegisterPolicy("random", func() Policy { return &Random{} })
RegisterPolicy("least_conn", func() Policy { return &LeastConn{} })
RegisterPolicy("round_robin", func() Policy { return &RoundRobin{} })
}
// NewStaticUpstreams parses the configuration input and sets up // NewStaticUpstreams parses the configuration input and sets up
// static upstreams for the proxy middleware. // static upstreams for the proxy middleware.
func NewStaticUpstreams(c parse.Dispenser) ([]Upstream, error) { func NewStaticUpstreams(c parse.Dispenser) ([]Upstream, error) {