This language feature is deprecated, but the lint for it is not
enabled by default. Enabling the lint and fixing all occurrences also
resolves some new Clippy lints. This does not affect the API or
behaviour of the code in any way.
- Re-enable the cookies Stelline test and fix `CookiesMiddlewareProcessor` to allow requests with invalid cookies to proceed if they are authenticated or not required to authenticate.
- Add support for net blocks in the deny list of the cookie middleware processor, ala Unbound, otherwise the deny list is difficult to use beyond a few simple specific IP addresses.
- Improvements to the Stelline server test support needed by the Stelline cookies test:
- Advance mock system time in the Stelline server tests.
- Move Stelline server tests under src/ to permit #cfg(test) based swap out of real system time for mock system time.
- Use the thread_local version of mock_instant to ensure parallel mock time dependent tests don't interfere with each other (such tests also use tokio::time which only works if they run in a single thread).
- Set mock system time to start at zero for each Stelline server test (as expected by the cookies .rpl test script).
- Pass the IP address of the test client to the server so that the cookies middleware can match it against its deny list.
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.
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.
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.
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.
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.
This makes it possible to impl OctetsBuilder for Cow<[u8]> and other
types that can only append at the price of explicitely requiring AsRef<[u8]>
and AsMut<[u8]> where needed. Unfortunately, this means lots of code
changes but hopefully, these should not cause too much havoc with code
using the crate.
The unstable doc_cfg feature[0] makes rustdoc generate pretty notes for
APIs that are annotated to require a certain feature flag.
This commit adds these annotations and enables the unstable feature
for docs.rs builds (which already use nightly[1]).
To build the documentation locally with this feature use:
RUSTDOCFLAGS='--cfg docsrs' cargo +nightly doc --no-deps --all-features
[0]: https://doc.rust-lang.org/unstable-book/language-features/doc-cfg.html
[1]: https://docs.rs/about/builds