From fe5e8f02ad4b76d7b8701303414fe28e75c0825b Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 15 Sep 2017 21:29:47 +0100 Subject: [PATCH] Fix for latest coredns --- example.go | 7 +++---- setup.go | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/example.go b/example.go index 9dda4a5..5212f41 100644 --- a/example.go +++ b/example.go @@ -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. diff --git a/setup.go b/setup.go index 1056d52..fe862d2 100644 --- a/setup.go +++ b/setup.go @@ -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} })