Xirsys.XTurn.Plugin.Dispatch (xturn v2.0.0)

Copy Markdown View Source

Runs the per-allocation plugin chain on relay ingress and egress.

What problem this solves

Relay traffic must optionally pass through configured plugins before reaching peers or clients. When plugins are disabled, payloads pass through unchanged. Active plugins transform or drop frames inline; passive plugins receive copies via message send with bounded inflight back-pressure and latency budgets.

Internal: called from the data plane on every relay frame. Fail-open vs fail-closed behaviour is per-plugin via the :fail framework option.

RFCs

  • RFC 5766 (TURN Send/Data and ChannelData relay path)
  • RFC 8656 (updated TURN relay semantics)

Summary

Functions

Runs egress plugins for an allocation before relaying to a peer.

Runs ingress plugins for an allocation before delivering to the client.

Functions

egress(tuple5, payload, framing, peer_address, channel_number)

@spec egress(term(), binary(), atom(), {term(), term()}, integer() | nil) ::
  {:ok, binary()} | :drop

Runs egress plugins for an allocation before relaying to a peer.

Returns {:ok, payload} with the (possibly transformed) payload, or :drop when an active plugin or fail-closed policy rejects the frame.

ingress(tuple5, payload, framing, peer_address)

@spec ingress(term(), binary(), atom(), {term(), term()}) :: {:ok, binary()} | :drop

Runs ingress plugins for an allocation before delivering to the client.

Returns {:ok, payload} with the (possibly transformed) payload, or :drop when an active plugin or fail-closed policy rejects the frame.