Domain 0.10.0 released

Published: Mon 29 April 2024
Last updated: Tue 04 June 2024

We are pleased to announce the release of version 0.10.0 of domain, our Rust crate for interacting with the Domain Name System (DNS).

This release is the result of the first three months of increased focus on the library. We have written more about our plans for the domain crate and what’s in store for this and the following years back in January in a blog post.

Breaking Changes

While we are adding many new features, we are also taking the opportunity to improve and clean up the existing code. This unfortunately means a number of breaking changes for current users of the crate. We tried to collect as many of those as possible in this release with the hope that we will not have to do big breaking changes again in the foreseeable future.

While most of these changes should have only limited impact on your code, there are two that might require somewhat more extensive search-and-replace.

For one, we decided to bite the bullet and rename all references to domain name from Dname to just Name. This resolves a very confusing conflict between our domain name type Dname and the DNAME record type. For consistency, we renamed all occurrences of Dname in type and function names. Not only is Dname now just Name, but there now also are RelativeName instead of RelativeDname and the ToName trait instead of the ToDname trait.

While at it, we also changed what is now the ToName::to_name method to follow the usual pattern of ToName::try_to_name for builder types with a limited buffer that can error out and ToName::to_name for unlimited builders. This change might cause somewhat confusing error messages but will save you an unwrap in many cases.

The second big change is that we changed how we represent the IANA-registered DNS parameters like Rtype or Class. Previously they were enums with an Int(_) variant for unknown values. This choice was made way back when associated constants weren’t available yet but made it always tricky to guarantee that the Int(_) variant really only contained unknown values.

We now changed all those types in the base::iana to structs wrapping the underlying integer type and represent the registered values as associated constants. This has the nice side-effect that they are now all-caps like they are in most of the registries. E.g., the DNAME record type is now Rtype::DNAME rather than Rtype::Dname.

There are a number of additional changes. We’ve fixed scanning, formatting, and serialization of CharStr and TXT record data to be more consistent. We cleaned up error types everywhere which now hide internal error details and only provide enum variants where a differentiation between error cases is meaningful to the caller. For all the changes, please check the release notes.

New Features

This release also sees the first three new features added to the crate. Since we consider them experimental at this point – we want to gain experience with the designs we’ve chosen and change them if necessary –, we decided to introduce the notion of “unstable features.” The idea is that these features may contain breaking changes even in minor releases to keep the frequency of breaking releases at a lower rate. If you want to use these features, you might want to use a specific version in your Cargo.toml.

The first of these new features is unstable-client-transport which adds the client side of sending DNS messages over UDP, TCP, and TLS. These transports can either be used individually or combined into a “redundant transport” that tries and picks the best available destination.

The second feature unstable-server-transport is the server counterpart and provides the ability to receive and process DNS requests. It is built on a Service concept that should sound familiar if you’ve used Hyper before. It also provides a configurable middleware that let’s you choose which server features you want to support.

Finally, we have the unstable-zonetree feature which provides the machinery for representing DNS zones, as well as an in-memory representation of a zone. Such a zone can be loaded from a zonefile – although we don’t have implementations for all record types yet – and can be used with the server transport to implement a simple authoritative server.

Other Additions and Bug Fixes

Beyond these big things, the release also contains quite a few small additions and bug fixes. Please see the release notes for details.

Acknowledgment

We would like to thank Sovereign Tech Fund for funding this work as well as everyone who has contributed to domain in the past and everyone who has used it!

Related links:

software update