Xirsys.Sockets.Spec (xturn_sockets v2.2.1)

View Source

Normalizes {module, opts} or a bare module into {module, opts}.

Used by Pipeline when a tier names an accumulator.

Internal API. Host applications declare accumulators in tier/2; they do not call this module directly.

What problem this solves

Pipeline tiers accept either MyAccumulator or {MyAccumulator, opts} in source. One resolver keeps compile-time and runtime paths consistent.

RFCs

No STUN/TURN RFC; framing/dispatch infrastructure for XTurn listeners.

Summary

Functions

Returns {module, opts}, using [] when only a module is given.

Types

spec()

@type spec() :: module() | {module(), keyword()}

Functions

resolve(mod)

@spec resolve(spec()) :: {module(), keyword()}

Returns {module, opts}, using [] when only a module is given.

Parameters

  • spec - SomeModule or {SomeModule, keyword()}

    iex> Xirsys.Sockets.Spec.resolve(Xirsys.Sockets.Accumulator.Raw) {Xirsys.Sockets.Accumulator.Raw, []}

    iex> Xirsys.Sockets.Spec.resolve({Xirsys.Sockets.Accumulator.Raw, header_size: 2}) {Xirsys.Sockets.Accumulator.Raw, [header_size: 2]}