aboutsummaryrefslogtreecommitdiff
path: root/core/dnsserver/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/dnsserver/server.go')
-rw-r--r--core/dnsserver/server.go42
1 files changed, 21 insertions, 21 deletions
diff --git a/core/dnsserver/server.go b/core/dnsserver/server.go
index 3f01cac5f..f24b1dd60 100644
--- a/core/dnsserver/server.go
+++ b/core/dnsserver/server.go
@@ -9,11 +9,11 @@ import (
"sync"
"time"
- "github.com/coredns/coredns/middleware"
- "github.com/coredns/coredns/middleware/metrics/vars"
- "github.com/coredns/coredns/middleware/pkg/edns"
- "github.com/coredns/coredns/middleware/pkg/rcode"
- "github.com/coredns/coredns/middleware/pkg/trace"
+ "github.com/coredns/coredns/plugin"
+ "github.com/coredns/coredns/plugin/metrics/vars"
+ "github.com/coredns/coredns/plugin/pkg/edns"
+ "github.com/coredns/coredns/plugin/pkg/rcode"
+ "github.com/coredns/coredns/plugin/pkg/trace"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"
@@ -35,12 +35,12 @@ type Server struct {
zones map[string]*Config // zones keyed by their address
dnsWg sync.WaitGroup // used to wait on outstanding connections
connTimeout time.Duration // the maximum duration of a graceful shutdown
- trace trace.Trace // the trace middleware for the server
+ trace trace.Trace // the trace plugin for the server
debug bool // disable recover()
classChaos bool // allow non-INET class queries
}
-// NewServer returns a new CoreDNS server and compiles all middleware in to it. By default CH class
+// NewServer returns a new CoreDNS server and compiles all plugin in to it. By default CH class
// queries are blocked unless the chaos or proxy is loaded.
func NewServer(addr string, group []*Config) (*Server, error) {
@@ -64,16 +64,16 @@ func NewServer(addr string, group []*Config) (*Server, error) {
}
// set the config per zone
s.zones[site.Zone] = site
- // compile custom middleware for everything
- var stack middleware.Handler
- for i := len(site.Middleware) - 1; i >= 0; i-- {
- stack = site.Middleware[i](stack)
+ // compile custom plugin for everything
+ var stack plugin.Handler
+ for i := len(site.Plugin) - 1; i >= 0; i-- {
+ stack = site.Plugin[i](stack)
// register the *handler* also
site.registerHandler(stack)
if s.trace == nil && stack.Name() == "trace" {
- // we have to stash away the middleware, not the
+ // we have to stash away the plugin, not the
// Tracer object, because the Tracer won't be initialized yet
if t, ok := stack.(trace.Trace); ok {
s.trace = t
@@ -83,7 +83,7 @@ func NewServer(addr string, group []*Config) (*Server, error) {
s.classChaos = true
}
}
- site.middlewareChain = stack
+ site.pluginChain = stack
}
return s, nil
@@ -177,11 +177,11 @@ func (s *Server) Address() string { return s.Addr }
// ServeDNS is the entry point for every request to the address that s
// is bound to. It acts as a multiplexer for the requests zonename as
// defined in the request so that the correct zone
-// (configuration and middleware stack) will handle the request.
+// (configuration and plugin stack) will handle the request.
func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) {
if !s.debug {
defer func() {
- // In case the user doesn't enable error middleware, we still
+ // In case the user doesn't enable error plugin, we still
// need to make sure that we stay alive up here
if rec := recover(); rec != nil {
DefaultErrorFunc(w, r, dns.RcodeServerFailure)
@@ -218,8 +218,8 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
if h, ok := s.zones[string(b[:l])]; ok {
if r.Question[0].Qtype != dns.TypeDS {
- rcode, _ := h.middlewareChain.ServeDNS(ctx, w, r)
- if !middleware.ClientWrite(rcode) {
+ rcode, _ := h.pluginChain.ServeDNS(ctx, w, r)
+ if !plugin.ClientWrite(rcode) {
DefaultErrorFunc(w, r, rcode)
}
return
@@ -239,8 +239,8 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
if dshandler != nil {
// DS request, and we found a zone, use the handler for the query
- rcode, _ := dshandler.middlewareChain.ServeDNS(ctx, w, r)
- if !middleware.ClientWrite(rcode) {
+ rcode, _ := dshandler.pluginChain.ServeDNS(ctx, w, r)
+ if !plugin.ClientWrite(rcode) {
DefaultErrorFunc(w, r, rcode)
}
return
@@ -248,8 +248,8 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
// Wildcard match, if we have found nothing try the root zone as a last resort.
if h, ok := s.zones["."]; ok {
- rcode, _ := h.middlewareChain.ServeDNS(ctx, w, r)
- if !middleware.ClientWrite(rcode) {
+ rcode, _ := h.pluginChain.ServeDNS(ctx, w, r)
+ if !plugin.ClientWrite(rcode) {
DefaultErrorFunc(w, r, rcode)
}
return