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 :)
This commit is contained in:
Miek Gieben
2016-09-19 11:26:00 +01:00
committed by GitHub
parent 1e706b5f21
commit 8555716046
20 changed files with 58 additions and 81 deletions

View File

@@ -6,6 +6,8 @@ import (
"net"
"time"
"github.com/miekg/coredns/middleware"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyfile"
)
@@ -96,7 +98,7 @@ func (h *dnsContext) MakeServers() ([]caddy.Server, error) {
}
// AddMiddleware adds a middleware to a site's middleware stack.
func (c *Config) AddMiddleware(m Middleware) {
func (c *Config) AddMiddleware(m middleware.Middleware) {
c.Middleware = append(c.Middleware, m)
}
@@ -126,17 +128,11 @@ func groupConfigsByListenAddr(configs []*Config) (map[string][]*Config, error) {
const (
// DefaultPort is the default port.
DefaultPort = "2053"
// DefaultRoot is the default root folder.
DefaultRoot = "."
)
// These "soft defaults" are configurable by
// command line flags, etc.
var (
// Root is the site root
// TODO(miek): double check if this is used and if we want to use it.
Root = DefaultRoot
// Port is the site port
Port = DefaultPort