struct

Swim::Endpoint

Inherits Struct < Value < Object

A UDP peer address. The value is 20 bytes and compares without a heap allocation.

Constructors

from_v4(fields : StaticArray(UInt8, 4), port : UInt16) : Endpoint
Source
from_v6(fields : StaticArray(UInt16, 8), port : UInt16) : Endpoint
Source
new(family : UInt8, port : UInt16, octets : StaticArray(UInt8, 16))
Source
parse(text : String) : Endpoint

Parses host:port or [ipv6]:port.

Source
zero

An empty address. A packet uses this when it has no target.

Source

Instance methods

==(other : Endpoint) : Bool
Source
family
Source
host

Host text for UDPSocket#bind. This allocates one string.

Source
mix

FNV-1a mix for the membership table. The method does not allocate.

Source
octets

Address bytes. IPv4 uses the first 4 bytes. IPv6 uses all 16 bytes.

Source
port
Source
to_ip

Builds a socket address on the stack. No string is allocated.

Source
to_s(io : IO) : Nil

Same as #inspect(io).

Source
with_port(port : UInt16) : Endpoint
Source