Commit Graph
55 Commits
Author SHA1 Message Date
Ximon EighteenandGitHub bbfd6ff6ec More Dname to Name renaming. (#308) 2024-05-06 15:26:00 +02:00
Martin HoffmannandGitHub 95a7218048 Update dependencies. (#304)
This PR updates all dependencies to their latest major version. This
requires some changes to the examples using tokio-rustls.

This PR also updates the minimum supported Rust version to 1.70.

This is a breaking change.
2024-04-29 17:41:07 +02: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
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
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
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
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
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
Martin HoffmannandGitHub cd88889557 Redesign zone file parsing. (#142)
This commit completely redesigns zone file parsing. The primary change is to
convert the scanner into a trait in order to allow multiple zone parser
implementations for different sources and purposes. A number of changes had
to be made in order to make this possible.

The commit also contains an initial implementation of a scanner that modifies
data in-place and can thus returned parsed data with only a minimal amount
of additional allocations. While working, this scanner is more a
proof-of-concept at this point to ensure that the API design is sound.

This commit is based on ideas and code proposed by @not-my-profile in #106.

This commit increases the minimal supported Rust version to 1.59.0.
2022-11-07 15:11:36 +01:00
28fd40fc0e Add DNS client example (#138)
Co-authored-by: TCY16 <tom@nlnetlabs.nl>
2022-08-26 11:46:00 +02:00
Joonas Koivunen e8296d8b3e chore: redo formatting 2021-01-14 11:50:50 +02:00
Joonas Koivunen 61b7f3f121 chore: cargo fmt 2021-01-13 16:04:16 +02:00
Joonas Koivunen c461f3c830 chore: upgrade deps following tokio 1.0 2021-01-13 13:00:52 +02:00
Martin Hoffmann 748a4d2dc8 Merge domain-resolv into domain::resolv. 2020-08-25 17:52:10 +02:00
Martin Hoffmann ee5a96f18f Re-arrange so that all domain sub-crates can live here. 2018-08-22 10:44:12 +02:00
Martin Hoffmann accb0879d3 Fix examples and doctests. 2018-08-21 19:01:41 +02:00
Martin Hoffmann edda10b2ee Add record types from RFC 4034 and 5155. 2018-05-01 18:37:42 +02:00
Martin Hoffmann 91335ceaf2 Rename Record::name to Record::owner. 2018-03-06 09:50:18 +01:00
Martin Hoffmann 356a9c8567 Make mine more like dig. 2017-12-30 16:07:57 +01:00
Martin Hoffmann 95c16bb1ea Make message builder’s freeze return a Message. 2017-12-21 10:51:10 +01:00
Martin Hoffmann 9a9fe1f0de Rename dig to mine. 2017-12-21 08:57:28 +01:00
Martin Hoffmann 2e56c7adff Bring back dig. 2017-12-21 08:55:12 +01:00
Martin Hoffmann 85904ba808 Switch error handling to failure crate. 2017-11-19 11:06:13 +01:00
Martin Hoffmann 9214f376ff Fix most of Clippy’s complaints. 2017-04-25 16:58:07 +02:00
Martin Hoffmann 8670bb7c16 Update rusthome example. 2017-03-19 10:52:15 +01:00
Martin Hoffmann 36bc5a9316 Re-implemet the resolver for new tokio version. 2017-02-15 18:04:15 +01:00
Martin Hoffmann 33f8a0105d Remove server stuff again. 2017-01-07 12:15:07 +01:00
Martin Hoffmann 9c259b601e Server transport and a first mock name server. 2016-10-21 15:21:48 +02:00
Martin Hoffmann 7cb1d5f5b4 Comment away the need for tokio-tls as a dependency. 2016-10-14 15:24:44 +02:00
Martin Hoffmann eb3a0b44eb Listen to Clippy. 2016-10-14 15:18:42 +02:00
Martin Hoffmann 0ee96fb26d Rename host example to lookup and add query options. 2016-10-14 12:07:27 +02:00
Martin Hoffmann ff1b2e35a1 Refactor bits. 2016-10-11 16:24:43 +02:00
Martin Hoffmann a47b42532b Revised Query and Resolver. 2016-09-26 11:30:52 +02:00
Martin Hoffmann 44df3c2de0 Let ComposeBuf build stream messages, choose via a new ComposeMode. 2016-09-16 12:59:06 +02:00
Martin Hoffmann 8ab619a3a6 Make Resolver::new() not requiring a config. 2016-09-13 15:33:19 +02:00
Martin Hoffmann e7c6f9acb1 Add example from futures tutorial and improve ergonomics of lookup_host. 2016-09-13 15:07:11 +02:00
Martin Hoffmann d5a06c5b92 Add lookup_addr. 2016-09-13 11:17:12 +02:00
Martin Hoffmann 40d4d746b8 Move resolver to tokio. 2016-09-12 15:36:23 +02:00
Martin Hoffmann ef6beea927 Disable doctests in resolv/mod.rs. 2016-07-23 13:11:39 +02:00
Martin Hoffmann e85918f99e Rename IANA enum variants to match naming guidelines. 2016-07-02 15:54:07 +02:00
Martin Hoffmann e1a1a545b5 Move bits::iana to ::iana. 2016-06-27 11:09:51 +02:00
Martin Hoffmann 837804316e Add reverse lookup task. 2016-06-27 10:30:45 +02:00
Martin Hoffmann 489e52588d Add host name lookups. 2016-06-15 17:35:58 +02:00
Martin Hoffmann 0503371da0 Document the resolver. 2016-06-09 13:40:33 +02:00
Martin Hoffmann 7f3be68477 Rearrange message handling. 2016-05-31 12:40:50 +02:00
Martin Hoffmann 86c39258aa Drop flavors in favor of cow-like types. 2016-05-28 16:53:27 +02:00