Skip to main content

AgentConfig

Struct AgentConfig 

Source
pub struct AgentConfig {
Show 45 fields pub urls: Vec<Url>, pub local_ufrag: String, pub local_pwd: String, pub multicast_dns_query_timeout: Option<Duration>, pub multicast_dns_mode: MulticastDnsMode, pub multicast_dns_local_name: String, pub multicast_dns_local_ip: Option<IpAddr>, pub disconnected_timeout: Option<Duration>, pub failed_timeout: Option<Duration>, pub keepalive_interval: Option<Duration>, pub candidate_types: Vec<CandidateType>, pub network_types: Vec<NetworkType>, pub check_interval: Duration, pub ta: Option<Duration>, pub max_candidate_pairs: Option<usize>, pub max_binding_requests: Option<u16>, pub is_controlling: bool, pub lite: bool, pub candidate_pair_proposals: bool, pub host_acceptance_min_wait: Option<Duration>, pub srflx_acceptance_min_wait: Option<Duration>, pub prflx_acceptance_min_wait: Option<Duration>, pub relay_acceptance_min_wait: Option<Duration>, pub insecure_skip_verify: bool, pub nat_1to1_ips: Vec<String>, pub nat_1to1_ip_candidate_type: CandidateType, pub allow_loopback_remote_candidates: bool, pub allow_link_local_remote_candidates: bool, pub remote_address_filter: Option<RemoteAddressFilter>, pub tie_breaker: Option<u64>, pub nomination_acceptance: NominationAcceptance, pub failed_nomination: FailedNomination, pub pacing_group: Option<Arc<PacingGroup>>, pub nominate_on_consent_checks: bool, pub unauthenticated_requests: UnauthenticatedRequests, pub data_from_selected_pair_only: bool, pub multicast_dns_first_query_delay: Option<bool>, pub multicast_dns_multi_question_delay: Option<bool>, pub multicast_dns_destination_reported: bool, pub multicast_dns_unicast_response: bool, pub multicast_dns_rate_limit: Option<MdnsRateLimit>, pub send_data_before_nomination: bool, pub hold_local_candidates_until_conveyed: bool, pub path_mtu: Option<usize>, pub software: Option<String>,
}
Expand description

Collects the arguments to ice::Agent construction into a single structure, for future-proofness of the interface.

Fields§

§urls: Vec<Url>

The STUN and TURN servers to gather reflexive and relay candidates from.

§local_ufrag: String

It is used to perform connectivity checks. The values MUST be unguessable, with at least 128 bits of random number generator output used to generate the password, and at least 24 bits of output to generate the username fragment.

§local_pwd: String

It is used to perform connectivity checks. The values MUST be unguessable, with at least 128 bits of random number generator output used to generate the password, and at least 24 bits of output to generate the username fragment.

§multicast_dns_query_timeout: Option<Duration>

Controls mDNS query timeout If the duration is 0, we will never go to failed.

§multicast_dns_mode: MulticastDnsMode

Controls mDNS behavior for the ICE agent.

§multicast_dns_local_name: String

Controls the local name for this agent. If none is specified a random one will be generated.

§multicast_dns_local_ip: Option<IpAddr>

Control mDNS local IP address

§disconnected_timeout: Option<Duration>

How long a consent request on the selected pair may go unanswered before the agent is Disconnected (a lite agent: how long without an authenticated request from the peer). Defaults to 5 seconds when this property is nil. If the duration is 0, the ICE Agent will never go to disconnected.

§failed_timeout: Option<Duration>

With disconnected_timeout, how long the agent goes without the peer’s consent before it is Failed, and how long it may stay Checking. Defaults to 25 seconds when this property is nil. If the duration is 0, a checking agent never goes to failed.

A connected full agent fails 30 seconds after the last consent response at the latest, whatever is configured here, a zero included: RFC 7675 Section 5.1 forbids sending without consent for longer. A shorter sum fails it sooner.

§keepalive_interval: Option<Duration>

The basic period of the consent checks on the selected pair (RFC 7675), which are also the keepalives of RFC 8445 Section 11. Each interval is drawn from 0.8 to 1.2 times this. Defaults to 5 seconds when this is nil, and a shorter period is raised to 5 seconds: RFC 7675 forbids less than 4 seconds between two checks. A keepalive interval of 0 means we never send keepalive packets (and consent then expires 30 seconds after the pair was validated).

§candidate_types: Vec<CandidateType>

An optional configuration for disabling or enabling support for specific candidate types.

