Gates peer and refresh operations by active relay address family.
What problem this solves
A dual-stack allocation may hold both IPv4 and IPv6 relay sockets. CreatePermission and ChannelBind must reject peers whose IP version has no active relay path. Refresh with REQUESTED-ADDRESS-FAMILY must only extend lifetimes for families that still exist on the allocation.
Internal note
Called from TURN action modules during permission, channel, and refresh handling.
RFCs
Summary
Functions
Returns whether a peer address matches one of the allocation's active families.
Returns whether a REQUESTED-ADDRESS-FAMILY value is still active on the allocation.
Functions
Returns whether a peer address matches one of the allocation's active families.
Examples
iex> Xirsys.XTurn.RelayFamily.peer_allowed?({{127, 0, 0, 1}, 1234}, [4])
true
iex> Xirsys.XTurn.RelayFamily.peer_allowed?({{127, 0, 0, 1}, 1234}, [8])
false
iex> Xirsys.XTurn.RelayFamily.peer_allowed?({{127, 0, 0, 1}, 1234}, :invalid)
false
Returns whether a REQUESTED-ADDRESS-FAMILY value is still active on the allocation.
Examples
iex> alias Xirsys.XTurn.{AddressFamily, RelayFamily}
iex> RelayFamily.refresh_family_active?(AddressFamily.ipv4(), [4, 8])
true
iex> Xirsys.XTurn.RelayFamily.refresh_family_active?(Xirsys.XTurn.AddressFamily.ipv6(), [4])
false