• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dnsimple / dns_erlang / 21398538190

27 Jan 2026 01:12PM UTC coverage: 84.905% (-0.3%) from 85.221%
21398538190

push

github

web-flow
Implement encoding DNS presentation format (#104)

It has, my favourite thing, property based testing to check that the inverse of encoding is decoding.

It is horrendously verbose though, but it hopefully perfectly RFC compliant and very very comprehensive.

It also splits the dns_zone module into two, all old code related to reading zonefiles moved to a hidden helper module called dns_zone_decode. (done in #105) This only implements a couple more record types that weren't implemented earlier but for which wire transcoding already existed.

How to review? The dns_zone_encode module itself is actually not really complicated, it only has one massive function with dozens of clauses, one for each record type. Everything else is rather obvious, and for this god-function, we can just check the record we like the most. Tests might be a lot more verbose than needed, cursor helped a lot generating them so more may have escaped that I could review, I focused on working on the code and making sure coverage was high.

* Split dns zone parsing logic into helper module

* Implement record types that wire transcoding supports but zone decode did not yet

* Implement zonefile encode

- Create dns_zone_encode.erl module for encoding DNS records to zone format
- Implement encode_rr/1,2 in dns_zone.erl public API
- Add encode_options type definition
- Implement encoding for: A, AAAA, NS, CNAME, PTR, MX, TXT, SPF, SOA, SRV, CAA
- Add helper functions: encode_dname, encode_quoted_string, encode_ttl
- Support relative names and @ symbol when origin is set
- Implement encoding for service types: NAPTR, HINFO, RP, AFSDB, RT, KX, DNAME, MB, MG, MR, MINFO
- Implement encoding for DNSSEC types: DS, CDS, DLV, DNSKEY, CDNSKEY, RRSIG, NSEC, NSEC3, NSEC3PARAM
- Implement encoding for security types: SSHFP, TLSA, SMIMEA, CERT, DHCID, OPENPGPKEY, WALLET
- Implement encoding for SVCB/HTTPS with service parameter encoding
- Implement encoding for other types: URI, RESINFO, EUI48, EUI6... (continued)

383 of 468 new or added lines in 3 files covered. (81.84%)

3178 of 3743 relevant lines covered (84.91%)

3969.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

89.53
/src/dns_zone_encode.erl


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc