Import std.net.address
std.net.address
std.net's addresses: IpAddress, an IPv4 or IPv6 address, read from and written as its text, with what kind of address it is, and SocketAddress, one with a port, which sockets connect to and listen on.
std/net/address.fb
Types
IpFamily
enum
Public Enum IpFamily
Which version of IP an address is.
-
IPv4, with 4-byte addresses.
-
IPv6, with 16-byte addresses.
IpAddress
struct
Public Struct IpAddress Implements Hashable, Comparable, Printable
An IPv4 or IPv6 address. Addresses compare by family, IPv4 first, then as their bytes do.
-
Whether it's an IPv4 address or an IPv6 one.
-
The IPv4 address a.b.c.d.
-
Public Static Method V6(a: UInt16, b: UInt16, c: UInt16, d: UInt16, e: UInt16, f: UInt16, g: UInt16, h: UInt16): IpAddressstatic method #The IPv6 address of eight 16-bit groups,
a:b:c:d:e:f:g:h. -
The address of
bytes, 4 for IPv4, or 16 for IPv6, in the order Bytes gives them. Panics for another count. -
The address
textwrites: IPv4's four decimal numbers from 0 to 255 with dots between, with no leading zeros, or IPv6's eight groups of up to four hex digits, in either case, with colons between, where one :: can stand for groups of zeros and the last two can be IPv4's, as RFC 4291 has them. Null for anything else, a zone like "%eth0" too. -
127.0.0.1, ::1, 0.0.0.0, ::, and 255.255.255.255.
-
::1, IPv6's loopback address.
-
0.0.0.0, IPv4's address of every interface, to listen on.
-
::, IPv6's address of every interface, to listen on.
-
255.255.255.255, IPv4's broadcast address.
-
Whether it's an IPv4 address.
-
Whether it's an IPv6 address.
-
Its 4 bytes, or 16, the most significant first.
-
127.0.0.0/8, or ::1.
-
0.0.0.0, or ::, which a socket listens on to take every address.
-
A private network's: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16, as RFC 1918 has them, or IPv6's unique local fc00::/7, RFC 4193's.
-
A link's own, not routed: 169.254.0.0/16, or fe80::/10.
-
224.0.0.0/4, or ff00::/8.
-
255.255.255.255.
-
For examples, as RFC 5737, RFC 3849, and RFC 9637 set them aside: 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24, 2001:db8::/32, and 3fff::/20.
-
The IPv4 address an IPv4-mapped IPv6 one stands for, ::ffff:a.b.c.d, the IPv4 one itself, or Null for another IPv6 one.
-
An IPv4 address as the IPv6 one that maps it, ::ffff:a.b.c.d, or the IPv6 one itself.
-
IPv4's dotted text, or IPv6's as RFC 5952 writes it: lowercase, without leading zeros, with :: for the longest run of two zero groups or more, the first of equal ones, and an IPv4-mapped address's last two groups as IPv4's text.
-
Whether
acomes beforeb.Doc from
std.core.interfaces.Comparable.Operator<.
SocketAddress
struct
Public Struct SocketAddress Implements Hashable, Comparable, Printable
An IpAddress with a port: where a socket connects to or listens on. An IPv6 one can have a scope, its zone's index, for a link-local address, as in [fe80::1%3]:80.
-
Its address.
-
Its port.
-
An IPv6 link-local address's scope, its zone's index, or 0 for none.
-
Panics for a ScopeId on an IPv4
address, which has none. -
The address
textwrites as ToString does: an IPv4 address and its port, as in 127.0.0.1:80, or an IPv6 one in brackets, with its scope's number after a %, as in [::1]:80 and [fe80::1%3]:80. Null for anything else, a scope's name like %eth0 too. -
Its address's family.
-
Its text, as a string interpolation like "{value}" shows it.
Doc from
std.core.interfaces.Printable.ToString. -
Whether
acomes beforeb.Doc from
std.core.interfaces.Comparable.Operator<.
Report an issue with this page or with FutureBlitz on GitHub.