Skip to content
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

Using HTTPS records (RFC 9460) #2479

Open
Nuhvi opened this issue Nov 15, 2024 · 2 comments
Open

Using HTTPS records (RFC 9460) #2479

Nuhvi opened this issue Nov 15, 2024 · 2 comments
Labels
B-rfc Blocked: Request for comments. More discussion would help move this along. C-feature Category: feature. This is requesting a new feature.

Comments

@Nuhvi
Copy link
Contributor

Nuhvi commented Nov 15, 2024

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

  • 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:

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

Thanks.

Relevant:

@Nuhvi
Copy link
Contributor Author

Nuhvi commented Dec 3, 2024

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 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
@seanmonstar
Copy link
Owner

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-rfc Blocked: Request for comments. More discussion would help move this along. C-feature Category: feature. This is requesting a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants