aboutsummaryrefslogtreecommitdiff
path: root/middleware/normalize_test.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2017-08-07 13:24:09 -0700
committerGravatar GitHub <noreply@github.com> 2017-08-07 13:24:09 -0700
commite1c1521ad564dbae4106fba7c8cf29d9bb62778c (patch)
tree076bad082cd8a1c12a904e3eea9eebd330281976 /middleware/normalize_test.go
parent468d5b57de34e269a3c394385db146d98473d6e7 (diff)
downloadcoredns-e1c1521ad564dbae4106fba7c8cf29d9bb62778c.tar.gz
coredns-e1c1521ad564dbae4106fba7c8cf29d9bb62778c.tar.zst
coredns-e1c1521ad564dbae4106fba7c8cf29d9bb62778c.zip
Core: convert IP addresses to reverse zone (#838)
* Core: convert IP addresses to reverse zone If we see IP/mask syntax and the mask mod 8 == 0 we assume a reverse zone and convert to in-addr or .arpa. * typos * integration test * Addr is not used * core: clean up normalize Create a SplitHostPort function that can be used both from normalize.go and address.go. This removes some (not all!) duplication between the both and makes it work with reverse address notations. * More tests
Diffstat (limited to 'middleware/normalize_test.go')
-rw-r--r--middleware/normalize_test.go18
1 files changed, 3 insertions, 15 deletions
diff --git a/middleware/normalize_test.go b/middleware/normalize_test.go
index 285e185fd..e3d2268d3 100644
--- a/middleware/normalize_test.go
+++ b/middleware/normalize_test.go
@@ -69,7 +69,9 @@ func TestNameNormalize(t *testing.T) {
}
func TestHostNormalize(t *testing.T) {
- hosts := []string{".:53", ".", "example.org:53", "example.org.", "example.org.:53", "example.org."}
+ hosts := []string{".:53", ".", "example.org:53", "example.org.", "example.org.:53", "example.org.",
+ "10.0.0.0/8:53", "10.in-addr.arpa.", "10.0.0.0/9", "10.0.0.0/9.",
+ "dns://example.org", "example.org."}
for i := 0; i < len(hosts); i += 2 {
ts := hosts[i]
@@ -80,17 +82,3 @@ func TestHostNormalize(t *testing.T) {
}
}
}
-
-func TestAddrNormalize(t *testing.T) {
- addrs := []string{".:53", ".:53", "example.org", "example.org:53", "example.org.:1053", "example.org.:1053"}
-
- for i := 0; i < len(addrs); i += 2 {
- ts := addrs[i]
- expected := addrs[i+1]
- actual := Addr(ts).Normalize()
- if expected != actual {
- t.Errorf("Expected %v, got %v\n", expected, actual)
- }
- }
-
-}