diff options
author | 2018-01-06 14:52:09 -0500 | |
---|---|---|
committer | 2018-01-06 14:52:09 -0500 | |
commit | 84ebbbc7225a8d7eb5e00c0c525f7e12932a9fe4 (patch) | |
tree | 075407cf860a7e32c121dfc0d292fd389bf7a3c2 /plugin/plugin.go | |
parent | 75a8a17da4fc95c086dfb447d29c02e7dbd05561 (diff) | |
download | coredns-84ebbbc7225a8d7eb5e00c0c525f7e12932a9fe4.tar.gz coredns-84ebbbc7225a8d7eb5e00c0c525f7e12932a9fe4.tar.zst coredns-84ebbbc7225a8d7eb5e00c0c525f7e12932a9fe4.zip |
kubernetes: Add zone filtering to fallthrough (#1353)
* Add zone filtering to fallthrough
* Doh. gofmt
* Update documentation
Diffstat (limited to 'plugin/plugin.go')
-rw-r--r-- | plugin/plugin.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/plugin/plugin.go b/plugin/plugin.go index a50f10830..137bb48af 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -83,6 +83,21 @@ func NextOrFailure(name string, next Handler, ctx context.Context, w dns.Respons return dns.RcodeServerFailure, Error(name, errors.New("no next plugin found")) } +// Fallthrough handles the fallthrough logic used in plugins that support it +func Fallthrough(ftzones *[]string, qname string) bool { + if ftzones == nil { + return false + } + if len(*ftzones) == 0 { + return true + } + zone := Zones(*ftzones).Matches(qname) + if zone != "" { + return true + } + return false +} + // ClientWrite returns true if the response has been written to the client. // Each plugin to adhire to this protocol. func ClientWrite(rcode int) bool { |