aboutsummaryrefslogtreecommitdiff
path: root/plugin/pkg/dnsutil/reverse.go
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2018-02-28 10:53:12 -0500
committerGravatar Miek Gieben <miek@miek.nl> 2018-02-28 07:53:12 -0800
commit395b614349ad730af8edbae204a4744128e0b0f3 (patch)
tree485759be8b223bc899b41b2e8af4d434063dfc78 /plugin/pkg/dnsutil/reverse.go
parent3c31011cedfca4a04d6afa44aa7312391a24d25d (diff)
downloadcoredns-395b614349ad730af8edbae204a4744128e0b0f3.tar.gz
coredns-395b614349ad730af8edbae204a4744128e0b0f3.tar.zst
coredns-395b614349ad730af8edbae204a4744128e0b0f3.zip
plugin/kubernetes: PTR/A reverse query corner cases (#1551)
* better handle non PTR rev zone qrys * vice versa * tests * comment typo * much cleaner
Diffstat (limited to 'plugin/pkg/dnsutil/reverse.go')
-rw-r--r--plugin/pkg/dnsutil/reverse.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/plugin/pkg/dnsutil/reverse.go b/plugin/pkg/dnsutil/reverse.go
index f92cf18b5..a39cf2ed8 100644
--- a/plugin/pkg/dnsutil/reverse.go
+++ b/plugin/pkg/dnsutil/reverse.go
@@ -29,6 +29,11 @@ func ExtractAddressFromReverse(reverseName string) string {
return f(strings.Split(search, "."))
}
+// IsReverse returns true if name is in a reverse zone
+func IsReverse(name string) bool {
+ return strings.HasSuffix(name, v4arpaSuffix) || strings.HasSuffix(name, v6arpaSuffix)
+}
+
func reverse(slice []string) string {
for i := 0; i < len(slice)/2; i++ {
j := len(slice) - i - 1