1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

NEW RECORD TYPE: HTTPS & SVCB (#2919)

Thanks so much for this contribution!  I have a feeling that a lot of people are going to need these records soon!
This commit is contained in:
Florian Ritterhoff
2024-05-01 17:37:15 +02:00
committed by GitHub
parent eae96860cd
commit 3a9b413175
22 changed files with 297 additions and 17 deletions

View File

@@ -341,6 +341,8 @@ func TestWriteZoneFileEach(t *testing.T) {
d = append(d, mustNewRR(`dname.bosun.org. 300 IN DNAME example.com.`))
d = append(d, mustNewRR(`dnssec.bosun.org. 300 IN DS 31334 13 2 94cc505ebc36b1f4e051268b820efb230f1572d445e833bb5bf7380d6c2cbc0a`))
d = append(d, mustNewRR(`dnssec.bosun.org. 300 IN DNSKEY 257 3 13 rNR701yiOPHfqDP53GnsHZdlsRqI7O1ksk60rnFILZVk7Z4eTBd1U49oSkTNVNox9tb7N15N2hboXoMEyFFzcw==`))
d = append(d, mustNewRR(`bosun.org. 300 IN HTTPS 1 . alpn="h3,h2"`))
d = append(d, mustNewRR(`bosun.org. 300 IN SVCB 1 . alpn="h3,h2"`))
buf := &bytes.Buffer{}
writeZoneFileRR(buf, d, "bosun.org")
if buf.String() != testdataZFEach {
@@ -359,6 +361,8 @@ var testdataZFEach = `$TTL 300
IN TXT "my text"
IN CAA 0 issue "letsencrypt.org"
IN DHCID AAIBY2/AuCccgoJbsaxcQc9TUapptP69lOjxfNuVAA2kjEA=
IN HTTPS 1 . alpn="h3,h2"
IN SVCB 1 . alpn="h3,h2"
4.5 IN PTR y.bosun.org.
_443._tcp IN TLSA 3 1 1 abcdef0
dname IN DNAME example.com.

View File

@@ -80,6 +80,12 @@ func (z *ZoneGenData) Less(i, j int) bool {
if pa != pb {
return pa < pb
}
case "SVCB", "HTTPS":
// sort by priority. If they are equal, sort by record.
if a.SvcPriority == b.SvcPriority {
return a.GetTargetField() < b.GetTargetField()
}
return a.SvcPriority < b.SvcPriority
case "PTR":
//ta2, tb2 := a.(*dns.PTR), b.(*dns.PTR)
pa, pb := a.GetTargetField(), b.GetTargetField()