Permalink
Browse files

Make 'aaaa', 'a' and 'ip' all work as options for a/aaaa configurations

  • Loading branch information...
abh committed Feb 20, 2018
1 parent 66fd46d commit 7e74631cc82763639c708d1fff8222323ef13599
Showing with 7 additions and 5 deletions.
  1. +2 −2 dns/test.example.com.json
  2. +5 −3 zones/reader.go
@@ -220,10 +220,10 @@
"aaaa": "2a07:2180:0:1::400"
},
{
"aaaa": "2607:f238:3::1:45"
"ip": "2607:f238:3::1:45"
},
{
"aaaa": "2403:300:a0c:f000::1"
"ip": "2403:300:a0c:f000::1"
}
],
"max_hosts": "1",
View
@@ -271,7 +271,9 @@ func setupZoneData(data map[string]interface{}, zone *Zone) {
case map[string]interface{}:
r := rec.(map[string]interface{})
ip = r["ip"].(string)
if _, ok := r["ip"]; ok {
ip = r["ip"].(string)
}
if len(ip) == 0 || dnsType == dns.TypePTR {
switch dnsType {
@@ -303,13 +305,13 @@ func setupZoneData(data map[string]interface{}, zone *Zone) {
record.RR = &dns.A{Hdr: h, A: x}
break
}
panic(fmt.Errorf("Bad A record %s for %s", ip, dk))
panic(fmt.Errorf("Bad A record %q for %q", ip, dk))
case dns.TypeAAAA:
if x := net.ParseIP(ip); x != nil {
record.RR = &dns.AAAA{Hdr: h, AAAA: x}
break
}
panic(fmt.Errorf("Bad AAAA record %s for %s", ip, dk))
panic(fmt.Errorf("Bad AAAA record %q for %q", ip, dk))
}
case dns.TypeMX:

0 comments on commit 7e74631

Please sign in to comment.