Commit Graph
414 Commits
Author SHA1 Message Date
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
Philip-NLnetLabsandGitHub 084c842eae Introduce a Timestamp type for Rrsig. (#294)
This PR splits the RRSIG timestamps from Serial into their own type
rdata::dnssec::Timestamp.

This PR is a breaking change.
2024-04-11 17:22:03 +02:00
Ximon EighteenandGitHub 0bd1a68fe0 Add the net::server module. (#274)
This PR adds an unstable net::server module that enables the creation of UDP
and TCP DNS servers using base transport server, middleware and service building blocks.
2024-04-11 16:41:40 +02:00
Philip-NLnetLabsandGitHub 938071241e Various ordering impls (#293)
This PR adds missing ordering impls to ZoneRecordData, AllRecordData,
Opt, and SvcbRdata.
2024-04-11 16:28:53 +02:00
Ximon Eighteen 1218118322 Typo correction in comment. 2024-04-11 09:46:31 +02:00
Philip Homburg c08b9cc951 Rename is_zsk to is_zone_key (PR #292). 2024-04-08 17:15:56 +02:00
Martin HoffmannandGitHub 8d9f686f47 Refactor IANA type variants into constants. (#276)
This PR changes the types for the IANA registered values into structs
wrapping underlying integer types and provides the values as constants. This
mostly just changes the spelling of those values. However, it also required
some re-wiring of the type generation macros for record data and opt data
since the type names and value names differ now.

This is a breaking change.
2024-04-05 11:16:23 +02:00
Martin HoffmannandGitHub a660758410 Change ToDname/ToRelativeDname to have try_to_*name and to_*name pairs. (#285)
This PR changes the ToDname and ToRelativeDname traits to have a pair of
methods for each conversion that either return a result or just a success
value depending on whether the octets builder used for the name can fail.
This should allow removing quite a few unwraps when e.g. Vec<u8> or Bytes
are used.

This is a breaking change.
2024-04-03 12:27:54 +02:00
Minghang ChenandGitHub edbbdecb88 Add AsRef impl for Record to allow for passing records by references when signing (#288)
This PR switches the validate::RrsigExt trait to accept anything that is
AsRef<Record<..>> instead of insisting on an actual Record so it can be
used with various smart pointers. It also adds an impl of AsRef<Self> to
Record to make this work.

This is a breaking change.
2024-04-03 11:00:16 +02:00
Ximon EighteenandGitHub b8a49f4491 Typo correction 2024-03-21 18:38:57 +01:00
Martin HoffmannandGitHub 1466e1e092 Partially seal error types. (#277)
This PR looks at all the error types and splits them into meaningful error
information, which will be available as enum variants, and internals, which
will be hidden away behind opaque structs. For the former case, we will
still use enums directly rather than have error kind enums. These will not
be non-exhaustive since they should really cover all possible cases and
exhaustive matching should work.

This is a breaking change.
2024-03-21 17:26:56 +01:00
Ximon EighteenandGitHub eb446cba54 Permit zone file strings upto AND including 255 characters in length. (#284)
This PR fixes a bug in the inplace zone parser that rejects character string of length 255.
2024-03-21 15:54:32 +01:00
Martin HoffmannandGitHub 7a0819dc90 Fix TXT record serialization. (#272)
This PR fixes TXT record data serialization for human-readable formats. TXT
record data is now serialized as a sequence of character strings. It also
deserializes from such a sequence. If supported by the format, it
alternatively deserializes from a string that is broken up into 255 octet
chunks if necessary.

It uses a newly added helper type base::charstr::DeserializeCharStrSeed that
deserializes character strings by appending them to an octets builder. Since
this may be useful for other cases, it has been made public.

This is a breaking change.
2024-03-18 12:44:11 +01:00
Philip Homburg 4d13fe8998 Client Cache (#275)
This PR adds experimental support for a client cache provided as a pass
through transport
2024-03-12 10:32:21 +01:00
Martin HoffmannandGitHub 1e25edb277 Fix nightly warnings. (#280)
This PR fixes warnings from lints added to the nightly compiler. It also
changes the CI workflow to error out when there are warnings.
2024-02-27 12:59:19 +01:00
Ximon EighteenandGitHub 669d547a94 Minor comment correction: TCP -> UDP. 2024-02-09 13:46:06 +01:00
Martin HoffmannandGitHub 74ce3dd62b Redesign CharStr formatting and serialization. (#270)
This PR redesigns the conversion of CharStr from and to text formats.

It distinguishes between three text formats: quoted and unquoted
representation format (i.e., what’s used in zonefiles) and a serialization
format which is an unquoted format with only backslash and non-printable
octets escaped. The latter will be used in serialization but also by default
for Display. This makes it reversible with the FromStr implementation but
avoids escaping white space. Methods for explicitly displaying in quoted and
unquoted representation format are provided.

Serialization works mostly as before but uses the serialization format
rather than the unquoted representation format in human-readable formats. It
still uses the raw octets in binary formats.

The PR adds proper documentation for all of it to the type.
2024-02-09 13:33:17 +01:00
Martin HoffmannandGitHub 7eb07f0619 Split rdata::rfc1035 into private sub-modules. (#269)
This PR splits the file for rdata::rfc1035, which is quickly approaching
3000 lines, into smaller private submodules. It doesn’t change any code.
2024-02-07 12:24:57 +01:00
Martin HoffmannandGitHub 8b97e43cb0 Reject empty TXT record data and never build it. (#267)
This PR changes the rdata::Txt type to reject empty record data as invalid.

RFC 1035 states that the TXT-DATA is “One or more <character-string>s”. This
means that there will have to be at least the length octet of the first
character string.

The PR also adjusts the TxtBuilder to never return a empty data. Since this
requires being able to return an error in TxtBuilder:.finish, this is a
breaking change. While at it, the PR also adds more control over the created
character strings by making close_char_str public and adding a new
append_char_str method.

The PR also improves the documentation for the TXT record data types.
2024-02-07 09:49:34 +01:00
Martin HoffmannandGitHub acda36919d Fix example for Dname::from_slice. (#265) 2024-02-05 13:42:48 +01:00
Martin HoffmannandGitHub 015bc0d734 Add OctetsFrom and Debug impls for AllOptData. (#257)
This PR adds implementation for OctetsFrom and Debug to AllOptData. As a
consequence, this also adds these to some of the option data types and
changes Debug for some of them to be available for all octets sequences.
2024-02-05 11:35:08 +01:00
Martin HoffmannandGitHub 145dc2b15f Introduce ParseAnyRecordData trait. (#256)
This PR introduces a new trait ParseAnyRecordData as a companion to
ParseRecordData for types that can parse record data of any record type.
2024-02-05 10:34:31 +01:00
Martin HoffmannandGitHub db012e4ad9 Fix Display impl for Txt and add CharStr::display_quoted. (#261)
This PR fixes the Display implementation for the Txt record data type. It
now prints each character string separately and quoted. It uses the new
CharStr::display_quoted method that prints the content of a character string
quoted and with only necessary characters escaped.
2024-02-05 10:29:12 +01:00
Ximon EighteenandGitHub 89863b558c RFC 6891 extended RCODE conversion function fixes. (#258)
This PR fixes the extended part returned by `OptRcode::parts` and changes
`OptRcode::to_int` to return all 12 bits.
2024-01-26 13:49:46 +01:00
Martin Hoffmann 23ad84e814 Minor language fix. 2024-01-16 10:42:57 +01:00
Martin HoffmannandGitHub e63c192ebc Remove interop and ci-test features and set interop tests to ignore. (#254)
* Remove interop and ci-test features and set interop tests to ignore.
* Fix feature selection.
* Clippy-suggested improvements.
* Do things for --all-targets in CI.
2024-01-16 10:29:05 +01:00
Philip-NLnetLabsandGitHub b8d2aa59bf Client Transport (#215)
This PR adds experimental support for client transport of DNS messages.

It also adds a new concept of unstable features which gate code that can introduce breaking changes also in non-breaking releases.
2024-01-15 14:54:20 +01:00
074ec4eed2 Fix displaying of chained domain names. (#253)
This PR fixes the Display implementation of Chain<_,_> so it considers all
possible combinations of empty, non-empty, and root names. It now behaves
similarly to the Display implementation of Dname in that it only adds a final
dot to an absolute name if it is the root label only. Similarly to Dname, it
also adds Chain::fmt_with_dot which returns a temporary type that formats
absolute names with a final dot.

---------

Co-authored-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com>
2024-01-12 13:24:56 +01:00
Torin CareyandGitHub 5f40b970c7 Add AsRef and Borrow for RelativeDname. (#251)
This PR adds impls for AsRef<RelativeDname<[u8]>> and
Borrow<RelativeDname<[u8]>> to RelativeDname<_>.
2024-01-09 12:49:19 +01:00
Markus ReiterandGitHub aad195601e Fix no_std. (#248)
Fixes various issues preventing building in a no-std environment.
2023-12-28 15:48:47 +01:00
HugoandGitHub fc8e989134 Replace futures dependency with futures_util (#246)
The latter is sufficient, and the former pulls over a dozen additional
unused dependencies.
2023-12-08 14:37:02 +01:00
xofyargandGitHub c54c7f7874 Fix a bug in dname scanning (#240)
The PR fixes an issue in scanning absolute domain names from a zonefile.
2023-11-16 14:37:32 +01:00
Torin CareyandGitHub 37d60e53f8 Add AsRef<Message<[u8]>> implementation for Message<Octs> (#242)
The reference type &Message<[u8]> makes for a suitable borrowed form for
the Message<Octs> type.
2023-11-13 17:26:14 +01:00
Torin CareyandGitHub 5987386276 Remove Sized constraint from tsig module types. (#241)
Currently the requirement of sized types means that Message<[u8]> cannot
be used in tsig operations.
2023-11-13 17:23:58 +01:00
Minghang ChenandGitHub 821b509762 Support unsized octets in parsing ZoneRecordData and UnknownRecordData (#237)
This PR adds `?Sized` bounds to the octets type for parsing ZoneRecordData
and UnknownRecordData.
2023-10-26 11:41:04 +02:00
Martin HoffmannandGitHub 454d29fbb1 Upgrade to ring 0.17. (#233) 2023-10-18 11:08:59 +02:00
xofyargandGitHub 1b8a37e114 Add Composer impl for mut refs. (#231)
This PR adds a blanket impl for mut refs to Composer types.
2023-10-18 10:15:33 +02:00
Martin HoffmannandGitHub b3b3b53bf6 Change FoundSrvs::merge signature and documentation. (#232)
This PR changes the signature of FoundSrvs::merge to use a non-mut other
and also changes the documentation to state the method doesn’t change
other which it didn’t do.
2023-10-17 14:55:16 +02:00
Martin Hoffmann 97bf460bb5 Clippy-related fixes. 2023-10-16 14:07:15 +02:00
Martin Hoffmann cc26065fb2 Clippy-related fixes (and non-fixes). 2023-10-16 14:03:31 +02:00
Martin HoffmannandGitHub 420958a9e2 Re-export octseq. (#230)
This PR re-exports the octseq crate under the dep module.
2023-10-16 11:24:49 +02:00
HugoandGitHub 98669b2f62 Mark function without side effects as must_use (#228)
This hint will make the compiler warn consumers of this library if they
ever call one of these functions without using its return value.
2023-10-05 19:07:40 +02:00
Martin HoffmannandGitHub 078f8e8212 Move flatten_into for flattening domain names into a trait. (#216)
This PR moves the flatten_into method present on various types that either
are or contain domain names into a FlattenInto trait. It also removes the
method from all types that aren’t or don’t contain domain names and only had
it to be able to make the big record data type enums.
2023-10-05 19:07:10 +02:00
xofyargandGitHub 28b871f309 Add ZONEMD support. (#229)
This commit add support for ZONEMD record type, described in RFC 8976.
2023-09-29 12:15:50 +02:00
Martin HoffmannandGitHub 6d19a96c1b Add AsRef impl for Dname. (#225) 2023-09-18 15:33:41 +02:00
Martin HoffmannandGitHub a6fef8fd8f Fix the Base 64 symbol converter. (#212)
This PR fixes util::base64::SymbolConverter to also include the final group
in the output if there is padding.
2023-09-18 14:25:34 +02:00
Martin HoffmannandGitHub 500930e68d Fix scanning of the root name. (#210)
This PR fixes scanning (i.e., reading from presentation format) of domain
names that are just the root label. It also fixes how they are displayed:
previously they were empty, now they are displayed as a dot. It also adds a
new method Dname::fmt_with_dot that returns a placeholder type that displays
the name with a dot at the end.
2023-09-18 14:22:36 +02:00
HugoandGitHub f55b8a57f8 Improve documentation for srv module (#224) 2023-09-18 13:57:35 +02:00
iximeowandGitHub 590615bf04 Add borrow impl for Dname<Vec<u8>> (#219)
This impl supports users of `domain` that may use `Dname` as keys in
standard library collections, who may want to query those collections
with non-owned `Dname`.

Include a doc comment testing that a collection of `Dname<Vec<u8>>` can
be queried with a `Dname<[u8]>`.
2023-09-18 13:53:15 +02:00