Stable {transport, socket} lookup per bound {ip, port} endpoint.
What problem this solves
With SO_REUSEPORT, multiple UDP listener processes bind the same port. RFC 5780 CHANGE-REQUEST replies must come from a predictable socket on the alternate address or port. The first shard to bind registers in this ETS table; later shards forward traffic but are not chosen as 5780 reply sources.
Internal note
Populated at listener startup by DatagramListener; not configured directly.
RFCs
- RFC 5780 (alternate source for Binding replies)
Summary
Functions
Creates the public ETS table if it does not exist.
Looks up {transport, socket} for endpoint, or :error if unset.
Records the first {transport, socket} bound to endpoint.
Removes the registry entry for endpoint.
Functions
@spec ensure!() :: :ok
Creates the public ETS table if it does not exist.
@spec lookup({:inet.ip_address(), :inet.port_number()}) :: {:ok, {module(), term()}} | :error
Looks up {transport, socket} for endpoint, or :error if unset.
@spec register({:inet.ip_address(), :inet.port_number()}, {module(), term()}) :: :ok
Records the first {transport, socket} bound to endpoint.
Uses :ets.insert_new/2 so only the first registrant wins (RFC 5780 stable source).
@spec unregister({:inet.ip_address(), :inet.port_number()}) :: :ok
Removes the registry entry for endpoint.