-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Tracking issue for DNS in std::net #27705
Comments
I’d like to I think a guiding principle in some other parts of I think the return value of |
@SimonSapin proposes stabilization for this cycle. |
The libs team discussed this during triage yesterday and the conclusion was to not move this into FCP just yet. I personally have a number of concerns about the API exposed here in that I think it's insufficient for exporting all the functionality we want and it's also insufficient for giving back all the information that we get. I would be interested in seeing this developed externally on crates.io and then perhaps move it into the standard library. For now the libstd support won't be deprecated until a replacement externally exists, but I may work on such a replacement in the near future if no one else gets around to it! |
+1 to everything @SimonSapin said. DNS is a mapping of names to IP addresses, not IP addresses+ports, so |
Should |
What is the decision on |
Whoops, missed @SimonSapin's comment. cc @rust-lang/libs -- the question is, given that we have stabilized |
Given that we haven't stabilized |
I’m suggesting to remove |
Regardless of the state of |
As we’ve discussed before, this can’t really happen since |
Fine, "I believe our feelings where that |
|
I wanted to use lookup_host in something I was writing, so I went to the effort of pulling out all the relevant code, and making it use the libc crate (so it works on stable) - https://crates.io/crates/dns-lookup. It requires a bit of work to improve it though (documentation, testing, refactoring). It's still using SocketAddrs, but since IpAddr has been un-deprecated, the first change should probably be using IpAddr instead. |
I feel that the death of As a result, I've created the |
I'm using it, so we're at least two. Well, at least I was, until it was removed. Sure, Also, when it comes to DNS, I really want to use the system/libc functions, not a pure Rust solution (because of caching, NSS, system settings ...). |
There hasn't been a lot of clear communication from the libs team on these APIs; sorry about that. The TL;DR is that no one is comfortable stabilizing these APIs as-is, and we prefer when possible to prototype and gain experience with this kind of thing outside of Luckily, for networking in particular, we already have a crate for this exact purpose: net2. It's a kind of staging ground for networking API experiments that are ultimately on track for |
That sounds good to me. I'm already using |
Note that |
@nodakai I don't understand the emphasis on list. That said, |
Apologies if this is the wrong place... recently I tried to get github.com/kevinburke/dnstimeout up and running again and ran into
If I am reading correctly, there is no current way to fix this issue (do DNS lookups) using Rust stable? Without using glibc or friends.. |
@kevinburke You can use the use std::net::ToSocketAddrs;
use std::io;
fn resolve(host: &str) -> io::Result<Vec<IpAddr>> {
(s, 0).to_socket_addrs().map(|iter| iter.map(|socket_address| socket_address.ip()).collect())
} … but this API does not support timeouts. |
|
The story here is pretty clearly settled: you can use the @rfcbot fcp close |
Team member @aturon has proposed to close this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
I see two possible justifications for settling for this: one disappointing-but-reasonable, one surely wrong. I'd like to check which (if either) we have in mind when closing this. The 'disappointing-but-reasonable' position is: well, that's where we are. It's true that the The 'surely wrong' position is: this is actually where we'd want to be, and all is well with the world. The current I suspect that the first position is what is being proposed, in which case fair enough. But if it's the second, please leave a note so that I can come back and say why I think that's surely wrong and should be revisited! |
Neither of those options are the justification: The There is a place for a more robust and featureful DNS API in the standard library, but no one has cared about it enough to actually do any of that design or implementation work. |
Isn't that saying exactly that the story is not yet settled? I mean that's also a reasonable position, but it seems to argue for keeping this issue open rather than for closing it. |
The story of the specific functions for which this is a tracking issue is proposed to be settled. Feature requests tend to live on the rfcs repo. |
I find the terminology here confusing. A lot of programmers need host name lookup, and they need to resolve host names according to the system configuration, which usually includes more than just DNS, and can end up performing exotics such as LDAP or NIS lookups. These kinds of lookups are limited in the types of data they can process (basically, just names, addresses, and, to some degree, host aliases). DNS, in contrast, offers a much wider range of record types, and a DNS API is required to get anything out of DNS which does not involve address information. But some names users expect to resolve on a system will not be resolvable through DNS, so a DNS API is not a replacement for something that ends up calling |
So, if I may so so, the communication has not been entirely clear. But I think that the reasoning for closing this one is some combination of the 'disappointing-but-reasonable' position - essentially, that we are where we are and can't do much about that - and that: as a matter of policy, proposals to make things better no longer belong in this repository but instead should these days be tracked by RFCs. Right? Seems OK to me. (Though it's a bit annoying: I'm already watching this issue, and instead I am now expected to watch future and as yet non-existent proposals somewhere else...) @fweimer I can't tell whether you're in favour of closing this issue, or doing something else, or what. Care to expand? |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
Alright now that we've signed off, I'm going to close as per the review above. |
Er actually, forgot that we still need to mark the apis deprecated.. |
|
The intention was to get rid of all of it, so I think we'd just deprecate that as well. |
That’s fine, it just looks like one function slipped through the cracks. I meant re-open so we don’t forget it. |
Fixed in #47510. |
Can someone, please, explain why there is no a function that can resolve a host? It looks like I have to allocate a new string, if I have host and want to append port? What if I do not want to allocate?
Am I missing something, or the idea is to:
What I am missing? Are there alternatives? |
A 6-years old closed issue is not a great place for new discussion as it’s unlikely to get the attention it needs. That said, for all of its flaws, today’s use std::net::ToSocketAddrs;
let addresses: Vec<_> = ("rust-lang.org", 443).to_socket_addrs()?.collect();
dbg!(addresses); This and other impls are documented at https://doc.rust-lang.org/std/net/trait.ToSocketAddrs.html |
This is a tracking issue for the
lookup_addr
andlookup_host
unstable features in the standard library. These are currently the only exposed support for DNS as a public interface. Functions likeTcpStream::connect
already expose the ability to resolve names via passing a string, but this cannot be done programmatically currently.There are a number of thorny issues to deal with here:
getaddrinfo
andgetnameinfo
here appropriate?getaddrinfo
case, should IP addresses or socket addresses be returned?getnameinfo
case, should IP addresses or socket addresses be taken?DirEntry
)The text was updated successfully, but these errors were encountered: