Add pkg/fall for Fallthrough (#1355)

* Add pkg/fall for Fallthrough

Move this into it's own package to facilitate tests. Important bug
was fixed: make the names fully qualified.

Add fall package to hosts, reverse, etcd, and fix kubernetes and any
tests. The k8s tests are still as-is, might need a future cleanup.
This commit is contained in:
Miek Gieben
2018-01-07 16:32:59 +00:00
committed by GitHub
parent 84ebbbc722
commit c6febe6250
22 changed files with 217 additions and 110 deletions

View File

@@ -5,6 +5,7 @@ import (
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/pkg/dnsutil"
"github.com/coredns/coredns/plugin/pkg/fall"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"
@@ -13,9 +14,10 @@ import (
// Reverse provides dynamic reverse DNS and the related forward RR.
type Reverse struct {
Next plugin.Handler
Networks networks
Fallthrough bool
Next plugin.Handler
Networks networks
Fall *fall.F
}
// ServeDNS implements the plugin.Handler interface.
@@ -97,7 +99,7 @@ func (re Reverse) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg
return dns.RcodeSuccess, nil
}
if re.Fallthrough {
if re.Fall.Through(state.Name()) {
return plugin.NextOrFailure(re.Name(), re.Next, ctx, w, r)
}
return dns.RcodeServerFailure, nil