You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #2413 (closed with PR in http_util) we added the ability to resolve non-zero ports that are used instead of the scheme specific conventional port (80/443).
That is great, however the existing Resolve trait, and the way it is used in http_util is not enough to leverage the usefulness of HTTPS dns records.
Proposal
Add resolve_https_endpoints(&self, name: Name) -> impl Stream<Item = Endpoint> to Resolve trait, with default implementation for backwards compatibility.
Endpoint can be a struct or trait that has getters for parts of the HTTPS records that we care about, namely: priority()target(), port(), alpn(), ech() and a to_socket_addrs() method.
Add a step in RequestBuilder::send() where we call resolve_endpoints and if we find an endpoint, we can use the to_socket_addrs() and port() to find the destination but also the alpn to decide which HTTP version to use, and ech to establish TLS connection faster (although that has more to do with Rustls).
Usecases
The obvious use case for this beyond just having access to alpn and ech, is that we get:
DNS load balancing, by expecting the implementation to return endpoints (within the same priority) in a random order every time it resolve_https_endpoints() is called.
Failover if one endpoint is not available, we can try to connect to the next endpoint and try that instead.
Next steps
Unfortunately I can't open a PR for this like the previous issue in http_util since it it involves a lot of changes and I will need some mentoring, but also approval of the general plan in case something is missing or unacceptable in it.
I tried to do my homework, and it appears that adding an extra enum member to connect::Inner might do the job, or at least be a good place to start.
seanmonstar
added
B-rfc
Blocked: Request for comments. More discussion would help move this along.
C-feature
Category: feature. This is requesting a new feature.
labels
Dec 3, 2024
I am generally interested in this, and I think it could eventually make its way to hyper-util. But it'd be good to explore the design space first, and make sure it solves enough of the use cases, to reduce breaking changes.
I'm focused on other work currently, but you're welcome to explore in your crate and see how it goes!
Overview
In #2413 (closed with PR in http_util) we added the ability to resolve non-zero ports that are used instead of the scheme specific conventional port (80/443).
That is great, however the existing Resolve trait, and the way it is used in
http_util
is not enough to leverage the usefulness of HTTPS dns records.Proposal
resolve_https_endpoints(&self, name: Name) -> impl Stream<Item = Endpoint>
toResolve
trait, with default implementation for backwards compatibility.Endpoint
can be a struct or trait that has getters for parts of the HTTPS records that we care about, namely:priority()
target()
,port()
,alpn()
,ech()
and ato_socket_addrs()
method.RequestBuilder::send()
where we callresolve_endpoints
and if we find an endpoint, we can use theto_socket_addrs()
andport()
to find the destination but also thealpn
to decide which HTTP version to use, andech
to establish TLS connection faster (although that has more to do with Rustls).Usecases
The obvious use case for this beyond just having access to
alpn
andech
, is that we get:resolve_https_endpoints()
is called.Next steps
Unfortunately I can't open a PR for this like the previous issue in
http_util
since it it involves a lot of changes and I will need some mentoring, but also approval of the general plan in case something is missing or unacceptable in it.Thanks.
Relevant:
resolve_https_endpoints()
here, and example Endpoint struct .The text was updated successfully, but these errors were encountered: