aboutsummaryrefslogtreecommitdiff
path: root/middleware/etcd
diff options
context:
space:
mode:
Diffstat (limited to 'middleware/etcd')
-rw-r--r--middleware/etcd/README.md4
-rw-r--r--middleware/etcd/debug.go20
-rw-r--r--middleware/etcd/debug_test.go16
-rw-r--r--middleware/etcd/handler.go5
4 files changed, 5 insertions, 40 deletions
diff --git a/middleware/etcd/README.md b/middleware/etcd/README.md
index 80eff35cf..030977fef 100644
--- a/middleware/etcd/README.md
+++ b/middleware/etcd/README.md
@@ -37,7 +37,7 @@ etcd [ZONES...] {
* **ENDPOINT** the etcd endpoints. Defaults to "http://localhost:2397".
* `upstream` upstream resolvers to be used resolve external names found in etcd (think CNAMEs)
pointing to external names. If you want CoreDNS to act as a proxy for clients, you'll need to add
- the proxy middleware. **ADDRESS* can be an IP address, and IP:port or a string pointing to a file
+ the proxy middleware. **ADDRESS** can be an IP address, and IP:port or a string pointing to a file
that is structured as /etc/resolv.conf.
* `tls` followed the cert, key and the CA's cert filenames.
* `debug` allows for debug queries. Prefix the name with `o-o.debug.` to retrieve extra information in the
@@ -127,7 +127,7 @@ Or with *debug* queries enabled:
When debug queries are enabled CoreDNS will return errors and etcd records encountered during the resolution
process in the response. The general form looks like this:
- skydns.test.skydns.dom.a. 300 CH TXT "127.0.0.1:0(10,0,,false)[0,]"
+ skydns.test.skydns.dom.a. 0 CH TXT "127.0.0.1:0(10,0,,false)[0,]"
This shows the complete key as the owername, the rdata of the TXT record has:
`host:port(priority,weight,txt content,mail)[targetstrip,group]`.
diff --git a/middleware/etcd/debug.go b/middleware/etcd/debug.go
deleted file mode 100644
index d2dd66830..000000000
--- a/middleware/etcd/debug.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package etcd
-
-import "strings"
-
-const debugName = "o-o.debug."
-
-// isDebug checks if name is a debugging name, i.e. starts with o-o.debug.
-// it return the empty string if it is not a debug message, otherwise it will return the
-// name with o-o.debug. stripped off. Must be called with name lowercased.
-func isDebug(name string) string {
- if len(name) == len(debugName) {
- return ""
- }
- name = strings.ToLower(name)
- debug := strings.HasPrefix(name, debugName)
- if !debug {
- return ""
- }
- return name[len(debugName):]
-}
diff --git a/middleware/etcd/debug_test.go b/middleware/etcd/debug_test.go
index b1dbb0264..aa26dd846 100644
--- a/middleware/etcd/debug_test.go
+++ b/middleware/etcd/debug_test.go
@@ -4,7 +4,6 @@ package etcd
import (
"sort"
- "strings"
"testing"
"github.com/miekg/coredns/middleware/etcd/msg"
@@ -14,21 +13,6 @@ import (
"github.com/miekg/dns"
)
-func TestIsDebug(t *testing.T) {
- if ok := isDebug("o-o.debug.miek.nl."); ok != "miek.nl." {
- t.Errorf("expected o-o.debug.miek.nl. to be debug")
- }
- if ok := isDebug(strings.ToLower("o-o.Debug.miek.nl.")); ok != "miek.nl." {
- t.Errorf("expected o-o.Debug.miek.nl. to be debug")
- }
- if ok := isDebug("i-o.debug.miek.nl."); ok != "" {
- t.Errorf("expected i-o.Debug.miek.nl. to be non-debug")
- }
- if ok := isDebug(strings.ToLower("i-o.Debug.")); ok != "" {
- t.Errorf("expected o-o.Debug. to be non-debug")
- }
-}
-
func TestDebugLookup(t *testing.T) {
etc := newEtcdMiddleware()
etc.Debugging = true
diff --git a/middleware/etcd/handler.go b/middleware/etcd/handler.go
index c4fa3c46e..b462d7c5b 100644
--- a/middleware/etcd/handler.go
+++ b/middleware/etcd/handler.go
@@ -5,6 +5,7 @@ import (
"github.com/miekg/coredns/middleware"
"github.com/miekg/coredns/middleware/etcd/msg"
+ "github.com/miekg/coredns/middleware/pkg/debug"
"github.com/miekg/coredns/middleware/pkg/dnsutil"
"github.com/miekg/coredns/request"
@@ -21,10 +22,10 @@ func (e *Etcd) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
}
name := state.Name()
if e.Debugging {
- if debug := isDebug(name); debug != "" {
+ if bug := debug.IsDebug(name); bug != "" {
opt.Debug = r.Question[0].Name
state.Clear()
- state.Req.Question[0].Name = debug
+ state.Req.Question[0].Name = bug
}
}