coredns/middleware/loadbalance/setup.go
Miek Gieben 8555716046 Cleanups and tests (#272)
For some reasons there was a dnsserver/middleware.go that defined
the middleware handlers. This code was a repeat from
middleware/middleware.go. Removed dnsserver/middleware.go and replaced
all uses of dnsserver.Middleware with middleware.Middleware.

Added dnsserver/address_test.go to test the zone normalization (and to
improve the test coverage). The deleted file will also improve the test
coverage :)
2016-09-19 11:26:00 +01:00

26 lines
497 B
Go

package loadbalance
import (
"github.com/mholt/caddy"
"github.com/miekg/coredns/core/dnsserver"
"github.com/miekg/coredns/middleware"
)
func init() {
caddy.RegisterPlugin("loadbalance", caddy.Plugin{
ServerType: "dns",
Action: setup,
})
}
func setup(c *caddy.Controller) error {
for c.Next() {
// TODO(miek): block and option parsing
}
dnsserver.GetConfig(c).AddMiddleware(func(next middleware.Handler) middleware.Handler {
return RoundRobin{Next: next}
})
return nil
}