REPOSITORY CODING · MEDIUM
Use the closest DNS encloser for wildcard synthesis
A wildcard at the zone apex answers below an existing branch that has no wildcard of its own. Restore closest-encloser semantics, including empty nonterminal names and exact owners without the requested record type.
Distributed SystemsAuthoritative DNS zone laboratory
Work through a real codebase.
Choose an environment, investigate the existing implementation and use the tests to check your change. Sign in to open a workspace; execution and Ono usage follow your plan’s allowances.
Task requirements and environments
Go · 55 minute session
- Resolve authoritative A, AAAA, TXT and CNAME records entirely offline. Names are case-insensitive, @ means the zone apex, relative names are origin-qualified, and a terminal dot marks an absolute name. Emit canonical lower-case names without a trailing dot. Record owners must be inside the zone.
- An exact owner, including an empty nonterminal implied by a descendant, suppresses wildcard expansion. Otherwise use the wildcard directly under the closest existing ancestor; never fall back to a higher ancestor. Synthesized records use the queried owner name.
- Follow CNAME targets only for non-CNAME queries. Preserve the alias chain followed by sorted terminal records. Detect cycles and limit aliases to eight; SERVFAIL returns no partial answers. Queries outside the authoritative zone return REFUSED. Missing owners yield NXDOMAIN; existing owners without the requested type yield NODATA.
- Deduplicate exact record redelivery and sort RRsets deterministically. A CNAME owner cannot have another value or any other record type. Validate IP addresses, supported types, owner labels and bounded record/query batches before resolution. No public DNS resolver is contacted.