Skip to content

ours-dns-wire ​

libs/dns-wire — DNS messages (RFC 1035): reading and writing.

Design ​

  • Reading expands compressed names, including inside record data, so a record can be stored, compared and written again separately from the message.
  • Writing compresses names where RFC 1035 allows a reader to expect it — like miekg/dns.
  • Types: Name (parse, wire, labels, domain, eq_ignore_case, root), Question, records and the message; the constants TYPE_* (A, AAAA, CNAME, SOA, PTR, MX, TXT, OPT, SVCB, HTTPS…), CLASS_INET, RCODE_*, the EDNS options OPTION_CLIENT_SUBNET, OPTION_PADDING; the error Error.

Who uses it ​

ours-dns-types (crates/dns-types), which re-exports it as ours_dns_types::message, and the allocs tool. Through ours-dns-types — ours-mod-dns, ours-mod-adblock and ours-mod-router.

Specifics ​

  • No dependencies.
  • Parsing records by type for the configuration (DNSRecordOptions, the zone-file format) lives not here but in crates/dns-types/src/options/record.rs.

Tests ​

Unit tests in src/lib.rs, tests/compress.rs; fuzz targets in fuzz/ (name, compress, message, record).

GPL-3.0-or-later