-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add std::net::lookup_addr
for reverse DNS lookup
#23419
Conversation
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
☔ The latest upstream changes (presumably #23352) made this pull request unmergeable. Please resolve the merge conflicts. |
For now we may want to hold off adding this as |
I'm not sure how to amend this if |
@@ -76,6 +76,11 @@ impl Iterator for LookupHost { | |||
fn next(&mut self) -> Option<io::Result<SocketAddr>> { self.0.next() } | |||
} | |||
|
|||
/// Resolve the given address to a hostname. | |||
pub fn lookup_addr(addr: IpAddr) -> io::Result<String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should take a SocketAddr
now instead of an IpAddr
(and better yet a &SocketAddr
)
Could a test be added for this? |
Rebased after recent changes to @alexcrichton: I don't know if a test can be written for it. |
Just wondering, would it be at all possible to test this using |
@daboross: Generally, that would work, but it's possible that the |
/// This function may perform a DNS query to resolve `addr` and may also inspect | ||
/// system configuration to resolve the specified address. If the address | ||
/// cannot be resolved, it is returned in string format. | ||
#[unstable(feature = "ip_addr", reason = "recent addition")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is separable enough from the ip_addr
feature that this may want to be called lookup_addr
instead.
Ok, this looks good to me, thanks @murarth! r=me with a separate feature name for this API. |
@alexcrichton: Done. |
⌛ Testing commit c0dd239 with merge b27c254... |
💔 Test failed - auto-win-64-nopt-t |
@bors: retry On Fri, Mar 27, 2015 at 3:11 AM, bors notifications@github.com wrote:
|
Closes #22608