MsgHdrandMsgHdrMutare marked as transparent meaning both have the same layout asmsghdron Unix andWSAMSGon Windows (rust-lang#635).- Don't set
SO_NOSIGPIPEwhen accepting sockets, this is inherited from the parent socket (rust-lang#632). - Fixes
Socket::tcp_notsent_lowatby using the correct argument type (rust-lang#622).
- Added support for Windows Registered I/O (RIO) (rust-lang#604).
- Added support for
TCP_NOTSENT_LOWATon Linux viaSocket::(set_)tcp_notsent_lowat(rust-lang#611). - Added support for
SO_BUSY_POLLon Linux viaSocket::set_busy_poll(rust-lang#607). SockFilter::newis now a const function (rust-lang#609).
- Updated the windows-sys dependency to version 0.60 (rust-lang#605).
All IPv4 methods now have a _v4 suffix, IPv6 uses _v6. TCP methods have a
tcp_ prefix (looked better than a suffix).
Furthermore we removed all types from external libraries (i.e. libc or windows-sys) from the public API, allowing us to update those without breaking the API.
- Renamed
Socket::freebind_ipv6tofreebind_v6(rust-lang#592). - Renamed
Socket::freebindtofreebind_v4(rust-lang#592). - Renamed
Socket::original_dsttooriginal_dst_v4(rust-lang#592). - Renamed
Socket::original_dst_ipv6tooriginal_dst_v6(rust-lang#592). - Bump MSRV to 1.70 (rust-lang#597).
- Use
c_intfromstd::ffiinstead of from libc (rust-lang#599, rust-lang#595). SockAddr's methods now accept/returnSockAddrStorageinstead ofsockaddr_storage/SOCKADDR_STORAGE(rust-lang#576):newtry_initas_ptras_storage
- Add
SockFilter, wrapper aroundlibc::sock_filter, argument toSocket::attach_filter(rust-lang#581). - Various renames of TCP methods on
Socket(rust-lang#592):keepalive_time->tcp_keepalive_timekeepalive_interval->tcp_keepalive_intervalkeepalive_retries->tcp_keepalive_retriesnodelay->tcp_nodelayset_nodelay->set_tcp_nodelaytcp_mss->msstcp_set_mss->set_msstcp_cork->corktcp_set_cork->set_corktcp_quickack->quickacktcp_set_quickack->set_quickackthin_linear_timeouts->tcp_thin_linear_timeouts.
- Added
Socket::(set_)priority(rust-lang#588). - Added TCP retries on Windows (rust-lang#557).
- Added
SockAddrStorage, wrapper aroundsockaddr_storage/SOCKADDR_STORAGEfor usage withSockAddr(instead of the types from libc/windows-sys) (rust-lang#576). - Implemented
Socket::bind_device_by_index_{v4,v6}on Android and Linux (rust-lang#572). - Implemented
CopyandCloneforInterfaceIndexOrAddress(rust-lang#571). - Updated to Windows-sys v0.59 (rust-lang#579).
- We now use
OwnedFd/OwnedSocketinternally forSocket(rust-lang#600).
- Add cygwin support (rust-lang#568, rust-lang#578).
- Enable
IP_BOUND_IFon illumos and Solaris (rust-lang#561, rust-lang#566).
- Added
Socket::(set_)header_included_v4andSocket::(set_)header_included_v6(rust-lang#518). - Added support for
Socket::original_dstandSocket::original_dst_ipv6on Windows (rust-lang#529).
- Added
Socket::(set_)passcred(rust-lang#506). - Added
RecvFlags::is_confirmandRecvFlags::is_dontroute(rust-lang#499). - Added
MsgHdrMut::control_len(rust-lang#505).
- Added
Socket::(set_)multicast_all_v{4,6}(rust-lang#485 and rust-lang#486). - Added support for GNU/Hurd (rust-lang#474).
- Fixes compilation on Haiku (rust-lang#479 and rust-lang#482).
- Fixes compilation on OpenHarmony (rust-lang#491).
- Update to window-sys v0.52 (rust-lang#480).
- Added support for Vita (rust-lang#465).
- Deprecated
Socket::(bind_)device_by_index, replaced bySocket::(bind_)device_by_index_v4for IPv4 sockets (rust-lang#432). - Added
Socket::(bind_)device_by_index_v6(rust-lang#432). - Added experimental support for the ESP-IDF framework (rust-lang#452)
- Added
Socket::{send,recv}msgandMsgHdr(Mut)types, wrappingsendmsg(2)andrecvmsg(2)(rust-lang#447). - Added
Socket::(set_)reuse_port_lbto retrieve or setSO_REUSEPORT_LBon FreeBSD (rust-lang#442). - Added
Protocol::DIVERTon FreeBSD and OpenBSD (rust-lang#448). - Added
Socket::protocolfor Windows (usingWSAPROTOCOL_INFOW) (rust-lang#470). From<SocketAddrV{4,6}>forSockAddrnows setsss_lenon platforms that have the fields (most BSDs) (rust-lang#469).- Change Windows to use
ADDRESS_FAMILYforsa_family_t, this shouldn't affect anything in practice (rust-lang#463).
- Added support for two new Android targets
armv7-linux-androideabiandi686-linux-android(rust-lang#434). - Added
Socket::cookieto retrieveSO_COOKIEon Linux (rust-lang#437).
- Added Unix socket methods to
SockAddr(rust-lang#403 and rust-lang#429). - Added
SockAddr::as_storage(rust-lang#417). - Added
SockAddr::set_length(rust-lang#428). - Added
Protocol::UDPLITE(rust-lang#427). - Update windows-sys to 0.48 (rust-lang#422).
- Fixes Fuchsia target after it changes in 1.68, see https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1680-2023-03-09 (rust-lang#423).
- Fixes musl target and adds it to the CI (rust-lang#426).
Type::cloexecfor Redox and Solaris (rust-lang#398).- Generate documentation for more targets on docs.rs (rust-lang#398).
- Generatation of documentation on docs.rs (rust-lang#398).
- BREAKING
SockAddr::initis renamed totry_initto indicate it can fail (rust-lang#328). - BREAKING Remove the returned
ResultfromSockAddr::vsock, it can't fail (rust-lang#328). - BREAKING
From<S>is now implemented using the I/O traitsAsFdandAsRawSocket(rust-lang#325): - BREAKING renamed
SockAddr::vsock_addrSockAddr::as_vsock_addrto match the IPv4 and IPv6 methods (rust-lang#334). - Redox now works on a stable compiler (rust-lang#326).
- Remove copy from
From<SocketAddrV{4,6}>implementation forSockAddr(rust-lang#335). - Marked function as constant where possible.
- Updated to Rust edition 2021 (rust-lang#393).
- Links to OS documentation to a lot of methods (rust-lang#319).
- I/O-safety traits (rust-lang#325):
AsFdforSocket(Unix only).From<OwnedFd>forSocket(Unix only).From<Socket>forOwnedFd(Unix only).AsSocketforSocket(Windows only).From<OwnedSocket>forSocket(Windows only).From<Socket>forOwnedSocket(Windows only).
- Unix socket support on Windows (rust-lang#249).
SockAddr::is_ipv{4,6}andSockAddr::domain(rust-lang#334).Socket::nonblocking(rust-lang#348).Socket::original_dst(_ipv6)(rust-lang#360).Socket::(set_)recv_tclass_v6andSocket::(set_)tclass_v6(rust-lang#364).Socket::(set_)tcp_congestion(rust-lang#371).- Support for various DCCP socket options in the form of
(rust-lang#359):
Socket::(set_)dccp_serviceSocket::dccp_available_ccidsSocket::dccp_qpolicy_txqlenSocket::dccp_recv_cscovSocket::dccp_send_cscovSocket::dccp_server_timewaitSocket::dccp_server_timewaitSocket::dccp_tx_ccidSocket::dccp_xx_ccidSocket::set_dccp_ccidSocket::set_dccp_qpolicy_txqlenSocket::set_dccp_recv_cscovSocket::set_dccp_send_cscovSocket::set_dccp_server_timewaitSocket::dccp_cur_mps
Socket::peek_send(rust-lang#389).Protocol::MPTCP(rust-lang#349).Protocol::SCTP(rust-lang#356).Protocol::DCCP(rust-lang#359).Type::DCCP(rust-lang#359).- Implement
EqandHashforSockAddr(rust-lang#374). - Support for QNX Neutrino (rust-lang#380).
- Support for AIX (rust-lang#351).
- Fixed compilation with the
allon QNX Neutrino (rust-lang#419). - Added support for ESP-IDF (rust-lang#455).
- Added support for Vita (rust-lang#475).
- Fixed compilation on Windows (rust-lang#409).
This release was broken for Windows.
- Added
Socket::peek_sender(backport) (rust-lang#404).
- Fixes compilation on OpenBSD (rust-lang#344).
- Fixes compilation on DragonFlyBSD (rust-lang#342).
- Reverted back to the
winapidependency as switch towindows-syswas a breaking change (rust-lang#340). Note that we'll will switch towindows-sysin v0.5 . - Disable RECVTOS on OpenBSD (rust-lang#307).
- Derive Clone for SockAddr (rust-lang#311).
- Fixes cfg attributes for Fuchsia (rust-lang#314).
- Replace
winapidependency withwindows-sys(rust-lang#303).
Socket::join_ssm_v4andSocket::leave_ssm_v4(rust-lang#298).Socket::set_recv_tosandSocket::recv_tos(rust-lang#299).
- OpenBSD build (rust-lang#291).
- Libc v0.2.114 fixed an issue where
ip_mreqnwhere was not defined for Linux s390x.
Socket::set_fib: setsSO_SETFIB(rust-lang#271).Socket::attach_filter,SO_ATTACH_FILTER(https://github.com/rust-lang/socket2/commit/6601ed132b37d6e9d178b34918bfb0b236800232).Socket::detach_filter,SO_DETACH_FILTER(https://github.com/rust-lang/socket2/commit/6601ed132b37d6e9d178b34918bfb0b236800232).Socket::{header_included, set_header_included}: sets or getsIP_HDRINCL(https://github.com/rust-lang/socket2/commit/f9e882ee53c0b4e89c5043b6d709af95c9db5599).Socket::{cork, set_cork}: sets or getsTCP_CORK(https://github.com/rust-lang/socket2/commit/50f31f18aac8fd6ef277df2906adeeed9fa391de).Socket::{quickack, set_quickack}: sets or getsTCP_QUICKACK(https://github.com/rust-lang/socket2/commit/849eee2abc5d5170d2d3bc635386a2ba13b04530).Socket::{thin_linear_timeouts, set_thin_linear_timeouts}: sets or getsTCP_THIN_LINEAR_TIMEOUTS(https://github.com/rust-lang/socket2/commit/24c231ca463a17f51e53e7a554c7915a95bdbcc7).Socket::{join_multicast_v4_n, leave_multicast_v4_n}: extends the existing multicast API by allowing an index to be used (in addition to an address) (https://github.com/rust-lang/socket2/commit/750f83618b967c620bbfdf6ca04de7362bdb42b5).
Socket::(set_)freebind_ipv6, getter and setter forIPV6_FREEBIND.
- Compilation on OpenBSD.
- Usage of incorrect flag in
Socket::(set_)freebind.
- Added
SockAddr::new - Support for
TCP_USER_TIMEOUT. - Support for
IP_BOUND_IF. - Support for
IP_TRANSPARENT. - Enable
Socket::typeon all platforms. - Support for uclibc (for Haiku support).
- Added DragonFly support for TCP keepalive (
KEEPINTVL/KEEPCNT). - Documentation for proper use of
SockRef::from, and the improper use. - Assertion in
SockRef::fromto ensure the raw socket valid.
- Compilation on Haiku.
- Setting TCP keepalive on Haiku and OpenBSD (by not setting it as it's not supported).
- Size check for abstract namespaces in
SockAddr::unix. - Set noinherit on accepted sockets on Windows when opening sockets.
- New
allfeature: enables API that is not available on all tier 1 platforms. SockReftype: used to create a reference to an existing socket, e.g.std::net::TcpStream, making all methods ofSocketavailable on it.- Support for vectored I/O:
Socket::recv_vectored,Socket::recv_with_flags.Socket::recv_from_vectored,Socket::recv_from_vectored_with_flags.Socket::send_vectored,Socket::send_vectored_with_flags.Socket::send_to_vectored,Socket::send_to_vectored_with_flags.- In the
ReadandWriteimplementations.
Socket::new_raw,Socket::pair_rawandSocket::accept_rawmethods that don't set common flags, such as the close-on-exec flag.Socket::accept4:accept4(2)system call.Socket::sendfile: thesendfile(2)system call.Socket::set_cloexec: set the close-on-exec flag on Unix.Socket::set_no_inherit: set inherit handle flag on Windows.Socket::set_nosigpipe: setSO_NOSIGPIPEon Apple targets.Socket::set_markandSocket::mark, setting/getting theSO_MARKsocket option.Socket::set_cpu_affinityandSocket::cpu_affinity, setting/getting theSO_INCOMING_CPUsocket option.Socket::set_mssandSocket::mss, setting/getting theTCP_MAXSEGsocket option.Socket::set_freebindandSocket::freebind, setting/getting theIP_FREEBINDsocket option.Socket::bind_deviceandSocket::device, setting/getting theSO_BINDTODEVICEsocket option.- Adopted Mio's TCP keepalive API:
Socket::keepalive_time,Socket::keepalive_interval,Socket::keepalive_retries,Socket::set_tcp_keepalive.
Socket::is_listenergetting theSO_ACCEPTCONNsocket option.Socket::domaingetting theSO_DOMAINsocket option.Socket::protocolgetting theSO_PROTOCOLsocket option.Socket::typegetting theSO_TYPEsocket option.Domain::for_address: the correctDomainfor astd::net::SocketAddr.Type::nonblocking: setSOCK_NONBLOCK.Type::cloexec: setSOCK_CLOEXEC.Type::no_inherit: setHANDLE_FLAG_INHERIT.SockAddr::init: initialises aSockAddr.MaybeUninitSlicetype: a version ofIoSliceMutthat allows the buffer to be uninitialised, used inSocket::recv_vectoredand related functions.RecvFlagstype: provides additional information about incoming messages, returned bySocket::recv_vectoredand related functions.TcpKeepalivetype: configuration type for a socket's TCP keepalive parameters.
- Repository moved to https://github.com/rust-lang/socket2.
- BREAKING: Changed constructor functions into constants:
Domain::ipv4=>Domain::IPV4.Domain::ipv6=>Domain::IPV4.Domain::unix=>Domain::UNIX.Domain::packet=>Domain::PACKET.Type::stream=>Type::STREAM.Type::dgram=>Type::DGRAM.Type::seqpacket=>Type::SEQPACKET.Type::raw=>Type::RAW.Protocol::icmpv4=>Protocol::ICMPV4.Protocol::icmpv6=>Protocol::ICMPV6.Protocol::tcp=>Protocol::TCP.Protocol::udp=>Protocol::UDP.
- BREAKING: Changed the signature of
Socket::recv,Socket::recv_vectoredand related methods to accept uninitialised buffers. TheReadimplementation can be used to read into initialised buffers. - BREAKING: Renamed
SockAddr::as_stdtoas_socket. - BREAKING: Renamed
SockAddr::as_inettoas_socket_ipv4. - BREAKING: Renamed
SockAddr::as_inet6toas_socket_ipv6. - BREAKING: Replace all previously existing features (reuseport, pair, unix) with a new all features (see above for description of the all feature).
- Use
accept4(2)withSOCK_CLOEXECinSocket::accept, reducing the amount of system calls required. - Marked many functions as constant.
- The
Readimplementation now callsrecv(2)rather thanread(2). - Split the
implblock for theSockettype to create groupings for setting and getting different level socket options usingsetsockopt(2)/getsockopt(2). - Updated
winapidepdency to version 0.3.9 and dropped unused features.
- Removed the
-rssuffix from the repository name. - BREAKING: Removed
SockAddr::from_raw_parts, useSockAddr::initinstead. - BREAKING: Removed
Socket::into_*functions and replaced them with aFromimplementation:Socket::into_tcp_stream=>TcpStream::from(socket).Socket::into_tcp_listener=>TcpListener::from(socket).Socket::into_udp_socket=>UdpSocket::from(socket).Socket::into_unix_stream=>UnixStream::from(socket).Socket::into_unix_listener=>UnixListener::from(socket).Socket::into_unix_datagram=>UnixDatagram::from(socket).
- Removed
cfg-ifdependency. - Remove
redox_syscalldepdency.
- Fixes the Andoid, Fuchsia, Haiku, iOS, illumos, NetBSD and Redox (nightly only) targets.
- Correctly call
recv_frominSocket::recv_from_with_flags(calledrecvpreviously). - Correctly call
send_toinSocket::send_to_with_flags(calledrecvpreviously). - Use correct inmutable references in
Socket::send_with_flagsandSocket::send_out_of_band. - Use
IPPROTO_IPV6inSocket::join_multicast_v6on Windows. - Use
c_intinstead ofi32where appropriate.
- Fixes the Fuchsia target.
Socket::devicenow returns aVec<u8>rather thanCString.Socket::bind_devicenow accepts a&[u8]rather than&CStr.
Socket::connect_timeoutwas added back.
- Changed
Socket::set_cpu_affinityandSocket::cpu_affinityto use an immutable reference.
- Use
SO_LINGER_SECon macOS forSocket::get/set_linger.
- Don't assume the memory layout of
std::net::SocketAddr. - Other changes omited