Repository navigation
Releases
v1.0.0
DnsPro v1.0.0
The first stable release of DnsPro, a C++23 library for parsing,
building, and resolving DNS messages against an in-memory authoritative
zone.
Highlights
- RFC 1035 wire-format packet structs —
Header,Name,Question,
ResourceRecord, andMessage, underDnsPro::Packet, giving parsed
DNS messages a typed, structured representation rather than raw bytes. Parser: bytes →Message— offset-driven, single-pass parsing,
with DNS name-compression pointer support (RFC 1035 §4.1.4) including
rejection of forward/self-pointers and pointer loops
(Status::COMPRESSION_FORWARD_POINTER,Status::COMPRESSION_LOOP).Builder:Message→ bytes — always writes full, uncompressed
names. This is a deliberate simplification, not a correctness gap:
round-trip correctness only requires that a rebuilt packet re-parse to
an equivalentMessage, not that it match another encoder's
compression choices byte-for-byte.ZoneStore— an in-memory, case-insensitive (RFC 4343) authoritative
record store, indexedname → type → recordsso lookups don't
degrade as the zone grows.Resolver— tiesParser+ZoneStore+Builderinto a single
resolve()call: raw query bytes in, raw response bytes out, with
correct NOERROR/NXDOMAIN/NODATA handling.
Performance
- Nested
name → type → recordsindexing inZoneStorekeeps
lookup()andremoveRecord()cost independent of zone size —
measured flat at ~144 ns/op whether the zone holds 100 or 10,000
names. Messagemove-construct/move-assign cost ~5–10 ns regardless of how
many questions or answer records the message holds, sinceVector's
move steals the underlying buffer pointer rather than copying
elements.- Compression-pointer following in
Parser::parseName()adds real,
bounded overhead over an uncompressed name — the one place
decompression cost shows up directly in the numbers below.
Benchmarks
Solo-timed at 10K / 100K / 1M iterations — no reference implementation
exists to compare against (there's no standard-library or widely-used
DNS parser/zone-store to pair each benchmark with). Full results:
benchmarks/results/v1.0.0.md.
| Operation | DnsPro (1M) |
|---|---|
Parser::parse() — query, single question |
62.97 ns/op |
Parser::parse() — response, 4 answer records |
296.11 ns/op |
Builder::build() — query, single question |
122.20 ns/op |
Builder::build() — response, 4 answer records |
399.52 ns/op |
ZoneStore::lookup() — existing name+type |
137.71 ns/op |
ZoneStore::lookup() — missing name |
61.89 ns/op |
Resolver::resolve() — answer found |
448.81 ns/op |
Resolver::resolve() — NXDOMAIN |
360.46 ns/op |
Message move-construct |
5.99 ns/op |
| Name parse — uncompressed | 63.46 ns/op |
| Name parse — via compression pointer | 96.05 ns/op |
The full Resolver::resolve() pipeline (360–449 ns/op) is the most
expensive path, unsurprising since it chains parse, zone lookup, and
build together — each stage individually stays under 400 ns/op.
ZoneStore lookups stay essentially flat at ~144 ns/op from 100 names
up to 10,000, confirming O(1) hash-based lookup rather than
degradation with zone size. The clearest trade-off is name
compression: resolving a name through a compression pointer costs
~51% more than an uncompressed name (96.05 ns vs. 63.46 ns/op) — the
added cost of following the pointer hop.
Testing
The project includes a comprehensive test suite — both the custom
framework and GoogleTest, covering the same categories — spanning:
- Unit tests
- Integration tests
- Lifecycle tests
- Regression tests
- Concurrency tests
ZoneStore currently has no internal locking, so its Concurrency test
deliberately exercises the real unsynchronized write race rather than
asserting correctness — see the Concurrency test suite for details.
Code Coverage
The current test suite achieves:
- 89.2% line coverage (265 / 297 lines)
- 86.2% function coverage (25 / 29 functions)
Coverage figures exclude test infrastructure and third-party
dependencies (GoogleTest/GoogleMock, vendored submodules), focusing on
the DnsPro library implementation.
Continuous Integration
Automated builds and tests are configured for:
- GCC — Debug
- GCC — Release
- Clang — Debug
- Clang — Release
- MSVC — Debug
- MSVC — Release
- AppleClang — Debug
- AppleClang — Release
Release
This release establishes DnsPro's complete core API surface: typed
wire-format structs, bidirectional parse/build with compression-pointer
support, an authoritative in-memory zone store, and a resolver tying
them together into a single raw-bytes-in, raw-bytes-out call. It does
not include a transport/network layer, and ZoneStore is not yet safe
for concurrent writes without external synchronization — both are
known, documented gaps rather than oversights.
Installation
From source:
git clone https://github.com/privateMwb/DnsResolver.git
cd DnsResolver
cmake -B build \
-DBUILD_TESTS=OFF \
-DBUILD_BENCHMARKS=OFF \
-DBUILD_REGRESSION=OFF \
-DBUILD_EXAMPLES=OFF
cmake --install buildThen, in your own CMakeLists.txt:
find_package(<CMAKE_PACKAGE_NAME> CONFIG REQUIRED)
target_link_libraries(your_target PRIVATE <CMAKE_PACKAGE_NAME>::<CMAKE_PACKAGE_NAME>)See the README for
the full build matrix, vcpkg/Conan packaging status, and API
reference.