[Stacked] Handle DNS preresolution at the raw client level #204
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.
The first step of #199. A new
ResolvedAddr
extension can be added to request extensions. If set, it will cause the raw client to connect to the specified IP instead of DNS-resolving the URI's host. This isn't currently set anywhere, but will be used in a follow-up PR.The Hyper client's APIs don't expose extensions to the socket connection logic, so we need to smuggle the resolved address in by encoding it in the URI's host. This is done by prepending to the host. For example, if the host is
foobar.com
, it will be encoded as.foobar.com
if there is no preresolved address, and127-0-0-1.foobar.com
if the preresolved address is127.0.0.1
. We then manually set theHost
header so Hyper doesn't try to set it to our mangled hostname, and define a custom DNS resolver and TLS server name resolver which propagate the appropriate information.