In-process state for one Allocate.Client GenServer.
What problem this solves
Each TURN allocation is a GenServer that must track the client socket, relay ports, permissions, channels, credentials, and lifetime deadline in one place. This struct is that process state.
Internal
Not exposed to operators; mutated only inside the allocation process.
RFCs
Summary
Types
@type t() :: %Xirsys.XTurn.Allocate.Client.State{ bytes_in: non_neg_integer(), bytes_out: non_neg_integer(), channels: map() | nil, client_socket: Xirsys.XTurn.ClientSocket.t() | nil, connections: map(), deadline_ms: integer() | nil, dont_fragment: boolean(), id: term(), last_responses: map(), lifetime: pos_integer(), next_port: boolean(), nonce: binary() | nil, ns: term(), passhash: binary() | nil, peer_connections: map(), peer_ended: term(), peer_id: term(), peer_started: term(), peer_to_channel: map(), permissions: map() | nil, recv_meta: map(), refresh_time: integer() | nil, relayed_address: {:inet.ip_address(), :inet.port_number()} | nil, relayed_socket: port() | nil, relays: map(), requested_transport: :udp | :tcp, reserve_port: boolean(), tcp_family: integer() | nil, tcp_listen: port() | nil, tuple5: Xirsys.XTurn.Tuple5.t() | nil, username: binary() | nil }
Allocation GenServer state.
Fields
:id- allocation transaction id /Storekey:client_socket-%ClientSocket{}for replies and indications to the client:tuple5- client/server five-tuple identifying this allocation:relayed_address- primary XOR-RELAYED-ADDRESS{ip, port}(legacy single relay):relayed_socket- primary relay UDP port (legacy):relays- mapfamily => %{socket, address, port}for multi-family relays:tcp_listen- RFC 6062 inbound TCP listen socket:tcp_family- address family integer for the TCP listen socket:connections- map of pending/active RFC 6062 outbound connections by connection id:peer_connections- map of peer{ip, port}to connection id:requested_transport-:udpor:tcpfrom Allocate REQUESTED-TRANSPORT:dont_fragment- when true, set IP DF on cross-family UDP relay sends:recv_meta- platform recv metadata (e.g. IP_PKTINFO) for relay sends:reserve_port- EVEN-PORT reservation requested at allocate:next_port- RESERVATION-TOKEN follow-up allocate flag:username,:passhash,:nonce- long-term credentials bound to this allocation:refresh_time- allocation start as Gregorian seconds (legacy reporting):lifetime- current lifetime in seconds:deadline_ms- monotonic expiry deadline fromTiming.deadline_ms/1:permissions-TimedEntrymap of peer IP to permission timer:channels-TimedEntrymap of channel number to%Channel{}:peer_to_channel- map{ip, port}to bound channel number:bytes_in,:bytes_out- relay byte totals (merged fromAllocate.Bytes):peer_started,:peer_ended- billing/session timestamps:peer_id,:ns- external metadata namespace and peer id:last_responses- cached success attrs for idempotent STUN retransmits