rtciv0.5.0

rtci-ice

Sans-I/O ICE agent (RFC 8445) with trickle ICE, ICE-TCP and consent freshness, for WebRTC. 25 public modules, 107 items at 0.5.0.

README

An ICE agent for WebRTC: candidates, their priorities and pairing, connectivity checks over STUN, nomination, consent freshness and ICE restarts, with trickle ICE and ICE over TCP.

Specifications

  • RFC 8445, Interactive Connectivity Establishment
  • RFC 8838, Trickle ICE
  • RFC 6544, TCP candidates with ICE
  • RFC 7675, STUN usage for consent freshness
  • RFC 8421, multihomed and dual-stack ICE
  • RFC 8489, STUN, as ICE uses it
  • draft-ietf-mmusic-mdns-ice-candidates, mDNS names for host candidates
  • RFC 8839, the ICE candidate attribute grammar

Clause-by-clause status, with the test that proves each clause: rfc8445, rfc8838, rfc6544, rfc7675, rfc8421, draft-ietf-mmusic-mdns-ice-candidates.

Use

The root crate (rtci) runs an Agent per transport. Used on its own, agent::Agent takes local and remote candidates (candidate), inbound STUN datagrams and time, and gives the checks to send, the state changes and the selected pair.

Sans-I/O

