about summary refs log tree commit diff
path: root/src/libstd/net/addr.rs
AgeCommit message (Collapse)AuthorLines
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
2015-08-15std: Add issues to all unstable featuresAlex Crichton-2/+2
2015-04-29Improve libstd/net/addr.rs documentation.Nick Hamann-9/+9
This adds some missing punctuation and converts uses of "Gets" to "Returns". This sounds better to my ear, but more importantly is more consistent with the documentation from other files.
2015-04-15Move IP related tests to ip.rsAbhishek Chanda-258/+1
- Also move common functions to test.rs - Leaves out Socket address related tests in addr.rs
2015-04-13Fix check for globally routable IPv4 addressAbhishek Chanda-13/+16
- Adds two more functions for broadcast address and special address classes reserved for documentation - Modifies the globally routable IP check to include these new functions Fixes #24314
2015-04-10Auto merge of #24177 - alexcrichton:rustdoc, r=aturonbors-2/+1
This commit series starts out with more official test harness support for rustdoc tests, and then each commit afterwards adds a test (where appropriate). Each commit should also test and finish independently of all others (they're all pretty separable). I've uploaded a [copy of the documentation](http://people.mozilla.org/~acrichton/doc/std/) generated after all these commits were applied, and a double check on issues being closed would be greatly appreciated! I'll also browse the docs a bit and make sure nothing regressed too horribly.
2015-04-07std: Deny most warnings in doctestsAlex Crichton-2/+1
Allow a few specific ones but otherwise this helps ensure that our examples are squeaky clean! Closes #18199
2015-04-07disabling a test that is failing on bitrig.Dave Huseby-1/+2
2015-04-01std: Changing the meaning of the count to splitnAlex Crichton-1/+1
This commit is an implementation of [RFC 979][rfc] which changes the meaning of the count parameter to the `splitn` function on strings and slices. The parameter now means the number of items that are returned from the iterator, not the number of splits that are made. [rfc]: https://github.com/rust-lang/rfcs/pull/979 Closes #23911 [breaking-change]
2015-03-31Test fixes and rebase conflicts, round 3Alex Crichton-2/+5
2015-03-31std: Stabilize last bits of io::ErrorAlex Crichton-1/+1
This commit stabilizes a few remaining bits of the `io::Error` type: * The `Error::new` method is now stable. The last `detail` parameter was removed and the second `desc` parameter was generalized to `E: Into<Box<Error>>` to allow creating an I/O error from any form of error. Currently there is no form of downcasting, but this will be added in time. * An implementation of `From<&str> for Box<Error>` was added to liballoc to allow construction of errors from raw strings. * The `Error::raw_os_error` method was stabilized as-is. * Trait impls for `Clone`, `Eq`, and `PartialEq` were removed from `Error` as it is not possible to use them with trait objects. This is a breaking change due to the modification of the `new` method as well as the removal of the trait implementations for the `Error` type. [breaking-change]
2015-03-26Add `std::net::lookup_addr` for reverse DNS lookupMurarth-0/+9
Closes #22608
2015-03-25std: Add net::IpAddr, destabilize lookup_hostAlex Crichton-1/+22
This commits adds back an `IpAddr` enum matching the `SocketAddr` enum, but without a port. The enumeration is `#[unstable]`. The `lookup_host` function and iterator are also destabilized behind a new feature gate due to questions around the semantics of returning `SocketAddr` values.
2015-03-23Add #![feature] attributes to doctestsBrian Anderson-0/+1
2015-03-20don't use Result::ok just to be able to use unwrap/unwrap_orOliver Schneider-1/+1
2015-03-13std: Stabilize the `net` moduleAlex Crichton-135/+260
This commit performs a stabilization pass over the std::net module, incorporating the changes from RFC 923. Specifically, the following actions were taken: Stable functionality: * `net` (the name) * `Shutdown` * `Shutdown::{Read, Write, Both}` * `lookup_host` * `LookupHost` * `SocketAddr` * `SocketAddr::{V4, V6}` * `SocketAddr::port` * `SocketAddrV4` * `SocketAddrV4::{new, ip, port}` * `SocketAddrV6` * `SocketAddrV4::{new, ip, port, flowinfo, scope_id}` * Common trait impls for socket addr structures * `ToSocketAddrs` * `ToSocketAddrs::Iter` * `ToSocketAddrs::to_socket_addrs` * `ToSocketAddrs for {SocketAddr*, (Ipv*Addr, u16), str, (str, u16)}` * `Ipv4Addr` * `Ipv4Addr::{new, octets, to_ipv6_compatible, to_ipv6_mapped}` * `Ipv6Addr` * `Ipv6Addr::{new, segments, to_ipv4}` * `TcpStream` * `TcpStream::connect` * `TcpStream::{peer_addr, local_addr, shutdown, try_clone}` * `{Read,Write} for {TcpStream, &TcpStream}` * `TcpListener` * `TcpListener::bind` * `TcpListener::{local_addr, try_clone, accept, incoming}` * `Incoming` * `UdpSocket` * `UdpSocket::bind` * `UdpSocket::{recv_from, send_to, local_addr, try_clone}` Unstable functionality: * Extra methods on `Ipv{4,6}Addr` for various methods of inspecting the address and determining qualities of it. * Extra methods on `TcpStream` to configure various protocol options. * Extra methods on `UdpSocket` to configure various protocol options. Deprecated functionality: * The `socket_addr` method has been renamed to `local_addr` This commit is a breaking change due to the restructuring of the `SocketAddr` type as well as the renaming of the `socket_addr` method. Migration should be fairly straightforward, however, after accounting for the new level of abstraction in `SocketAddr` (protocol distinction at the socket address level, not the IP address). [breaking-change]
2015-03-06Test fixes and rebase conflictsAlex Crichton-0/+1
2015-03-06rollup merge of #23097: alexcrichton/issue-23076Alex Crichton-1/+6
The `rsplitn` call was called with 2 instead of 1 so the iterator would yield 3 items in some cases, not the 2 that it should have. Closes #23076
2015-03-05std: Fix peeling ports from addressesAlex Crichton-1/+6
The `rsplitn` call was called with 2 instead of 1 so the iterator would yield 3 items in some cases, not the 2 that it should have. Closes #23076
2015-03-05Remove integer suffixes where the types in compiled code are identical.Eduard Burtescu-3/+3