§network_types: Vec<NetworkType>

An optional configuration for disabling or enabling support for specific network types. If empty, all network types are supported.

§check_interval: Duration

Controls how often our internal task loop runs when in the connecting state and nothing is due sooner. Only useful for testing.

§ta: Option<Duration>

Ta, the pacing of connectivity checks: one check is started per Ta (RFC 8445 Section 6.1.4.2). 50 ms when nil; never under 5 ms (Section 14.2).

§max_candidate_pairs: Option<usize>

The most candidate pairs the checklist holds (RFC 8445 Section 6.1.2.5). 100 when nil. When it is full a new pair replaces a Failed one, else a lower-priority one that has not been checked yet, else it is dropped.

§max_binding_requests: Option<u16>

The requests of one connectivity-check transaction, the first and its retransmissions (Rc of RFC 8489 Section 6.2.1; 7 when nil). They go out RTO, 2 RTO, 4 RTO, … apart (RTO is at least 500 ms), and the pair fails 16 RTO after the last one. Over TCP a request is sent once.

§is_controlling: bool

Whether this agent takes the controlling role.

§lite: bool

lite agents do not perform connectivity check and only provide host candidates.

§candidate_pair_proposals: bool

webrtc-extensions 7 icecandidatepairnominate, cancelable: when true, a controlling agent that has picked a pair to nominate proposes it first (Event::CandidatePairNominationProposed) and waits for Agent::resolve_nomination_proposal; a declined pair is not nominated, and the agent keeps checking. False (the default): the agent nominates at once, as for an event nobody cancels.

§host_acceptance_min_wait: Option<Duration>

Specify a minimum wait time before selecting host candidates.

§srflx_acceptance_min_wait: Option<Duration>

Specify a minimum wait time before selecting srflx candidates.

§prflx_acceptance_min_wait: Option<Duration>

Specify a minimum wait time before selecting prflx candidates.

§relay_acceptance_min_wait: Option<Duration>

Specify a minimum wait time before selecting relay candidates.

§insecure_skip_verify: bool

Controls if self-signed certificates are accepted when connecting to TURN servers via TLS or DTLS.

§nat_1to1_ips: Vec<String>

External addresses a 1:1 NAT gives this host (a cloud instance’s public IP), each "<external ip>" or "<external ip>/<local ip>". The host candidates the application adds are advertised with them, as nat_1to1_ip_candidate_type says. Empty: no mapping.

§nat_1to1_ip_candidate_type: CandidateType

How nat_1to1_ips are advertised: CandidateType::Host (the default, also for Unspecified) replaces a mapped host candidate’s address with the external one; CandidateType::ServerReflexive adds a server-reflexive candidate on the external address beside it. Any other type is refused by Agent::new.

§allow_loopback_remote_candidates: bool

Lets connectivity checks go to a loopback remote address (127.0.0.0/8, ::1) from a local candidate that is not itself on loopback. Off by default: a loopback remote candidate is then paired only with a loopback local candidate, so a peer cannot make this host send checks to its own services. See the remote_policy module.

§allow_link_local_remote_candidates: bool

Lets connectivity checks go to a link-local remote address (169.254.0.0/16, fe80::/10) from a local candidate that is not itself link-local. Off by default.

§remote_address_filter: Option<RemoteAddressFilter>

Asked about every remote candidate’s address (an mDNS candidate’s once resolved) before the agent holds it; false drops the candidate. Addresses that are never a valid unicast destination (unspecified, multicast, broadcast, port 0) are dropped before it is asked.

§tie_breaker: Option<u64>

The tiebreaker of RFC 8445 Section 5.2 (“a random number between 0 and 2**64 - 1”, drawn when nil). A fixed one makes the outcome of a role conflict reproducible; the agent still draws a new one when a 487 (Role Conflict) tells it to (Section 7.2.5.1).

§nomination_acceptance: NominationAcceptance

Which of several nominations a controlled agent uses. The default is RFC 8445’s rule (the nominated pair with the highest priority); NominationAcceptance::Latest is libwebrtc’s.

§failed_nomination: FailedNomination

What the controlling agent does when its nomination fails: FailedNomination::FailChecklist (the default) is RFC 8445 Section 7.2.5.3.4, the pair and the checklist fail; FailedNomination::Retry nominates the pair again while the peer is heard from.

§pacing_group: Option<Arc<PacingGroup>>

A pacing budget shared with other agents (RFC 8445 Section 14.2), if the application runs several: see PacingGroup. None, the default, paces this agent alone.