The agent never gathers by itself: the application binds the sockets and tells it which local candidates exist (the root crate's stream interface gathers TCP candidates for it). The crate does no I/O and reads no clock: every call that depends on time takes an Instant from the caller.

Licence

Licensed under either of the MIT licence or the Apache License, Version 2.0, at your option.

This crate is part of the rtci workspace, which descends from webrtc-rs/rtc and is developed independently; FORK.md lists what it carries over upstream. Upstream's licence and copyright notices are retained.

rtci_ice

ICE for the Sans-I/O WebRTC stack.

  • modagentThe Sans-I/O ICE agent.
  • modattributesThe ICE-specific STUN attributes carried in connectivity checks.
  • modcandidateCandidate types, priorities, and SDP a=candidate parsing.
  • modmdnsmDNS candidate handling, which hides private addresses behind .local names.
  • modnetwork_typeUDP/TCP over IPv4/IPv6, as a candidate's transport.
  • modrandRandom ICE credentials and identifiers.
  • modstateConnection and gathering states.
  • modstatsPer-candidate and per-pair counters, surfaced through getStats.
  • modtcp_typeActive, passive and simultaneous-open, for ICE-TCP candidates.
  • modurlParsing stun:/turn: server URLs.
  • useAddressDirectionfrom agent::remote_policy::AddressDirectionWhich way an address is used, as an IceAddressPolicy is asked about it.
  • useAddressPurposefrom agent::remote_policy::AddressPurposeWhy an IceAddressPolicy is asked about an address: the point where the address enters the ICE agent or the peer connection. Each purpose has one direction (AddressPurpose::direction).
  • useAgentfrom agent::AgentRepresents the ICE agent.
  • useAgentConfigfrom agent::agent_config::AgentConfigCollects the arguments to ice::Agent construction into a single structure, for future-proofness of the interface.
  • useCandidatePairStatsfrom agent::agent_stats::CandidatePairStatsContains ICE candidate pair statistics.
  • useCandidateStatsfrom agent::agent_stats::CandidateStatsContains ICE candidate statistics related to the ICETransport objects.
  • useConsentResponseWaitfrom agent::agent_config::ConsentResponseWaitHow long a consent request (RFC 7675) waits for its response: how long its transaction is in progress, so that a matching, authenticated success response still renews consent (RFC 8489 Section 6.3: a response is processed when "the transaction ID matches a transaction that is still in progress"). A consent request is sent once; a response to an earlier one than the latest counts as well (RFC …
  • useCredentialsfrom agent::CredentialsThe ICE credentials for one side of a session, exchanged in SDP.
  • usecrypto
  • useDataPathfrom agent::DataPathThe pair data arrived on. See Agent::data_path.
  • useEventfrom agent::EventWhat the agent reports to its caller.
  • useFailedNominationfrom agent::agent_config::FailedNominationWhat an agent does when a nomination fails (RFC 8445 Section 7.2.5.2): the controlling agent's check with USE-CANDIDATE on a valid pair, or the controlled agent's check that a received USE-CANDIDATE triggered (Section 7.3.1.5). The check fails when its transaction times out (Rc requests, the last given Rm times the RTO, Section 14.3 and RFC 8489 Section 6.2.1: 39.5 seconds at an RTO of 500 …
  • useIceAddressPolicyfrom agent::remote_policy::IceAddressPolicyAn embedder's address policy for ICE: one predicate asked at every point where an address enters the ICE agent or the peer connection's stream, TURN and server-reflexive code, whichever way traffic would go.
  • useNominationAcceptancefrom agent::agent_config::NominationAcceptanceWhich nomination a controlled agent uses when the controlling agent makes more than one.
  • usePacingGroupfrom agent::agent_config::PacingGroupA pacing budget several agents share (RFC 8445 Section 14.2: "all agents together send no more than one transaction per 5 ms" — the "global" Ta of an implementation that runs several agents). Give the same Arc to every agent (through AgentConfig::pacing_group or the peer connection's SettingEngineBuilder::with_ice_pacing_group): each starts a connectivity check only when none of them has …
  • useTransportErrorfrom agent::agent_selector::TransportErrorWhat a transport reports about the path of a connectivity check. See Agent::handle_transport_error.
  • useUnauthenticatedRequestsfrom agent::agent_config::UnauthenticatedRequestsWhat the agent does with a Binding request that fails the short-term credential check.

rtci_ice::agent

The Sans-I/O ICE agent.

  • modagent_configConfiguration for a new Agent: servers, timeouts and role.
  • modagent_selectorPair selection and nomination — which candidate pair becomes the selected one.
  • modagent_statsSnapshot statistics for an agent's candidates and pairs.
  • modremote_policyWhere connectivity checks may be sent: the remote-address policy.
  • structAgentRepresents the ICE agent.
  • structCredentialsThe ICE credentials for one side of a session, exchanged in SDP.
  • structMediaPathThe addresses and transport data is sent on and accepted from. See Agent::media_path.
  • structTaggedEventAn Event together with the instant its condition was observed at.
  • enumDataPathThe pair data arrived on. See Agent::data_path.
  • enumEventWhat the agent reports to its caller.
  • constDEFAULT_SOFTWAREThe SOFTWARE attribute the agent sends unless configured otherwise (AgentConfig::software).

rtci_ice::agent::agent_config

Configuration for a new Agent: servers, timeouts and role.

  • structAgentConfigCollects the arguments to ice::Agent construction into a single structure, for future-proofness of the interface.
  • structPacingGroupA pacing budget several agents share (RFC 8445 Section 14.2: "all agents together send no more than one transaction per 5 ms" — the "global" Ta of an implementation that runs several agents). Give the same Arc to every agent (through AgentConfig::pacing_group or the peer connection's SettingEngineBuilder::with_ice_pacing_group): each starts a connectivity check only when none of them has …
  • enumConsentResponseWaitHow long a consent request (RFC 7675) waits for its response: how long its transaction is in progress, so that a matching, authenticated success response still renews consent (RFC 8489 Section 6.3: a response is processed when "the transaction ID matches a transaction that is still in progress"). A consent request is sent once; a response to an earlier one than the latest counts as well (RFC …
  • enumFailedNominationWhat an agent does when a nomination fails (RFC 8445 Section 7.2.5.2): the controlling agent's check with USE-CANDIDATE on a valid pair, or the controlled agent's check that a received USE-CANDIDATE triggered (Section 7.3.1.5). The check fails when its transaction times out (Rc requests, the last given Rm times the RTO, Section 14.3 and RFC 8489 Section 6.2.1: 39.5 seconds at an RTO of 500 …
  • enumNominationAcceptanceWhich nomination a controlled agent uses when the controlling agent makes more than one.
  • enumUnauthenticatedRequestsWhat the agent does with a Binding request that fails the short-term credential check.
  • constMAX_UNAUTHENTICATED_RESPONSE_BURSTThe error responses to unauthenticated requests the agent may send in a burst.
  • constUNAUTHENTICATED_RESPONSE_INTERVALHow often the agent may send one more error response to an unauthenticated request.

rtci_ice::agent::agent_selector

Pair selection and nomination — which candidate pair becomes the selected one.

  • enumChecklistStateThe state of the checklist (RFC 8445 Section 6.1.2.1). With one checklist it is also the state of the ICE session (Section 6.1.3).
  • enumTransportErrorWhat a transport reports about the path of a connectivity check. See Agent::handle_transport_error.

rtci_ice::agent::agent_stats

Snapshot statistics for an agent's candidates and pairs.

rtci_ice::agent::remote_policy

Where connectivity checks may be sent: the remote-address policy.

  • structIceAddressPolicyAn embedder's address policy for ICE: one predicate asked at every point where an address enters the ICE agent or the peer connection's stream, TURN and server-reflexive code, whichever way traffic would go.
  • enumAddressDirectionWhich way an address is used, as an IceAddressPolicy is asked about it.
  • enumAddressPurposeWhy an IceAddressPolicy is asked about an address: the point where the address enters the ICE agent or the peer connection. Each purpose has one direction (AddressPurpose::direction).
  • typeAddressPolicyFnThe predicate of an IceAddressPolicy: true lets the address be used.
  • typeRemoteAddressFilterDecides whether connectivity checks may be sent to a remote candidate's address.

rtci_ice::attributes

The ICE-specific STUN attributes carried in connectivity checks.

  • modcontrolICE-CONTROLLING and ICE-CONTROLLED, which resolve role conflicts.
  • modnominationlibwebrtc's NOMINATION attribute, by which a controlling agent renominates.
  • modpriorityThe PRIORITY attribute carried in connectivity checks.
  • moduse_candidateThe USE-CANDIDATE flag, by which the controlling agent nominates a pair.

rtci_ice::attributes::control

ICE-CONTROLLING and ICE-CONTROLLED, which resolve role conflicts.

  • structAttrControlHelper that wraps ICE-{CONTROLLED,CONTROLLING}.
  • structAttrControlledRepresents ICE-CONTROLLED attribute.
  • structAttrControllingRepresents ICE-CONTROLLING attribute.
  • structTieBreakerCommon helper for ICE-{CONTROLLED,CONTROLLING} and represents the so-called Tiebreaker number.
  • enumRoleRepresents ICE agent role, which can be controlling or controlled. Possible ICE agent roles.

rtci_ice::attributes::nomination

libwebrtc's NOMINATION attribute, by which a controlling agent renominates.

  • structNominationAttrThe NOMINATION attribute: the renomination value of a connectivity check.
  • fnnomination_ofThe nomination a Binding request carries: the NOMINATION value when there is one, else 1 for USE-CANDIDATE, else 0 (no nomination).
  • constATTR_NOMINATIONThe NOMINATION attribute type, from libwebrtc's comprehension-optional range.

rtci_ice::attributes::priority

The PRIORITY attribute carried in connectivity checks.

rtci_ice::attributes::use_candidate

The USE-CANDIDATE flag, by which the controlling agent nominates a pair.

rtci_ice::candidate

Candidate types, priorities, and SDP a=candidate parsing.

  • modcandidate_hostHost candidates: an address on a local interface.
  • modcandidate_pairA local/remote candidate pair and its check state.
  • modcandidate_peer_reflexivePeer-reflexive candidates, learned from an inbound check's source address.
  • modcandidate_relayRelay candidates, allocated on a TURN server.
  • modcandidate_server_reflexiveServer-reflexive candidates, learned from a STUN Binding response.
  • structCandidateOne ICE candidate: a transport address this agent can be reached at, or can reach a peer at, together with its type, priority and liveness bookkeeping.
  • structCandidateConfigThe fields common to every candidate type, used when constructing one.
  • structCandidateRelatedAddressConvey transport addresses related to the candidate, useful for diagnostics and other purposes.
  • enumCandidateTypeRepresents the type of candidate CandidateType enum.
  • fnis_teredoWhether ip is a Teredo address, 2001::/32 (RFC 4380 Section 2.6): an address of a UDP tunnel (RFC 6544 Section 5.4).
  • fnrank_local_candidatesRanks a set of local candidates gathered together, as RFC 8421 Section 4 recommends for a dual-stack host: within each type, the IPv6 candidates get a head start of Hi = (N_4 + N_6) / N_4 places ("If a host has two IPv4 addresses and six IPv6 addresses, it will insert an IPv4 address after four IPv6 addresses"), then the two families alternate, so that both get checks early. Candidates that …
  • fnunmarshal_candidateCreates a Candidate from its string representation.
  • constUDP_TUNNELLED_TYPE_PREFERENCEThe type preference of a UDP-tunnelled TCP candidate (RFC 6544 Section 4.2: "the RECOMMENDED type preferences for the new candidate types defined in this document ... are 105 for NAT-assisted candidates and 75 for UDP-tunneled candidates").

rtci_ice::candidate::candidate_host

Host candidates: an address on a local interface.

rtci_ice::candidate::candidate_pair

A local/remote candidate pair and its check state.

rtci_ice::candidate::candidate_peer_reflexive

Peer-reflexive candidates, learned from an inbound check's source address.

rtci_ice::candidate::candidate_relay

Relay candidates, allocated on a TURN server.

rtci_ice::candidate::candidate_server_reflexive

Server-reflexive candidates, learned from a STUN Binding response.

rtci_ice::mdns

mDNS candidate handling, which hides private addresses behind .local names.

  • modexposureThe two cases in which QueryAndGather may leave a host address unwrapped, each its own opt-in setting, off by default (draft-ietf-mmusic-mdns-ice-candidates-03).
  • structMulticastDnsPublishingWhether the application can send the agent's mDNS messages, per address family: an mDNS socket of that family is open (the agent writes its announcements and answers from port 5353 to 224.0.0.251 or ff02::fb). Both by default. An application that has none for a family tells the agent (Agent::set_multicast_dns_publishing) before it adds the host candidates of that family: a name of such an …
  • enumMulticastDnsModeRepresents the different Multicast modes that ICE can run.
  • useis_global_unicastfrom exposure::is_global_unicastWhether ip is a globally reachable unicast address: the only kind of address the two exposure settings may ever leave unwrapped. A hard check of the engine, applied whatever a STUN server answered or the application marked.
  • useMdnsRateLimitfrom mdns::MdnsRateLimit

rtci_ice::mdns::exposure

The two cases in which QueryAndGather may leave a host address unwrapped, each its own opt-in setting, off by default (draft-ietf-mmusic-mdns-ice-candidates-03).

  • fnis_global_unicastWhether ip is a globally reachable unicast address: the only kind of address the two exposure settings may ever leave unwrapped. A hard check of the engine, applied whatever a STUN server answered or the application marked.

rtci_ice::network_type

UDP/TCP over IPv4/IPv6, as a candidate's transport.

rtci_ice::rand

Random ICE credentials and identifiers.

  • fngenerate_cand_id<https://tools.ietf.org/html/rfc5245#section-15.1> candidate-id = "candidate" ":" foundation foundation = 1*32ice-char ice-char = ALPHA / DIGIT / "+" / "/"
  • fngenerate_pwdGenerates an ICE password with rand's thread-local CSPRNG.
  • fngenerate_ufragGenerates an ICE username fragment with rand's thread-local CSPRNG.

rtci_ice::state

Connection and gathering states.

  • enumConnectionStateAn enum showing the state of a ICE Connection List of supported States.
  • enumGatheringStateDescribes the state of the candidate gathering process.

rtci_ice::stats

Per-candidate and per-pair counters, surfaced through getStats.

  • structCandidatePairStatsCandidatePairStats contains ICE candidate pair statistics.
  • structCandidateStatsCandidateStats contains ICE candidate statistics related to the ICETransport objects.

rtci_ice::tcp_type

Active, passive and simultaneous-open, for ICE-TCP candidates.

  • enumTcpTypeThe role of an ICE-TCP candidate, per [RFC 6544] §4.5.

rtci_ice::url

Parsing stun:/turn: server URLs.

  • structUrlRepresents a STUN (rfc7064) or TURN (rfc7065) URL.
  • enumProtoTypeThe transport protocol type that is used in the ice::url::Url structure.
  • enumSchemeTypeThe type of server used in the ice.URL structure.

Generated from the sources of rtci-ice 0.5.0 at its release tag. Items made by macros and methods are on docs.rs.