Skip to content
CryoCryo home
Stdlibnet

net::addr

Addresses: IP addresses, the address-plus-port pair every socket constructor takes, and a URL parser.

public module net::addr::ip;
public module net::addr::socket_addr;
public module net::addr::sockaddr;
public module net::addr::url;
FileWhat it holdsImport
ipIpV4Addr, IpV6Addr, IpAddrimport std::net::addr::ip;
socket_addrSocketAddrimport std::net::addr::socket_addr;
urlUrl, UrlErrorimport std::net::addr::url;

net::addr::sockaddr holds pack_sockaddr_in and unpack_sockaddr, the hand-packed struct sockaddr bridge every socket call goes through. It is public for code that needs to speak to a raw socket API, and otherwise not something you call; it has no page.

IPv6 addressing is parsed and represented, and TCP opens an AF_INET6 socket for a v6 address. UDP is IPv4-only for now: bind, connect, and UdpSendTo reject an IpAddr::V6 up front with Unsupported.