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

@@ -1,6 +1,10 @@
package dnsserver
import "github.com/mholt/caddy"
import (
"github.com/miekg/coredns/middleware"
"github.com/mholt/caddy"
)
// Config configuration for a single server.
type Config struct {
@@ -13,14 +17,11 @@ type Config struct {
// The port to listen on.
Port string
// The directory from which to parse db files, and store keys.
Root string
// Middleware stack.
Middleware []Middleware
Middleware []middleware.Middleware
// Compiled middleware stack.
middlewareChain Handler
middlewareChain middleware.Handler
}
// GetConfig gets the Config that corresponds to c.
@@ -33,6 +34,6 @@ func GetConfig(c *caddy.Controller) *Config {
// we should only get here during tests because directive
// actions typically skip the server blocks where we make
// the configs.
ctx.saveConfig(c.Key, &Config{Root: Root})
ctx.saveConfig(c.Key, &Config{})
return GetConfig(c)
}