summary refs log tree commit diff
path: root/src/libstd/net/addr.rs
AgeCommit message (Collapse)AuthorLines
2018-05-03Remove the deprecated std::net::{lookup_host,LookupHost}Josh Stone-3/+1
These are unstable, and were deprecated by #47510, since Rust 1.25. The internal `sys` implementations are still kept to support the call in the common `resolve_socket_addr`.
2018-03-24Add backticksPhlosioneer-2/+2
2018-03-20Remove StdioRaw doc additions, add backticksPhlosioneer-1/+1
2018-03-11Remove "and may change between Rust releases"Phlosioneer-3/+3
2018-03-11Document when types have OS-dependent sizesPhlosioneer-0/+9
As per issue #43601, types that can change size depending on the target operating system should say so in their documentation. I used this template when adding doc comments: The size of a(n) <name> struct may vary depending on the target operating system, and may change between Rust releases. For enums, I used "instance" instead of "struct".
2018-01-17Deprecate std::net::lookup_hostSteven Fackler-1/+4
We intended to do this quite a while ago but it snuck through.
2017-11-21Fix a typo in ToSocketAddrs documentationAlexey Orlenko-1/+1
Fix a typo in ToSocketAddrs documentation: s/ToSocketsAddr/ToSocketAddrs
2017-08-30Fix typo in doc `ToSocketAddrs` example.Corey Farwell-1/+1
2017-08-28Rewrite `std::net::ToSocketAddrs` doc examples.Corey Farwell-22/+66
in particular: * show how to create an iterator that yields multiple socket addresses * show more failing scenarios
2017-03-27Addressed requested changes for PR #40838lukaramu-18/+12
* Fixed spelling ToSocketAddr -> ToSocketAddrs in module docs (which also fixes a link) * Added missing "when" before "interacting" in module docs * Changed SocketAddr's top-level docs to explicitly state what socket addresses consist of, making them more consistent with SocketAddrV4's and SocketAddrV6's docs * Changed "in C" -> "in C's `netinet/in.h`" * Changed wording in is_ipv4/is_ipv6 methods to ", `false` otherwise" * Add missing closing ` ``` ` in Ipv6Addr's examples * Removed "Errors" section in ToSocketAddrs' to_socket_addrs method as it was rather redundant
2017-03-26Added examples to std::net::{SocketAddr, SocketAddrV4, SocketAddrV6} docslukaramu-0/+36
2017-03-26Expanded and added links to std::net::{SocketAddr,SocketAddrV4,SocketAddrV6} ↵lukaramu-25/+89
docs Part of #29363 Changed summary sentences of SocketAddr and IpAddr for consistency Linked to SocketAddrV4 and SocketAddrV6 from SocketAddr, moving explaination there Expanded top-level docs for SocketAddrV4 and SocketAddrV6, linking to some relevant IETF RFCs, and linking back to SocketAddr Changed some of the method summaries to third person as per RFC 1574; added links to IETF RFCs where appropriate
2017-03-26Removed link in std::net::ToSocketAddr's summary sentencelukaramu-3/+1
Relative links in trait methods don't resolve in e.g. std/primitive.tuple.html :(
2017-03-26Added links throughout std::net::ToSocketAddrs' documentationlukaramu-17/+35
Part of #29363 In the section about the default implementations of ToSocketAddrs, I moved the bulletpoint of SocketAddrV4 & SocketAddrV6 to the one stating that SocketAddr is constructed trivially, as this is what's actually the case
2017-01-31add From<(I, u16)> for SocketAddr where I: Into<IpAddr>Sean McArthur-0/+7
2017-01-25std: Stabilize APIs for the 1.16.0 releaseAlex Crichton-6/+2
This commit applies the stabilization/deprecations of the 1.16.0 release, as tracked by the rust-lang/rust issue tracker and the final-comment-period tag. The following APIs were stabilized: * `VecDeque::truncate` * `VecDeque::resize` * `String::insert_str` * `Duration::checked_{add,sub,div,mul}` * `str::replacen` * `SocketAddr::is_ipv{4,6}` * `IpAddr::is_ipv{4,6}` * `str::repeat` * `Vec::dedup_by` * `Vec::dedup_by_key` * `Result::unwrap_or_default` * `<*const T>::wrapping_offset` * `<*mut T>::wrapping_offset` * `CommandExt::creation_flags` (on Windows) * `File::set_permissions` * `String::split_off` The following APIs were deprecated * `EnumSet` - replaced with other ecosystem abstractions, long since unstable Closes #27788 Closes #35553 Closes #35774 Closes #36436 Closes #36949 Closes #37079 Closes #37087 Closes #37516 Closes #37827 Closes #37916 Closes #37966 Closes #38080
2017-01-13impl ToSocketAddrs for StringBrian Campbell-0/+20
`ToSocketAddrs` is implemented for a number of different types, including `(IpAddr, u16)`, `&str`, and various others, for the convenience of being able to run things like `TcpListener::bind("10.11.12.13:1415")`. However, because this is a generic parameter with a trait bound, if you have a `String` you cannot pass it in, either directly as `TcpListener::bind(string)`, or the `TcpListener::bind(&string)` as you might expect due to deref coercion; you have to use `TcpListener::bind(&*string)`, which is noisy and hard to discover (though #39029 suggests better error messages to make it more discoverable). Rather than making people stumble over this, just implement `ToSocketAddrs` for `String`.
2016-12-25Impl From<inner> for IpAddr and SocketAddr.Yamakaky-0/+14
Fixes https://github.com/rust-lang/rfcs/issues/1816.
2016-11-26Rollup merge of #37962 - GuillaumeGomez:socket-v6, r=frewsxcvSeo Sanghyeon-0/+84
Add missing examples to SocketAddrV6 r? @steveklabnik cc @frewsxcv
2016-11-23Add missing examples to SocketAddrV6Guillaume Gomez-0/+84
2016-11-21Add missing examples for SocketAddrV4Guillaume Gomez-0/+46
2016-11-19Add missing examples in SocketAddrGuillaume Gomez-1/+78
2016-10-12Auto merge of #36762 - achanda:sockaddr_type, r=alexcrichtonbors-0/+35
Add two functions to check type of SockAddr These can be used to determine the type of the underlying IP address r? @alexcrichton
2016-10-03Add two functions to check type of SockAddrAbhishek Chanda-0/+35
These can be used to determine the type of the underlying IP address
2016-09-30Ignore various entire test modules on emscriptenBrian Anderson-3/+0
2016-09-30Ignore entire test modules on emscripten instead of individual testsBrian Anderson-1/+1
2016-09-30Ignore lots and lots of std tests on emscriptenBrian Anderson-0/+3
2016-08-24Use `#[prelude_import]` in `libstd`.Jeffrey Seyfried-3/+0
2016-06-29Update documentation to reflect ignoring of unknown addressesTobias Bucher-0/+3
2016-06-29Ignore unknown address types when looking up hostsTobias Bucher-6/+1
Previously, any function using a `ToSocketAddrs` input would fail if passed a hostname that resolves to an address type different from the ones recognized by Rust. This also changes the `LookupHost` iterator to only include the known address types, as a result, it doesn't have to return `Result`s any more, which are likely misinterpreted as failed name lookups.
2016-04-11std: Stabilize APIs for the 1.9 releaseAlex Crichton-16/+32
This commit applies all stabilizations, renamings, and deprecations that the library team has decided on for the upcoming 1.9 release. All tracking issues have gone through a cycle-long "final comment period" and the specific APIs stabilized/deprecated are: Stable * `std::panic` * `std::panic::catch_unwind` (renamed from `recover`) * `std::panic::resume_unwind` (renamed from `propagate`) * `std::panic::AssertUnwindSafe` (renamed from `AssertRecoverSafe`) * `std::panic::UnwindSafe` (renamed from `RecoverSafe`) * `str::is_char_boundary` * `<*const T>::as_ref` * `<*mut T>::as_ref` * `<*mut T>::as_mut` * `AsciiExt::make_ascii_uppercase` * `AsciiExt::make_ascii_lowercase` * `char::decode_utf16` * `char::DecodeUtf16` * `char::DecodeUtf16Error` * `char::DecodeUtf16Error::unpaired_surrogate` * `BTreeSet::take` * `BTreeSet::replace` * `BTreeSet::get` * `HashSet::take` * `HashSet::replace` * `HashSet::get` * `OsString::with_capacity` * `OsString::clear` * `OsString::capacity` * `OsString::reserve` * `OsString::reserve_exact` * `OsStr::is_empty` * `OsStr::len` * `std::os::unix::thread` * `RawPthread` * `JoinHandleExt` * `JoinHandleExt::as_pthread_t` * `JoinHandleExt::into_pthread_t` * `HashSet::hasher` * `HashMap::hasher` * `CommandExt::exec` * `File::try_clone` * `SocketAddr::set_ip` * `SocketAddr::set_port` * `SocketAddrV4::set_ip` * `SocketAddrV4::set_port` * `SocketAddrV6::set_ip` * `SocketAddrV6::set_port` * `SocketAddrV6::set_flowinfo` * `SocketAddrV6::set_scope_id` * `<[T]>::copy_from_slice` * `ptr::read_volatile` * `ptr::write_volatile` * The `#[deprecated]` attribute * `OpenOptions::create_new` Deprecated * `std::raw::Slice` - use raw parts of `slice` module instead * `std::raw::Repr` - use raw parts of `slice` module instead * `str::char_range_at` - use slicing plus `chars()` plus `len_utf8` * `str::char_range_at_reverse` - use slicing plus `chars().rev()` plus `len_utf8` * `str::char_at` - use slicing plus `chars()` * `str::char_at_reverse` - use slicing plus `chars().rev()` * `str::slice_shift_char` - use `chars()` plus `Chars::as_str` * `CommandExt::session_leader` - use `before_exec` instead. Closes #27719 cc #27751 (deprecating the `Slice` bits) Closes #27754 Closes #27780 Closes #27809 Closes #27811 Closes #27830 Closes #28050 Closes #29453 Closes #29791 Closes #29935 Closes #30014 Closes #30752 Closes #31262 cc #31398 (still need to deal with `before_exec`) Closes #31405 Closes #31572 Closes #31755 Closes #31756
2016-03-23Auto merge of #32454 - eddyb:rollup, r=eddybbors-6/+6
Rollup of 11 pull requests - Successful merges: #32404, #32420, #32423, #32425, #32429, #32430, #32431, #32434, #32437, #32441, #32443 - Failed merges:
2016-03-22try! -> ?Jorge Aparicio-3/+3
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2016-03-22std: Store flowinfo/scope_id in host byte orderAlex Crichton-6/+6
Apparently these aren't supposed to be stored in network byte order, so doing so ends up causing failures when it would otherwise succeed when stored in the host byte order. Closes #32424
2016-02-25Rollup merge of #31842 - dileepbapat:master, r=alexcrichtonManish Goregaokar-3/+2
I have made changes and built it after that. Please advise, https://github.com/rust-lang/rust/issues/31820
2016-02-23#31820 - Utilize `if..let` instead of single `match` branchdileepb-3/+2
2016-02-23Register new snapshotsAaron Turon-2/+2
2016-02-11Add SocketAddrV6::set_flowinfo and set_scope_idSimon Sapin-0/+28
2016-02-11Add `SocketAddr{,V4,V6}::set_ip`.Simon Sapin-3/+52
2016-02-11Add `SocketAddr{,V4,V6}::set_port`.Simon Sapin-10/+43
As demonstrated in the `resolve_socket_addr` change, this is less awkward than re-creating a new address from the other parts.
2016-02-09Revert deprecation of IpAddr, stabilizing for 1.7Aaron Turon-12/+3
After [considerable pushback](https://github.com/rust-lang/rfcs/issues/1451), it's clear that there is a community consensus around providing `IpAddr` in the standard library, together with other APIs using it. This commit reverts from deprecated status directly to stable. The deprecation landed in 1.6, which has already been released, so the stabilization is marked for 1.7 (currently in beta; will require a backport).
2016-02-04Implement ToSocketAddrs for &[SocketAddr]Steven Fackler-0/+11
2016-01-17Fix SocketAddrV6::flowinfo docsSimon Sapin-4/+4
I don’t understand what the "flow information" of an IPv6 address is, but it looks separate from the scope ID. This was probably a copy/paste error.
2016-01-14Require stability annotations on fields of tuple variantsVadim Petrochenkov-2/+2
2015-12-29Fix warnings when compiling stdlib with --testFlorian Hahn-2/+0
2015-12-05std: Stabilize APIs for the 1.6 releaseAlex Crichton-1/+10
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 #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
2015-11-28Auto merge of #30092 - semarie:to_socket_addr_str_bad, r=alexcrichtonbors-2/+2
I don't reproduce it on severals hosts (virtual or real), so I can't debug it. As Bitrig has disabled this test too, I will follow the same here. r? @alexcrichton
2015-11-28disable net::addr::to_socket_addr_str_bad test under openbsdSébastien Marie-2/+2
I don't reproduce it on severals hosts (virtual or real), so I can't debug it. As Bitrig has disabled this test too, I will follow the same here.
2015-11-18Add missing annotations and some testsVadim Petrochenkov-0/+1
2015-11-09std: Migrate to the new libcAlex Crichton-17/+17
* Delete `sys::unix::{c, sync}` as these are now all folded into libc itself * Update all references to use `libc` as a result. * Update all references to the new flat namespace. * Moves all windows bindings into sys::c