ones
Returns the all-ones address, ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
.
static var ones: `Self` { get }
Returns the all-ones address, ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
.
static var ones: `Self` { get }
import IP
This Foundation-free module provides tools for parsing and formatting IP addresses, and data structures for performing efficient IP address lookups.
@frozen struct V6
An IPv6 address, which is 128 bits wide.
@frozen enum IP
The namespace for IP types.
init?(_ string: some StringProtocol)
Parses an IPv6 address from a string in colon-hexadecimal notation. This parser accepts both full and collapsed forms.
init(_ a: UInt16, _ b: UInt16, _ c: UInt16, _ d: UInt16, _ e: UInt16, _ f: UInt16, _ g: UInt16, _ h: UInt16)
Initializes an IPv6 address from 16-bit components, each in platform byte order.
init(storage: (UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16))
Initializes an IPv6 address from a tuple of 16-bit words, with elements in big-endian byte order.
init(storage: (UInt32, UInt32, UInt32, UInt32))
Initializes an IPv6 address from a tuple of 32-bit words, with elements in big-endian byte order.
init(storage: UInt128)
Creates an IPv6 address by wrapping a raw big-endian integer.
init(v4: IP.V4)
Maps an IPv4 address to an IPv6 address in the ::ffff:0:0/96
range.
static var localhost: `Self` { get }
Returns the loopback address, ::1
. There is only one loopback address in IPv6.
static var zero: `Self` { get }
Returns the all-zeros address, ::
.
static func copy(from bytes: some RandomAccessCollection<UInt8>) -> `Self`?
Initializes an IPv6 address from a buffer of 16 bytes, using the first byte as the high bits of the first hextet, returning nil if the buffer is not 16 bytes long.
var description: String { get }
Formats the address as a string in colon-hexadecimal notation. This formatter does not collapse zeros.
var endIndex: Int { get }
Always 8, the number of 16-bit words in an IPv6 address.
var startIndex: Int { get }
Always 0.
var storage: UInt128
The raw 128-bit address, in big-endian byte order. The byte at the lowest address appears in the high bits of the first hextet.
var v4: IP.V4? { get }
Returns the IPv4 address mapped to this IPv6 address, if the address is in the ::ffff:0:0/96
range.
subscript(i: Int) -> UInt16 { get set }
Returns the ith word of the address, in platform byte order.