webrtc_ice_resolve (webrtc v0.1.0)
View SourceResolve STUN and TURN servers given by URI (webrtc_ice_uri) to the addresses the ICE agent uses.
RFC 5928 §3 for TURN and RFC 8489 §8.1 for STUN: an IP address is used as is; a name with a port is looked up for A and AAAA records; a name without a port first for SRV records (_turn._udp, _turn._tcp, _turns._tcp, _stun._udp), whose targets are taken in priority order, then for A and AAAA records with the default port when there are none. Each URI gives, per family, every address found, SRV targets in order: the first is the server, the others are tried in turn when it does not answer (RFC 8489 §8.1, RFC 5928 §3). Candidates are gathered per family (RFC 8445 §5.1.1.2).
Names are resolved in parallel within timeout (ms, default 2000). resolver replaces the lookups: fun(srv | inet | inet6, Name) returning {ok, [{Priority, Weight, Port, Target}]} for srv and {ok, [IP]} otherwise, or {error, Reason}.
Summary
Types
-type address() :: {inet:ip_address(), inet:port_number()}.