Structure
IPv6Address
public struct IPv6Address
A 128-bit numerical identifier assigned to a device on an Internet Protocol, version 6 network.
Relationships
Conforms To
Codable
Equatable
Hashable
LosslessStringConvertible
Nested Type Aliases
Octets
public typealias Octets = (
UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8,
UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8
)
Pieces
public typealias Pieces = (UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16)
Initializers
init(octets:)
@inlinable
public init(octets: Octets = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
Creates an address with the given octets.
init(pieces:_:)
@inlinable
public init(pieces: Pieces, _ octetArrangement: OctetArrangement)
Creates an address from the given 16-bit integer pieces.
Parameters
Name | Type | Description |
---|---|---|
pieces | Pieces |
The integer pieces of the address. |
octetArrangement | OctetArrangement |
How the octets in each integer of
|
init(from:)
public init(from decoder: Decoder) throws
init?(_:)
@inlinable @inline(__always)
public init?<S>(_ description: S) where S: StringProtocol
Parses an IPv6 address from a String.
Accepted formats are documented in Section 2.2 ("Text Representation of Addresses") of IP Version 6 Addressing Architecture (RFC 4291).
Parameters
Name | Type | Description |
---|---|---|
description | S |
The string to parse. |
init?(utf8:)
@inlinable @inline(__always)
public init?<UTF8Bytes>(utf8: UTF8Bytes) where UTF8Bytes: Collection, UTF8Bytes.Element == UInt8
Parses an IPv6 address from a collection of UTF-8 code-units.
Accepted formats are documented in Section 2.2 ("Text Representation of Addresses") of IP Version 6 Addressing Architecture (RFC 4291).
Parameters
Name | Type | Description |
---|---|---|
utf8 | UTF8Bytes |
The string to parse, as a collection of UTF-8 code-units. |
Properties
octets
public var octets: Octets
The octets of this address.
description
@inlinable
public var description: String
serialized
public var serialized: String
The canonical textual representation of this address, as defined by RFC 5952.
Methods
hash(into:)
@inlinable
public func hash(into hasher: inout Hasher)
encode(to:)
public func encode(to encoder: Encoder) throws
Operators
==
@inlinable
public static func == (lhs: Self, rhs: Self) -> Bool