diff options
author | 2016-12-20 18:58:05 +0000 | |
---|---|---|
committer | 2016-12-20 18:58:05 +0000 | |
commit | c4ab98c6e336a1c39b3934bbb3bf691f849a6dbe (patch) | |
tree | 89d801ac1484232179bcb7c144f67b5945221367 /middleware/pkg | |
parent | 451a0bd5294f6c8a6c9c725c75ac1a9cbc996a42 (diff) | |
download | coredns-c4ab98c6e336a1c39b3934bbb3bf691f849a6dbe.tar.gz coredns-c4ab98c6e336a1c39b3934bbb3bf691f849a6dbe.tar.zst coredns-c4ab98c6e336a1c39b3934bbb3bf691f849a6dbe.zip |
Add middleware.NextOrFailure (#462)
This checks if the next middleware to be called is nil, and if so returns
ServerFailure and an error. This makes the next calling more robust and
saves some lines of code.
Also prefix the error with the name of the middleware to aid in
debugging.
Diffstat (limited to 'middleware/pkg')
-rw-r--r-- | middleware/pkg/debug/debug.go | 1 | ||||
-rw-r--r-- | middleware/pkg/dnsutil/host.go | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/middleware/pkg/debug/debug.go b/middleware/pkg/debug/debug.go index b3c33b344..186872f12 100644 --- a/middleware/pkg/debug/debug.go +++ b/middleware/pkg/debug/debug.go @@ -2,6 +2,7 @@ package debug import "strings" +// Name is the domain prefix we check for when it is a debug query. const Name = "o-o.debug." // IsDebug checks if name is a debugging name, i.e. starts with o-o.debug. diff --git a/middleware/pkg/dnsutil/host.go b/middleware/pkg/dnsutil/host.go index e38eb9e08..aaab586e8 100644 --- a/middleware/pkg/dnsutil/host.go +++ b/middleware/pkg/dnsutil/host.go @@ -8,7 +8,7 @@ import ( "github.com/miekg/dns" ) -// PorseHostPortOrFile parses the strings in s, each string can either be a address, +// ParseHostPortOrFile parses the strings in s, each string can either be a address, // address:port or a filename. The address part is checked and the filename case a // resolv.conf like file is parsed and the nameserver found are returned. func ParseHostPortOrFile(s ...string) ([]string, error) { |