webrtc_ice_uri (webrtc v0.1.0)

View Source

STUN and TURN server URIs (RFC 7064, RFC 7065) and the W3C RTCIceServer list that carries them.

stunURI = scheme ":" host [ ":" port ], scheme "stun" / "stuns"; turnURI = scheme ":" host [ ":" port ] [ "?transport=" transport ], scheme "turn" / "turns", transport "udp" / "tcp" / transport-ext. Host and port follow RFC 3986: an IPv4 address, an IPv6 address in brackets, or a registered name (percent-encoding decoded).

A parsed URI is #{scheme, host, port, transport, explicit_port}: host is an IP tuple or a name (string), port the given one or the default (3478, 5349 for stuns and turns), transportudp, tcp or tls. A turn URI without transport uses UDP, a turns URI TLS over TCP, as browsers do (RFC 5928's NAPTR step is not done).

Summary

Functions

Parse one URI.

The W3C RTCIceServer list: urls (one URI or a list), username and credential (required for TURN), and as an extension tls_options (ssl client options for turns URIs). Every URI must parse; URIs whose scheme or transport is not supported are returned apart, to be reported.

Types

server/0

-type server() :: #{uri := uri(), url := binary(), username => binary(), credential => binary()}.

uri/0

-type uri() ::
          #{scheme := stun | stuns | turn | turns,
            host := inet:ip_address() | string(),
            port := inet:port_number(),
            explicit_port := boolean(),
            transport := udp | tcp | tls}.

Functions

parse(Uri)

-spec parse(binary() | string()) -> {ok, uri()} | {error, term()}.

Parse one URI.

servers(List)

-spec servers([map()]) -> {ok, [server()], [{binary(), term()}]} | {error, term()}.

The W3C RTCIceServer list: urls (one URI or a list), username and credential (required for TURN), and as an extension tls_options (ssl client options for turns URIs). Every URI must parse; URIs whose scheme or transport is not supported are returned apart, to be reported.