mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Added PTR record support for prettyzone (#182)
This commit is contained in:
committed by
Tom Limoncelli
parent
92f09c83b1
commit
2ef6b9d6c5
@ -67,6 +67,12 @@ func (z *zoneGenData) Less(i, j int) bool {
|
||||
if pa != pb {
|
||||
return pa < pb
|
||||
}
|
||||
case dns.TypePTR:
|
||||
ta2, tb2 := a.(*dns.PTR), b.(*dns.PTR)
|
||||
pa, pb := ta2.Ptr, tb2.Ptr
|
||||
if pa != pb {
|
||||
return pa < pb
|
||||
}
|
||||
case dns.TypeCAA:
|
||||
ta2, tb2 := a.(*dns.CAA), b.(*dns.CAA)
|
||||
// sort by tag
|
||||
|
@ -181,6 +181,27 @@ var testdataZFSRV = `$TTL 300
|
||||
IN SRV 10 10 9999 foo.com.
|
||||
`
|
||||
|
||||
func TestWriteZoneFilePtr(t *testing.T) {
|
||||
//exhibits explicit ttls and long name
|
||||
r1, _ := dns.NewRR(`bosun.org. 300 IN PTR chell.bosun.org`)
|
||||
r2, _ := dns.NewRR(`bosun.org. 300 IN PTR barney.bosun.org.`)
|
||||
r3, _ := dns.NewRR(`bosun.org. 300 IN PTR alex.bosun.org.`)
|
||||
buf := &bytes.Buffer{}
|
||||
WriteZoneFile(buf, []dns.RR{r1, r2, r3}, "bosun.org")
|
||||
if buf.String() != testdataZFPTR {
|
||||
t.Log(buf.String())
|
||||
t.Log(testdataZFPTR)
|
||||
t.Fatalf("Zone file does not match.")
|
||||
}
|
||||
parseAndRegen(t, buf, testdataZFPTR)
|
||||
}
|
||||
|
||||
var testdataZFPTR = `$TTL 300
|
||||
@ IN PTR alex.bosun.org.
|
||||
IN PTR barney.bosun.org.
|
||||
IN PTR chell.bosun.org.
|
||||
`
|
||||
|
||||
func TestWriteZoneFileCaa(t *testing.T) {
|
||||
//exhibits explicit ttls and long name
|
||||
r1, _ := dns.NewRR(`bosun.org. 300 IN CAA 0 issuewild ";"`)
|
||||
|
Reference in New Issue
Block a user