View Source ExSTUN.URI (ex_stun v0.2.0)
Module representing STUN/TURN URI.
Implementation of RFC 7064 and RFC 7065.
We could try to use URI module from Elixir but RFC 7064 and RFC 7065 state:
While these two ABNF productions are defined in [RFC3986] as components of the generic hierarchical URI, this does not imply that the "stun" and "stuns" URI schemes are hierarchical URIs. Developers MUST NOT use a generic hierarchical URI parser to parse a "stun" or "stuns" URI.
Summary
Types
@type scheme() :: :stun | :stuns | :turn | :turns
@type t() :: %ExSTUN.URI{ host: String.t(), port: :inet.port_number(), scheme: scheme(), transport: transport() | nil }
Type describing URI struct.
transport
denotes protocol that should be used
by a client to connect to the STUN/TURN server.
nil
means that the client should try to connect with every protocol it supports.
If scheme indicates secure connection, transport is always set to :tcp
.
This is based on RFC 5928, sec. 3.
@type transport() :: :udp | :tcp
Functions
Parses URI string into t/0
.
The same as parse/1 but raises on error.