-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Service enhancement prerequisites for XFR support #369
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
…tain number of bytes should be reserved (to make space for post-processing adding EDNS options to the response), and (b) strongly typed passing of arbitrary metadata between middleware that produces a type and middleware that consumes the type (e.g. a TSIG key name).
…to be part of this PR branch.
…to be part of this PR branch.
…nded to be part of this PR branch.
…nded to be part of this PR branch.
… a function is no longer possible.
… fix-edns-middleware / PR #355.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me except for start_error.
…an error message.
Philip-NLnetLabs
approved these changes
Sep 3, 2024
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.
Taken from the
xfr
branch in order to split PR #335 into several smaller PRs.This PR makes changes, some of which are breaking (i.e. not backward compatible with earlier unstable server functionality without minor adjustments to existing consumer code, e.g. see the changes to
examples/serve-zone.rs
), including:Adds support for indicating to downstream Service impls that a certain number of bytes should be reserved (to make space for adding a TSIG RR or EDNS options during middleware post-processing).
Adds support for strongly typed passing of arbitrary metadata between middleware that produces a type and middleware that consumes the type (e.g. passing the used TSIG key name from TSIG middleware to XFR middleware).
Replaces the blanket
impl Service for Arc
with a more generalimpl Service for Deref
.Removes the blanket
impl Service for fn
as I have multiple times been blocked from defining some other Service impl because the fn one matches, because its presence can cause very confusing compiler error messages if yourimpl Service for T
is not quite in sync with the signature of your otherimpl T
blocks, and because Hyper doesn't need it so why do we?Adds an "enabled" flag to the
CookiesMiddlewareSvc
(and later theTsigMiddlewareSvc
will have it as well) making it easier to create a service stack with optionally enabled layers based on runtime configuration.There was some internal discussion today with @Philip-NLnetLabs about passing data between middleware layers instead as a map of string key to some value pairs, or adding an enum to Request with things that a middleware might need (e.g. TSIG key name, or other arbitrary T), but that isn't reflected (yet?) in this PR.
The upside of the approach in this PR is it allows a producing middleware to express the metadata type it produces and a consuming middleware to express compatibility with a certain metadata type (e.g. via a trait impl, see 88a8f02) and to then have compile time checking that the middleware are compatible with each other, without having to express up front every possible data that might need to be passed around with a request or else as some arbitrary Other(T). But I'm undecided about the best way to do this ...
The changes in this PR currently lack RustDocs, and testing (as the consuming and testing is done at the point of use in the
xfr
branch).