Xirsys.XTurn.Allocate.Quota (xturn v2.0.0)

Copy Markdown View Source

Per-username concurrent allocation limit.

What problem this solves

Service operators often cap how many live relay allocations one username may hold. This ETS-backed counter enforces :allocation_quota from application env, returning STUN error 486 when the limit is reached.

RFCs

  • RFC 5766 (allocation error 486 Allocation Quota Reached)

Summary

Functions

Returns :ok or {:error, 486} when the username is at the configured quota.

Decrements the live allocation count for username. Returns :ok.

Increments the live allocation count for username. Returns :ok.

Creates the public allocation-quota ETS table if it does not exist.

Functions

check(username)

Returns :ok or {:error, 486} when the username is at the configured quota.

decrement(username)

Decrements the live allocation count for username. Returns :ok.

increment(username)

Increments the live allocation count for username. Returns :ok.

init()

@spec init() :: :ok

Creates the public allocation-quota ETS table if it does not exist.