Five-tuple identity for a TURN allocation on this server.
What problem this solves
Refresh, ChannelBind, and CreatePermission must locate the existing allocation
for a client without requiring the original Allocate transaction id. The
five-tuple (client IP/port, server IP/port, requested transport) keys ETS
lookups in Allocate.Store.
Internal note
:proto may be :_ to wildcard transport on refresh-style lookups.
RFCs
Summary
Functions
Builds a 5-tuple for the current connection. proto is either the requested
transport binary from an Allocate request, or :_ - an ETS match wildcard used
by Refresh/ChannelBind/CreatePermission, which look up an existing allocation by
client/server IP:port only, regardless of the protocol it was originally
allocated with (see Xirsys.XTurn.Allocate.Store.lookup/1).
Converts a %Tuple5{} into an ETS-friendly keyword list (ca, cp, sa, sp, proto).
Types
@type t() :: %Xirsys.XTurn.Tuple5{ client_address: :inet.ip_address() | nil, client_port: pos_integer() | nil, protocol: binary() | :udp | :tcp | :_, server_address: :inet.ip_address() | nil, server_port: pos_integer() | nil }
Five-tuple allocation identity (t).
Fields
:client_address,:client_port,:server_address,:server_port,:protocol
Functions
Builds a 5-tuple for the current connection. proto is either the requested
transport binary from an Allocate request, or :_ - an ETS match wildcard used
by Refresh/ChannelBind/CreatePermission, which look up an existing allocation by
client/server IP:port only, regardless of the protocol it was originally
allocated with (see Xirsys.XTurn.Allocate.Store.lookup/1).
Converts a %Tuple5{} into an ETS-friendly keyword list (ca, cp, sa, sp, proto).
Examples
iex> alias Xirsys.XTurn.Tuple5
iex> t = %Tuple5{
...> client_address: {1, 2, 3, 4},
...> client_port: 1,
...> server_address: {5, 6, 7, 8},
...> server_port: 2,
...> protocol: :udp
...> }
iex> Tuple5.to_map(t)
[ca: {1, 2, 3, 4}, cp: 1, sa: {5, 6, 7, 8}, sp: 2, proto: :udp]