Rename reverse zone constants (#1568)

Rename the constants to IP4arpa and IP6arpa (shorter and exported) and
make IsReverse return the type of the reverse zone which could be handy
for some callers.

Also add tests for IsReverse()
This commit is contained in:
Miek Gieben 2018-02-28 08:43:19 -08:00 committed by GitHub
parent 395b614349
commit 928de738dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 14 deletions

View file

@ -9,9 +9,10 @@ import (
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/pkg/dnsutil"
"github.com/coredns/coredns/plugin/pkg/parse"
"github.com/coredns/coredns/plugin/pkg/upstream"
"github.com/mholt/caddy"
"github.com/miekg/dns"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -113,7 +114,7 @@ func ParseStanza(c *caddy.Controller) (*Kubernetes, error) {
k8s.primaryZoneIndex = -1
for i, z := range k8s.Zones {
if strings.HasSuffix(z, "in-addr.arpa.") || strings.HasSuffix(z, "ip6.arpa.") {
if dnsutil.IsReverse(z) > 0 {
continue
}
k8s.primaryZoneIndex = i