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.
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 .