Ensure SOA is always the first record in the list

This commit is contained in:
nemunaire 2023-12-11 15:40:02 +01:00
parent 5ff353079d
commit 64d559e7dd
1 changed files with 8 additions and 0 deletions

View File

@ -190,6 +190,14 @@ func (z *Zone) GenerateRRs(origin string) (rrs models.Records) {
}
rrs = append(rrs, svc.GenRRs(subdomain, ttl, origin)...)
}
// Ensure SOA is the first record
for i, rr := range rrs {
if rr.Type == "SOA" {
rrs[0], rrs[i] = rrs[i], rrs[0]
break
}
}
}
return