-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow overriding of DNS resolution to specified IP addresses(#561) #1277
Conversation
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.
This is really good work, thank you! Just some small suggestions inline.
New version with the requested changes. I'm afraid I'm not great with the Github PR process so I did a force push and this may have made inter-version comparison more difficult. The only changes are:
|
Are there any more changes requested for this patch? Cheers. |
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.
Thanks, what a helpful feature, finally in! ❤️
Ah, to make the older Rust version work, you could use |
I have switched to futures_util and tested locally that it builds on 1.46. No other changes made so I expect workflows will work now. Thanks! |
…tar#561) This change allows users to bypass the selected DNS resolver for specific domains. The allows, for example, to make calls to a local TLS server by rerouting a given domain to 127.0.0.1. The approach I've taken for the design is to wrap the resolver in an outer service. This leads to a fair amount of boilerplate code mainly to be able to explain the typing to the compiler. The actual business logic is very simple for the number of lines involved. Closes seanmonstar#561
I rebased onto the new changes and no conflicts there either so merge should be simple. |
* master: add option to disable http2 upgrade (seanmonstar#1292) Fix documentation of http1_title_case_headers() (seanmonstar#1294) CI: make a single final job that depends on all others (seanmonstar#1291) Fix bare url warnings in `multipart` docs (seanmonstar#1289) v0.11.4 Allow overriding of DNS resolution to specified IP addresses(seanmonstar#561) (seanmonstar#1277) WASM: Add `try_clone` implementations to `Request` and `RequestBuilder` (seanmonstar#1286) Add native-tls-alpn feature (seanmonstar#1283)
This change allows users to bypass the selected DNS resolver for
specific domains. The allows, for example, to make calls to a local TLS
server by rerouting a given domain to 127.0.0.1.
The approach I've taken for the design is to wrap the resolver in an
outer service. This leads to a fair amount of boilerplate code mainly to
be able to explain the typing to the compiler. The actual business logic
is very simple for the number of lines involved.
One alternative option I considered was using an inline
tower_service
instead of a struct. This is possible at the cost of making reqwest's HttpConnector generic, because I could not find a way to state the type of this inlined struct. This was a bigger change than I wanted to make but happy to reconsider, it would reduce the boilerplate for sure.NB: this change adds a new dependency (itertools). This is simply to use one struct (itertools::Either) which would be simple to implement directly. If keeping the dependency tree short is needed this is a small change I believe.
Closes #561