From dd946f8ab56fb861bfa026a1aa911f502838a0ed Mon Sep 17 00:00:00 2001 From: Austin Date: Thu, 28 May 2015 18:16:23 -0700 Subject: [PATCH] moved init to policy.go --- middleware/proxy/policy.go | 6 ++++++ middleware/proxy/upstream.go | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/middleware/proxy/policy.go b/middleware/proxy/policy.go index 27e02a17..a2522bcb 100644 --- a/middleware/proxy/policy.go +++ b/middleware/proxy/policy.go @@ -13,6 +13,12 @@ type Policy interface { 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. type Random struct{} diff --git a/middleware/proxy/upstream.go b/middleware/proxy/upstream.go index 03bba0e6..a657a088 100644 --- a/middleware/proxy/upstream.go +++ b/middleware/proxy/upstream.go @@ -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 // static upstreams for the proxy middleware. func NewStaticUpstreams(c parse.Dispenser) ([]Upstream, error) {