make FilteredService::call_with_addr() public #964
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 is an alternative to #713 which doesn't make breaking changes to any public interfaces.
This allows a caller to invoke the filter and manually specify a remote address, since this doesn't automatically get passed along when using one's own listener.
Invoking this properly is a bit involved, because it requires doing a bunch of Hyper service boilerplate, but if you're making your own listener, you probably don't mind doing this too.
My concrete use case is I want to listen on a socket opened by systemd, which it provides via a file descriptor. I can't call
warp::Server::bind()
with a file descriptor, and I can't pass the SocketAddr for that socket because Systemd is already listening on it on my behalf. I can make aTcpListener
from a file descriptor just fine, but then Warp won't let me see the remote peers' addresses without this.example of use:
Full compilable program:
Cargo.toml:
src/main.rs: