Xirsys.XTurn.PacketLog (xturn v2.0.0)

Copy Markdown View Source

Structured logging of raw STUN/TURN datagrams exchanged with clients.

What problem this solves

Protocol-level debugging (401/438 auth loops, missing attributes, transaction correlation) needs a timeline of every datagram in both directions without enabling full packet capture. Each line includes direction, peer, byte count, framing hint, and a hex dump. Lines go to Logger.debug/1 and a dedicated file via PacketLog.Writer so they can be grepped apart from general logs.

Toggle with :packet_log_enabled (default true). Write failures never crash relay traffic.

RFCs

  • RFC 8489 (STUN framing logged)
  • RFC 5766 (TURN methods and ChannelData framing logged)

Summary

Functions

Logs a raw datagram received from a client.

Logs a raw datagram (STUN/TURN reply) sent to a client.

Functions

incoming(bin, ip, port)

@spec incoming(binary(), :inet.ip_address() | nil, :inet.port_number() | nil) :: :ok

Logs a raw datagram received from a client.

outgoing(iodata, ip, port)

@spec outgoing(iodata(), :inet.ip_address() | nil, :inet.port_number() | nil) :: :ok

Logs a raw datagram (STUN/TURN reply) sent to a client.