REPOSITORY CODING · MEDIUM
Canonicalize DNS master-file owner names
Case variants and terminal-dot names fail to locate existing DNS records. Implement lower-case canonical names, absolute versus relative qualification and the apex symbol consistently for records, queries and alias targets.
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.