Expand description
ICE for the Sans-I/O WebRTC stack.
Interactive Connectivity Establishment (RFC 8445, superseding RFC 5245) with the extensions WebRTC uses: ICE-TCP candidates (RFC 6544), consent freshness (RFC 7675), and Trickle ICE. ICE is what finds a path between two peers behind NATs: it gathers candidate addresses, pairs local with remote, and probes each pair with STUN connectivity checks until one succeeds.
§Structure
agent— the Sans-I/OAgent: give it candidates and inbound datagrams, poll it for checks to send, state transitions, and the selected pair. It owns no sockets and no clock.candidate— the candidate types (host, server-reflexive, peer-reflexive, relay), their priorities, and SDPa=candidateparsing.state— connection and gathering states, and the checklist state machine.url— parsingstun:/turn:server URLs into something the agent can gather from.network_type,tcp_type— UDP/TCP and active/passive/simultaneous-open.stats— per-candidate and per-pair counters, surfaced throughgetStats.mdns— mDNS candidate handling, for hiding private addresses.
§Example
use rtc_ice::url::{ProtoType, SchemeType, Url};
let stun = Url::parse_url("stun:stun.l.google.com:19302")?;
assert_eq!(stun.scheme, SchemeType::Stun);
assert_eq!(stun.port, 19302);
// TURN URLs may pin the transport used to reach the server.
let turn = Url::parse_url("turn:turn.example.com:3478?transport=tcp")?;
assert_eq!(turn.scheme, SchemeType::Turn);
assert_eq!(turn.proto, ProtoType::Tcp);Most applications do not depend on this crate directly — the
rtc crate drives the agent as one layer of the peer-connection
pipeline.
Re-exports§
pub use agent::Agent;pub use agent::Credentials;pub use agent::Event;pub use agent::agent_config::AgentConfig;pub use agent::agent_stats::CandidatePairStats;pub use agent::agent_stats::CandidateStats;
Modules§
- agent
- The Sans-I/O ICE agent: candidate pairing, connectivity checks, and nomination. The Sans-I/O ICE agent.
- attributes
- The ICE-specific STUN attributes carried in connectivity checks.
- candidate
- Candidate types, priorities, and SDP
a=candidateparsing. ICE candidates: the addresses an agent can be reached at. - mdns
- mDNS candidate handling, which hides private addresses behind
.localnames. - network_
type - UDP/TCP over IPv4/IPv6, as a candidate’s transport. Candidate transports: UDP or TCP, over IPv4 or IPv6.
- rand
- Random ICE credentials and identifiers.
- state
- Connection and gathering states.
- stats
- Per-candidate and per-pair counters, surfaced through
getStats. - tcp_
type - Active, passive and simultaneous-open, for ICE-TCP candidates.
- url
- Parsing
stun:/turn:server URLs.