Fix for latest coredns

This commit is contained in:
Miek Gieben 2017-09-15 21:29:47 +01:00
parent 4d14b01c84
commit fe5e8f02ad
2 changed files with 6 additions and 7 deletions

View File

@ -4,15 +4,14 @@ package example
import (
"fmt"
"github.com/coredns/coredns/middleware"
"github.com/coredns/coredns/plugin"
"github.com/miekg/dns"
"golang.org/x/net/context"
)
// Example is an example middleware to ...
type Example struct {
Next middleware.Handler
Next plugin.Handler
}
// ServeDNS implements the middleware.Handler interface.
@ -21,7 +20,7 @@ func (e Example) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
// the next middleware - but as an example, show how to wrap a ResponseWriter might be
// educational.
pw := NewResponsePrinter(w)
return middleware.NextOrFailure(e.Name(), e.Next, ctx, pw, r)
return plugin.NextOrFailure(e.Name(), e.Next, ctx, pw, r)
}
// Name implements the Handler interface.

View File

@ -2,7 +2,7 @@ package example
import (
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/middleware"
"github.com/coredns/coredns/plugin"
"github.com/mholt/caddy"
)
@ -17,10 +17,10 @@ func init() {
func setup(c *caddy.Controller) error {
c.Next()
if c.NextArg() {
return middleware.Error("example", c.ArgErr())
return plugin.Error("example", c.ArgErr())
}
dnsserver.GetConfig(c).AddMiddleware(func(next middleware.Handler) middleware.Handler {
dnsserver.GetConfig(c).AddPlugin(func(next plugin.Handler) plugin.Handler {
return Example{Next: next}
})