Add extended forward zone type for overriding public domain records

An extended zone answers authoritatively only for the records it holds
locally; any name with nothing configured falls through to recursive
resolution instead of a synthesized NXDOMAIN, so a public domain's
records don't need to be duplicated just to override a few of them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V8c76Xr2BycaHHu5N4buqi
This commit is contained in:
2026-08-20 17:35:41 -05:00
co-authored by Claude Sonnet 5
parent e6deb5fe84
commit b9cfe5ddce
10 changed files with 181 additions and 21 deletions
+23 -14
View File
@@ -188,20 +188,29 @@ func buildZone(mz models.Zone, recs []models.Record) (*Zone, []BuildError) {
}
}
// Automatic SOA management: a zone always answers with a SOA, whether or
// not one was explicitly stored.
if z.soa == nil {
z.soa = synthesiseSOA(mz)
apex := z.node(mz.Name)
apex.types[dns.TypeSOA] = []dns.RR{z.soa}
z.addENT(mz.Name)
}
// Likewise a zone should always have at least one apex NS record.
if len(z.ns) == 0 {
ns := synthesiseNS(mz)
apex := z.node(mz.Name)
apex.types[dns.TypeNS] = append(apex.types[dns.TypeNS], ns)
z.ns = append(z.ns, ns)
// Automatic SOA/NS management makes a zone answer authoritatively for
// every name under its apex, including ones with no configured records
// (NXDOMAIN/NODATA rather than a fall-through). An extended zone is
// deliberately not authoritative for the whole namespace - only for the
// records it explicitly overrides - so it does not get synthesised
// zone metadata: a name with nothing configured must be free to fall
// through to recursive resolution.
if z.Kind != models.ZoneExtended {
// Automatic SOA management: a zone always answers with a SOA, whether or
// not one was explicitly stored.
if z.soa == nil {
z.soa = synthesiseSOA(mz)
apex := z.node(mz.Name)
apex.types[dns.TypeSOA] = []dns.RR{z.soa}
z.addENT(mz.Name)
}
// Likewise a zone should always have at least one apex NS record.
if len(z.ns) == 0 {
ns := synthesiseNS(mz)
apex := z.node(mz.Name)
apex.types[dns.TypeNS] = append(apex.types[dns.TypeNS], ns)
z.ns = append(z.ns, ns)
}
}
return z, problems
}