-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the net::server module. #274
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…t files in the examples/ dir.
ximon18
requested review from
a team
and removed request for
partim and
Philip-NLnetLabs
February 19, 2024 20:33
…f `Clone` and `Arc` and what this means for the user.
…connection-less oriented server metrics.
…ly back pressure rather than accepting connections when at the limit.
…nt `add_edns_options()` a bit more.
…pect but in general not modify requests, except in very limited ways. The one currently suppored modifcation is now clearly only possible via a setter on UdpTransportContext. Also simplified the `Request` type to always have an inner `Message` rather than some arbitrary `T`, as an arbitrary `T` may be modifiable while a `Message` is immutable.
…'s behaviour was incorrect with respect to QDCOUNT==0 requests, and it's not clear how it should behave with respect to the deny list or if it should exist in this middleware processor or at all.
…should be in the EDNS middleware processor.
…y handled where it should be in the EDNS middleware processor.
…ed an OPT record.
… no agreed use case for it at present.
…nnot be pushed. Try to adhere to RFC 6891 and push an OPT record in that case.
Philip-NLnetLabs
approved these changes
Apr 5, 2024
partim
approved these changes
Apr 11, 2024
partim
added a commit
that referenced
this pull request
Apr 30, 2024
Breaking changes * All types and functions referring to domain names have been changed from using the term “dname” to just “name.” For instance, `Dname` has become `Name`, `ToDname` has become `ToName`, and `ToDname::to_dname` has become `ToName::to_name`. ([#290]) * The `ToName` and `ToRelativeName` traits have been changed to have a pair of methods a la `try_to_name` and `to_name` for octets builders with limited and unlimited buffers, reflecting the pattern used elsewhere. ([#285]) * The types for IANA-registered parameters in `base::iana` have been changed from enums to a newtypes around their underlying integer type and associated constants for the registered values. (This was really always the better way to structure this.) ([#276], [#298]) * The `Txt` record data type now rejects empty record data as invalid. As a consequence `TxtBuilder` converts an empty builder into TXT record data consisting of one empty character string which requires `TxtBuilder::finish` to be able to return an error. ([#267]) * `Txt` record data serialization has been redesigned. It 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. ([#268]) * The text formatting for `CharStr` has been redesigned. The `Display` impl now uses a modified version of the representation format that doesn’t escape white space but also doesn’t enclose the string in quotes. Methods for explicitly formatting in quoted and unquoted presentation format are provided. ([#270]) * The `validate::RrsigExt` trait now accepts anything that impls `AsRef<Record<..>>` to allow the use of smart pointers. ([#288] by [@hunts]) * The stub resolver now uses the new client transports. This doesn’t change how it is used but does change how it queries the configured servers. ([#215]) * The sub resolver’s server configuration `Transport` type has been changed to be either `Transport::UdpTcp` for trying UDP and if that leads to a truncated answer try TCP and `Transport::Tcp` for only trying TCP. The stub resolver uses these accordingly now ([#296]) * Many error types have been changed from enums to structs that hide internal error details. Enums have been kept for errors where distinguishing variants might be meaningful for dealing with the error. ([#277]) * Renamed `Dnskey::is_zsk` to `is_zone_key`. ([#292]) * Split RRSIG timestamp handling from `Serial` into a new type `rdata::dnssec::Timestamp`. ([#294]) * Upgraded `octseq` to 0.5. ([#257]) * The minimum Rust version is now 1.70. ([#304]) New * Add impls for `AsRef<RelativeDname<[u8]>>` and `Borrow<RelativeDname<[u8]>>` to `RelativeDname<_>`. ([#251] by [@torin-carey]) * Added `name::Chain::fmt_with_dots` to format an absolute chained name with a final dot. ([#253]) * Added a new `ParseAnyRecordData` trait for record data types that can parse any type of record data. ([#256]) * Added implementations of `OctetsFrom` and `Debug` to `AllOptData` and the specific options types that didn’t have them yet. ([#257]) * Added missing ordering impls to `ZoneRecordData`, `AllRecordData`, `Opt`, and `SvcbRdata`. ([#293]) * Added `Name::reverse_from_addr` that creates a domain name for the reverse lookup of an IP address. ([#289]) * Added `OptBuilder::clone_from` to replace the OPT record with the content of another OPT record. ([#299]) * Added `Message::for_slice_ref` that returns a `Message<&[u8]>`. ([#300]) Bug fixes * Fixed the display implementation of `name::Chain<_, _>`. ([#253]) * Fixed the display implementation of `rdata::Txt<..>`. It now displays each embedded character string separately in quoted form. ([#259]) * Fixed the extended part returned by `OptRcode::to_parts` (it was shifted by 4 bits too many) and return all 12 bits for the `Int` variant in `OptRcode::to_int`. ([#258]) * Fixed a bug in the `inplace` zonefile parser that made it reject character string of length 255. ([#284]) Unstable features * Added the module `net::client` with experimental support for client message transport, i.e., sending of requests and receiving responses as well as caching of responses. This is gated by the `unstable-client-transport` feature. ([#215],[#275]) * Added the module `net::server` with experimental support for server transports, processing requests through a middleware chain and a service trait. This is gated by the `unstable-server-transport` feature. ([#274]) * Added the module `zonetree` providing basic traits representing a collection of zones and their data. The `zonetree::in_memory` module provides an in-memory implementation. The `zonetree::parsed` module provides a way to classify RRsets before inserting them into a tree. This is gated by the `unstable-zonetree` feature. ([#286])
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a
net::server
module todomain
that enables the creation of UDP and TCP DNS servers using base transport server, middelware and service building blocks.For examples of the code in use see:
examples/server-transports.rs
- if you run this it prints various suggesteddig
commands you can run to see it in action.net-server.rs
.Various things could be improved even without review feedback:
examples/serve.rs
is not neat and tidy at all and should maybe be split into multiple examples. - Resolution: Tidied up a bit.net::server::prelude
is a good idea or not. - Resolution: Removed.net::server::tests
haven't been looked at for a long time. - Resolution: Reviewed, added some comments, did some minor cleanup.dnsperf
and the 1M query set has been done yielding ~1.5M query/sec on the test machine for both UDP and TCP. This was done using the zone tree support in PR Add a queryable zone tree #286.unwrap()
- Resolution: Unwraps removed, explained with SAFETY comment, or converted to expect() if truly fatal.This PR also introduces tokio-tracing for async friendly context aware logging, e.g. one can capture the dns message id high up in a call tree and have it automatically included in a log message from deep in the call tree which I think is potentially very useful.
This PR is also probably incompatible with
--no-default-features
as that would disable thestd
feature yet this PR currently usesstd
functionality.However, I think it's a good moment to take a look at it as-is.