Outbound send handle for data and STUN replies to the TURN client.
What problem this solves
Allocations and the data plane must send ChannelData, indications, and STUN responses back to the client over UDP, TCP, DTLS, or TLS. This struct bundles the transport module, underlying socket, and default client endpoint so send paths do not duplicate transport-specific logic.
Internal note
Created per message in workers and stored on allocations; not operator-facing.
RFCs
- RFC 5766 (client-facing relay traffic)
Summary
Functions
Builds a %ClientSocket{} from an XSockets.Conn and transport module.
Builds a client send handle from transport module, socket, and client endpoint.
Sends data to the client.
Types
@type t() :: %Xirsys.XTurn.ClientSocket{ client_ip: :inet.ip_address() | nil, client_port: pos_integer() | nil, socket: term(), transport: module() }
Client-facing send handle.
Fields
:transport-XSockets.Transport.*module for send/4:socket- OS port, library conn socket, PID test stub, or:fake:client_ip- default destination IP (may be nil for connected TCP):client_port- default destination port
Functions
@spec from_library_conn(XSockets.Conn.t(), module()) :: t()
Builds a %ClientSocket{} from an XSockets.Conn and transport module.
@spec new(module(), term(), :inet.ip_address() | nil, pos_integer() | nil) :: t()
Builds a client send handle from transport module, socket, and client endpoint.
@spec send(t(), iodata(), :inet.ip_address() | nil, :inet.port_number() | nil) :: :ok | {:error, term()}
Sends data to the client.
Uses dest_ip/dest_port when provided, otherwise the stored client endpoint.
PID and :fake sockets are handled for tests and worker relay paths.