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 :)
27 lines
572 B
Go
27 lines
572 B
Go
package proxy
|
|
|
|
import (
|
|
"github.com/miekg/coredns/core/dnsserver"
|
|
"github.com/miekg/coredns/middleware"
|
|
|
|
"github.com/mholt/caddy"
|
|
)
|
|
|
|
func init() {
|
|
caddy.RegisterPlugin("proxy", caddy.Plugin{
|
|
ServerType: "dns",
|
|
Action: setup,
|
|
})
|
|
}
|
|
|
|
func setup(c *caddy.Controller) error {
|
|
upstreams, err := NewStaticUpstreams(&c.Dispenser)
|
|
if err != nil {
|
|
return middleware.Error("proxy", err)
|
|
}
|
|
dnsserver.GetConfig(c).AddMiddleware(func(next middleware.Handler) middleware.Handler {
|
|
return Proxy{Next: next, Client: Clients(), Upstreams: upstreams}
|
|
})
|
|
|
|
return nil
|
|
}
|