Commit Graph
8 Commits
Author SHA1 Message Date
Philip-NLnetLabsandGitHub bcb4e8553f Fix clippy errors for 1.85.0. (#490)
* Fix clippy errors for 1.85.0.

* Also fix nightly clippies.

* Restore comment.

* Remove redundant ok()
2025-02-26 15:21:59 +01:00
Martin HoffmannandGitHub 47655265dd Rename *Dname* to *Name*. (#290)
This PR renames all types and functions that refer to domain name from using
the term “dname” to just “name.” For instance, Dname becomes Name, ToDname
becomes ToName, and ToDname::to_dname becomes ToName::to_name.

This annoyingly wide-reaching change is motivated by a clash with the DNAME
record type that would always be confusing. So we rather do it now.

This is a really breaking change. Apologies.
2024-04-22 13:31:34 +02:00
Ximon EighteenandGitHub b5b411ee56 Add a queryable zone tree (#286)
This PR adds zonefile/parsed.rs, zonetree/ and related examples/, which
together enable, and show a library user how, to go from a zone file in
presentation format to an in-memory tree of zones which can be queried to
provide an answer, or walked (iterated over).

The tree also supports versioned write operations and a trait based zone
implementation allowing for the in-memory tree for a zone to instead be some
other (a)synchornous backing store (as demonstrated by the mysql-zone.rs
example).

The zonetree module is feature-gated behind the unstable-zonetree feature.
2024-04-12 10:21:21 +02:00
Martin HoffmannandGitHub 5075e31f7c Refactor OPT options. (#193)
This PR refactors the existing support for OPT options. It does the
following things:

  o  Changes all option data types to ensure their wire format is at most
     65,535 octets long. This requires changing the signatures of some
     creator functions. Their naming scheme and signatures are also changed
     to follow the pattern established with record data.

  o  Renamed `UnknownOptData::from_octets` to `new` and return a result.

  o  Completely redesigns DNS cookie options, adding support for standard
     server cookies introduced in RFC 9018.

  o  Change the type of `ExtendedError`’s text to `Str<Octs>` and change the
     return type of `set_text` to `()`.

  o  Changed the type `TcpKeepalive`’s content to a newtype `IdleTimeout` to
     make it easier to convert to and from durations.

  o  Changes Padding to just contain the padding octets and drop
     `PaddingMode`. Instead, the methods on OptBuilder` should be used to
     add padding.

This is a breaking change.
2023-04-28 11:20:35 +02:00
Martin HoffmannandGitHub f29816bb94 Drop the try_ prefix from message builder methods. (#164)
This commit drops the `try_` prefix from `MessageBuilder` functions that still have it.
2023-01-10 13:15:40 +01:00
Martin HoffmannandGitHub a2ce078a92 The Great octseq Conversion (#160)
This commit swaps the traits and types defined in `base::octets` for their
equivalent in the `octseq` trait. These are mostly the same except that they
facilitate Generic Associated Types as stabilized in Rust 1.65. This results
in subtly changed trait bounds, though mostly these should be invisible to
the user.

One notable change is that `octseq` makes the error type of the
`OctetsBuilder` generic and uses `Infallible` for those types where
appending data will never fail (which, for most users, is all of them). It
provides methods for either case and we are mirroring these in `domain`.
While this means that converting you code to using the PR will require some
work, that work should mostly be removing unwraps – which is nice.

We’re using the opportunity to clean up a few more things that have crept
into the code over time. A list of which will be added here:

*  The range, slice, and split methods on the domain name types have
   changed. They have been merge into a single method taking ranges – except
   for those on `Dname` that require type changes. The split methods now
   take references and don’t change `self` anymore. This is somewhat
   required by the limitations imposed by the new `Octets` trait but feels
   better, anyway.

*  The `Parse`, `Compose`, and `Scan` traits have been demoted to mere
   extension traits for foreign types (primarily the built-in integers, so
   that you can do things like `u16::parse`). All other types now simply have
   methods matching the patterns. Where generics are necessary, dedicated
   traits have been added. E.g., there now are `ParseRecordData` and
   `ComposeRecordData` traits that are implemented by all record data types.

*  Composing of record data and options has been switched to a scheme where
   the size is predetermined whenever possible instead of composing the data
   and then updating the length after. Since this is not possible for record
   data that uses compressed names when compression is actually in use, the
   old scheme is still used in this particular case.
2023-01-10 12:48:41 +01:00
Axel VialaandGitHub 8b9163d521 Clippy: Needless borrow. (#162)
Found with #[warn(clippy::needless_borrowed_reference)]
2022-12-05 17:40:59 +01:00
28fd40fc0e Add DNS client example (#138)
Co-authored-by: TCY16 <tom@nlnetlabs.nl>
2022-08-26 11:46:00 +02:00