§nominate_on_consent_checks: bool

The controlling agent’s consent checks on the selected pair carry USE-CANDIDATE, as libwebrtc’s do. Off by default: RFC 8445 Section 7.1.2 asks for the attribute “in order to nominate a candidate pair”, which is done once (Section 8.1.1), and RFC 7675 asks for nothing more than a Binding request. The agent repeats its nomination by itself where the peer has shown that it lost it (a role conflict the agent wins after it nominated).

§unauthenticated_requests: UnauthenticatedRequests

What a Binding request that fails authentication gets: an error response (RFC 8489 Section 9.1.3, rate limited; the default) or nothing.

§data_from_selected_pair_only: bool

Accept data (DTLS, SRTP) only from the selected pair’s remote address. Off by default: RFC 8445 Section 12.2 says an agent “SHOULD by default be prepared to receive data on any of the candidates provided in the most recent candidate exchange”, and the agent accepts it from the remote candidate of any valid pair (a pair one of its own checks succeeded on). See Agent::accepts_data.

§multicast_dns_first_query_delay: Option<bool>

Whether the first mDNS query for a remote .local candidate waits a random 20 to 120 ms (RFC 6762 Section 5.2: every participant of a call is told of the name at the same moment). None is on, as the RFC recommends; Some(false) sends it from the handle_timeout that follows the candidate.

§multicast_dns_multi_question_delay: Option<bool>

Whether the agent’s mDNS answers to a query of more than one question (an A and an AAAA question for its name, as browsers ask) wait a random 20 to 120 ms (RFC 6762 Section 6.3). None is on, as the RFC recommends; Some(false) answers a query about its own names only at once.

§multicast_dns_destination_reported: bool

The driver hands every mDNS datagram to handle_read with the datagram’s destination in local_addr (from IP_PKTINFO / IPV6_PKTINFO): 224.0.0.251:5353 or [ff02::fb]:5353 for one that arrived on the group, the host’s own address for one sent to it by unicast. The mDNS connection then holds a unicast arrival to the rules RFC 6762 has for it (Sections 5.5 and 6). Off by default: a socket’s bound address says nothing about how a datagram reached it.

§multicast_dns_unicast_response: bool

The first query for a name asks for a unicast response (the QU bit, RFC 6762 Section 5.4, which draft-ietf-mmusic-mdns-ice-candidates Section 3.2.1 suggests). Off by default: a unicast response reaches one socket on port 5353 only (RFC 6762 Section 15.1), so beside a system responder the answer can be lost. Turn it on, with multicast_dns_destination_reported, when the application’s socket is the only one.

§multicast_dns_rate_limit: Option<MdnsRateLimit>

The limit on the mDNS messages sent, to share between every agent of a process (draft-ietf-mmusic-mdns-ice-candidates Section 7.1: the limit is the implementation’s, not one agent’s): give each agent a clone of one mdns::MdnsRateLimit. None: a limit of this agent’s own (40 messages at once, 10 a second). The crate keeps no process-wide state of its own, so it cannot share one unasked.

§send_data_before_nomination: bool

Send data on the best valid pair before a pair is selected (RFC 8445 Section 12.1: “An ICE agent MAY send data on any valid pair before selected pairs have been produced”). Off by default: data is sent once a pair is selected.

§hold_local_candidates_until_conveyed: bool

Agent::add_local_candidate holds the candidate as Agent::add_unconveyed_local_candidate does: unpaired until the caller says it has been conveyed to the peer (RFC 8838 Section 10). Off by default: a caller of add_local_candidate conveys the candidate with that call. A driver that hands candidates to an application to trickle (the peer connection does) turns it on.

§path_mtu: Option<usize>

The path MTU in bytes, when the application knows it. RFC 8489 Section 6.1: a STUN message over UDP fits it; None assumes 576 bytes for IPv4 and 1280 for IPv6, the RFC’s figures when it is not known. A check that would not fit is not sent and its pair fails; no other STUN message larger than that is sent over UDP.

§software: Option<String>

The SOFTWARE attribute of the agent’s connectivity checks and of its success responses to the peer’s (RFC 8489 Sections 6.1, 6.3.1.1: requests and responses “SHOULD” carry one; Section 16.1.2: its use “SHOULD” be configurable). None: rtci-ice and its version. Some(""): none, for an application that would not tell its software to the path (Section 16.1.2).

Trait Implementations§

Source§

impl Default for AgentConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.