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

client: server DNS address resolution #18

Closed
marceline-cramer opened this issue Jan 30, 2023 · 2 comments · Fixed by #43
Closed

client: server DNS address resolution #18

marceline-cramer opened this issue Jan 30, 2023 · 2 comments · Fixed by #43
Assignees
Labels
enhancement New feature or request

Comments

@marceline-cramer
Copy link
Collaborator

marceline-cramer commented Jan 30, 2023

Add support to clients to connect to servers by their hostnames.

We'll need to replace the SocketAddr in Args with a String, then first attempt to parse it to an IP address, and if that fails, try looking up the DNS. We can use trust-dns-resolver to look up hostnames.

If parsing out the port is too complicated to do in conjunction with parsing hostnames/IPs, we can move the port into a different argument. In that case, we should adjust the server to take the port separately as well.

If parsing fails, please fail nicely with good error messages!

DNS resolution isn't necessary on servers, as far as I know, because most of the time we'll just be binding to a fixed IP.

@marceline-cramer marceline-cramer added the enhancement New feature or request label Jan 30, 2023
@airidaceae
Copy link
Collaborator

The standard library has a DNS resolver with std::net::ToSocketAddrs which resolves using the host systems resolver.

https://docs.rs/trust-dns-resolver/0.22.0/trust_dns_resolver/
"This is a 100% in process DNS resolver. It does not use the Host OS’ resolver. If what is desired is to use the Host OS’ resolver, generally in the system’s libc, then the std::net::ToSocketAddrs variant over &str should be used."

I think its probably best for us to stick with the standard library unless there is some specific reason to resolve things differently than the host system wants.

@marceline-cramer
Copy link
Collaborator Author

@airidaceae No, let's go with the standard library. I went with that crate because reqwest depends on it and it has a lot of downloads. Good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants