-
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 IpAddr #27801
Comments
Nominating for discussion for 1.6. If it isn't consumed or produced by any libstd APIs, I'd vote for its removal. |
It's certainly a useful thing to have:
I expect there are others. Perhaps it would be feasible to search It would surely be better if there were a single canonical implementation of |
I think It is common, in my experience, for a userspace program to accept a hostname, resolve the hostname to either an IPv4 or IPv6 address and pass that address to one of the aforementioned I also think that it doesn't particularly make sense to have DNS facilities in |
🔔 This issue is now entering its cycle-long final comment period 🔔 The libs team is a little up in the air about whether to stabilize or deprecate this type, so some thoughts would be welcome! On a personal opinion side of things, I'm a little wary to stabilize this as there's no corresponding type in C (as opposed to a |
I think I agree with @murarth that Also, I wonder if including |
Figured I'd chime in and mention that libpnet uses |
I'd like to mirror @mrmonday 's sentiment about keeping IpAddr around. There are times when you need to represent an ip address without the port. |
+1 on stabilizing this type. Many times we (as network programmers) don't care if it's an IPv4 or v6 address. In Postgres, there's an Inet type that holds either format. This would be helpful for rust-postgres crate, too. |
rust-postgres would need a bit more than just |
@sfackler, are you implying that IpvXAddr types should add netmask bits to better represent IP addresses? It's a good point that an IP address is more valuable when you know the netmask. |
Uh, no I am not saying we should add a netmask field to this type. |
I feel like this enum should either be beefed up and used elsewhere in std, or deprecated. I don't care much which route we take. |
The libs team discussed this during triage today and the conclusion was to deprecate. This type can be added back to the standard library if need be and otherwise without many concrete users in-tree itself this sort of type seems suitable for an external crate or definition locally. |
FWIW: I considered using this in rust-url but went with a custom enum instead for hosts since I need another variant anyway, for DNS domain names. |
This commit is the standard API stabilization commit for the 1.6 release cycle. The list of issues and APIs below have all been through their cycle-long FCP and the libs team decisions are listed below Stabilized APIs * `Read::read_exact` * `ErrorKind::UnexpectedEof` (renamed from `UnexpectedEOF`) * libcore -- this was a bit of a nuanced stabilization, the crate itself is now marked as `#[stable]` and the methods appearing via traits for primitives like `char` and `str` are now also marked as stable. Note that the extension traits themeselves are marked as unstable as they're imported via the prelude. The `try!` macro was also moved from the standard library into libcore to have the same interface. Otherwise the functions all have copied stability from the standard library now. * The `#![no_std]` attribute * `fs::DirBuilder` * `fs::DirBuilder::new` * `fs::DirBuilder::recursive` * `fs::DirBuilder::create` * `os::unix::fs::DirBuilderExt` * `os::unix::fs::DirBuilderExt::mode` * `vec::Drain` * `vec::Vec::drain` * `string::Drain` * `string::String::drain` * `vec_deque::Drain` * `vec_deque::VecDeque::drain` * `collections::hash_map::Drain` * `collections::hash_map::HashMap::drain` * `collections::hash_set::Drain` * `collections::hash_set::HashSet::drain` * `collections::binary_heap::Drain` * `collections::binary_heap::BinaryHeap::drain` * `Vec::extend_from_slice` (renamed from `push_all`) * `Mutex::get_mut` * `Mutex::into_inner` * `RwLock::get_mut` * `RwLock::into_inner` * `Iterator::min_by_key` (renamed from `min_by`) * `Iterator::max_by_key` (renamed from `max_by`) Deprecated APIs * `ErrorKind::UnexpectedEOF` (renamed to `UnexpectedEof`) * `OsString::from_bytes` * `OsStr::to_cstring` * `OsStr::to_bytes` * `fs::walk_dir` and `fs::WalkDir` * `path::Components::peek` * `slice::bytes::MutableByteVector` * `slice::bytes::copy_memory` * `Vec::push_all` (renamed to `extend_from_slice`) * `Duration::span` * `IpAddr` * `SocketAddr::ip` * `Read::tee` * `io::Tee` * `Write::broadcast` * `io::Broadcast` * `Iterator::min_by` (renamed to `min_by_key`) * `Iterator::max_by` (renamed to `max_by_key`) * `net::lookup_addr` New APIs (still unstable) * `<[T]>::sort_by_key` (added to mirror `min_by_key`) Closes rust-lang#27585 Closes rust-lang#27704 Closes rust-lang#27707 Closes rust-lang#27710 Closes rust-lang#27711 Closes rust-lang#27727 Closes rust-lang#27740 Closes rust-lang#27744 Closes rust-lang#27799 Closes rust-lang#27801 cc rust-lang#27801 (doesn't close as `Chars` is still unstable) Closes rust-lang#28968
This commit is the standard API stabilization commit for the 1.6 release cycle. The list of issues and APIs below have all been through their cycle-long FCP and the libs team decisions are listed below Stabilized APIs * `Read::read_exact` * `ErrorKind::UnexpectedEof` (renamed from `UnexpectedEOF`) * libcore -- this was a bit of a nuanced stabilization, the crate itself is now marked as `#[stable]` and the methods appearing via traits for primitives like `char` and `str` are now also marked as stable. Note that the extension traits themeselves are marked as unstable as they're imported via the prelude. The `try!` macro was also moved from the standard library into libcore to have the same interface. Otherwise the functions all have copied stability from the standard library now. * `fs::DirBuilder` * `fs::DirBuilder::new` * `fs::DirBuilder::recursive` * `fs::DirBuilder::create` * `os::unix::fs::DirBuilderExt` * `os::unix::fs::DirBuilderExt::mode` * `vec::Drain` * `vec::Vec::drain` * `string::Drain` * `string::String::drain` * `vec_deque::Drain` * `vec_deque::VecDeque::drain` * `collections::hash_map::Drain` * `collections::hash_map::HashMap::drain` * `collections::hash_set::Drain` * `collections::hash_set::HashSet::drain` * `collections::binary_heap::Drain` * `collections::binary_heap::BinaryHeap::drain` * `Vec::extend_from_slice` (renamed from `push_all`) * `Mutex::get_mut` * `Mutex::into_inner` * `RwLock::get_mut` * `RwLock::into_inner` * `Iterator::min_by_key` (renamed from `min_by`) * `Iterator::max_by_key` (renamed from `max_by`) Deprecated APIs * `ErrorKind::UnexpectedEOF` (renamed to `UnexpectedEof`) * `OsString::from_bytes` * `OsStr::to_cstring` * `OsStr::to_bytes` * `fs::walk_dir` and `fs::WalkDir` * `path::Components::peek` * `slice::bytes::MutableByteVector` * `slice::bytes::copy_memory` * `Vec::push_all` (renamed to `extend_from_slice`) * `Duration::span` * `IpAddr` * `SocketAddr::ip` * `Read::tee` * `io::Tee` * `Write::broadcast` * `io::Broadcast` * `Iterator::min_by` (renamed to `min_by_key`) * `Iterator::max_by` (renamed to `max_by_key`) * `net::lookup_addr` New APIs (still unstable) * `<[T]>::sort_by_key` (added to mirror `min_by_key`) Closes #27585 Closes #27704 Closes #27707 Closes #27710 Closes #27711 Closes #27727 Closes #27740 Closes #27744 Closes #27799 Closes #27801 cc #27801 (doesn't close as `Chars` is still unstable) Closes #28968
Even though this is closed and done, it's a shame you guys removed |
I reimplemented it myself in libpnet[1] - based on all the references to this issue, so has everyone else! It's a shame none of these networking libraries are going to be able to work together now, without deconstructing/reconstructing the IpAddr. |
Thanks @mrmonday. That was the answer I expected but hoped for something better. And I agree with your second comment. If people use a feature in a code base, why isn't that "pulling it's own weight"? |
@johnzachary To rephrase that, do you believe that the standard library should include every feature that someone at some point has used in a code base? |
I released my re-implementation as its own tiny crate. Feel free to use. |
@sfackler No, but I do think it's a bit weird that the IpAddr enum was removed but both std::net::Ipv4Addr and std::net::Ipv6Addr were kept. IpAddr was a nice way to represent those in a single binding. Why not keep what (I think) is a logical relationship between those two structs? |
Ipv6Addr and Ipv4Addr were used in SocketAddrV6 and SocketAddrV4 respectively, which were in turn parts of SocketAddr, which is a fundamental component of the TcpStream and UdpSocket APIs. IpAddr was neither produced nor consumed by anything in the standard library. |
Well, |
If DNS lookup functions are overhauled to return |
We implemented our own version of
@sfackler No and this isn't that case. This is a case of many people finding a feature in the standard library useful and voicing their disapproval when it was removed. I understand it was marked |
The libs team took up this issue again at our meeting this week, and have agreed that deprecation was the wrong call. There's a clear community consensus to ship this, and the rationale for deprecation essentially boiled down to a concern about minimalism in I've opened a PR to revert, which actually stabilizes the enum as of 1.7 (currently in beta). That will require a backport. |
Awesome. Thank you! |
This is a tracking issue for the unstable
ip_addr
feature of the standard library. Some thoughts:The text was updated successfully, but these errors were encountered: