Skip to main content

rtci_ice/agent/
agent_config.rs

1use std::net::IpAddr;
2use std::time::Duration;
3
4use super::*;
5use crate::agent::remote_policy::RemoteAddressFilter;
6use crate::external_ip_mapper::ExternalIpMapper;
7use crate::mdns::*;
8use crate::network_type::NetworkType;
9use crate::url::*;
10
11/// How often the agent looks at its state while connecting, when nothing else wakes it sooner
12/// (a check to send, a retransmission, a transaction that times out).
13pub(crate) const DEFAULT_CHECK_INTERVAL: Duration = Duration::from_millis(200);
14
15/// Ta, the pacing timer of connectivity checks (RFC 8445 Section 14.2: "ICE agents SHOULD use a
16/// default Ta value, 50 ms").
17pub(crate) const DEFAULT_TA: Duration = Duration::from_millis(50);
18
19/// RFC 8445 Section 14.2: "regardless of the Ta value chosen for each agent, the combination of
20/// all transactions from all agents (if a given implementation runs several concurrent agents)
21/// will not be sent more often than once every 5 ms".
22pub(crate) const MIN_TA: Duration = Duration::from_millis(5);
23
24/// RFC 8445 Section 14.3: "RTO = MAX (500ms, Ta * N * (Num-Waiting + Num-In-Progress))", and
25/// the RTO is never under 500 ms.
26pub(crate) const MIN_RTO: Duration = Duration::from_millis(500);
27
28/// Rm of RFC 8489 Section 6.2.1: after the last request of a transaction the agent waits
29/// Rm times the RTO for a response.
30pub(crate) const STUN_RM: u32 = 16;
31
32/// Ti of RFC 8489 Section 6.2.2: how long a transaction over a reliable transport (TCP) waits
33/// for its response; such a request is never retransmitted (RFC 6544 Section 7.1).
34pub(crate) const STUN_TI: Duration = Duration::from_millis(39_500);
35
36/// RFC 8445 Section 6.1.2.5: "The limit MUST default to 100" candidate pairs.
37pub(crate) const DEFAULT_MAX_CANDIDATE_PAIRS: usize = 100;
38
39/// Most local peer-reflexive candidates learned from the mapped addresses of responses.
40pub(crate) const MAX_LOCAL_PEER_REFLEXIVE_CANDIDATES: usize = 16;
41
42/// The basic period of the consent checks on the selected pair (RFC 7675 Section 5.1:
43/// "Implementations SHOULD set a default interval of 5 seconds, resulting in a period between
44/// checks of 4 to 6 seconds"). Also the smallest period that can be configured.
45pub(crate) const DEFAULT_KEEPALIVE_INTERVAL: Duration = Duration::from_secs(5);
46
47/// RFC 7675 Section 5.1: "Implementations MUST NOT set the period between checks to less than 4
48/// seconds."
49pub(crate) const MIN_CONSENT_INTERVAL: Duration = Duration::from_secs(4);
50
51/// RFC 8445 Section 11: "Tr SHOULD be configurable and SHOULD have a default of 15 seconds",
52/// and never less. A full agent's consent checks are its keepalives and come sooner; this is
53/// how long a lite agent stays silent on its selected pair before a Binding indication.
54pub(crate) const KEEPALIVE_TR: Duration = Duration::from_secs(15);
55
56/// RFC 7675 Section 5.1: "Consent expires after 30 seconds."
57pub(crate) const CONSENT_EXPIRY: Duration = Duration::from_secs(30);
58
59/// The default time till an Agent transitions disconnected.
60pub(crate) const DEFAULT_DISCONNECTED_TIMEOUT: Duration = Duration::from_secs(5);
61
62/// The default time till an Agent transitions to failed after disconnected.
63pub(crate) const DEFAULT_FAILED_TIMEOUT: Duration = Duration::from_secs(25);
64
65/// Wait time before nominating a host candidate.
66pub(crate) const DEFAULT_HOST_ACCEPTANCE_MIN_WAIT: Duration = Duration::from_secs(0);
67
68/// Wait time before nominating a srflx candidate.
69pub(crate) const DEFAULT_SRFLX_ACCEPTANCE_MIN_WAIT: Duration = Duration::from_millis(500);
70
71/// Wait time before nominating a prflx candidate.
72pub(crate) const DEFAULT_PRFLX_ACCEPTANCE_MIN_WAIT: Duration = Duration::from_millis(1000);
73
74/// Wait time before nominating a relay candidate.
75pub(crate) const DEFAULT_RELAY_ACCEPTANCE_MIN_WAIT: Duration = Duration::from_millis(2000);
76
77/// Rc of RFC 8489 Section 6.2.1: the requests of one STUN transaction (the first and its
78/// retransmissions) before the pair is considered failed. "Rc SHOULD be configurable and SHOULD
79/// have a default of 7."
80pub(crate) const DEFAULT_MAX_BINDING_REQUESTS: u16 = 7;
81
82/// The number of bytes that can be buffered before we start to error.
83pub(crate) const MAX_BUFFER_SIZE: usize = 1000 * 1000; // 1MB
84
85/// The longest a consent request waits for its response. The wait is four times the pair's
86/// last round-trip time, at least 500 ms (RFC 7675 Section 5.1: "for a time based on the
87/// estimated round-trip time (RTT) [...] with an allowance for variation in network delay"),
88/// and never longer than this, which is also less than the shortest consent interval.
89pub(crate) const MAX_BINDING_REQUEST_TIMEOUT: Duration = Duration::from_millis(4000);
90
91/// The most open transactions the agent tracks beyond one per candidate pair: consent requests
92/// and cancelled transactions still waiting out their timeout. Past it the oldest of those is
93/// forgotten (its response, if it ever arrives, is then ignored).
94pub(crate) const MAX_PENDING_BINDING_REQUESTS: usize = 50;
95
96impl AgentConfig {
97    /// Builds the 1:1 NAT mapper and checks it can take effect: a `Host` mapping cannot be used
98    /// with mDNS host names (the address would be hidden anyway) and needs host candidates, a
99    /// `ServerReflexive` one needs server-reflexive candidates.
100    pub(crate) fn init_ext_ip_mapping(
101        &self,
102        mdns_mode: MulticastDnsMode,
103        candidate_types: &[CandidateType],
104    ) -> Result<Option<ExternalIpMapper>> {
105        let Some(ext_ip_mapper) =
106            ExternalIpMapper::new(self.nat_1to1_ip_candidate_type, &self.nat_1to1_ips)?
107        else {
108            return Ok(None);
109        };
110        if ext_ip_mapper.candidate_type == CandidateType::Host {
111            if mdns_mode == MulticastDnsMode::QueryAndGather {
112                return Err(Error::ErrMulticastDnsWithNat1to1IpMapping);
113            }
114            if !candidate_types.contains(&CandidateType::Host) {
115                return Err(Error::ErrIneffectiveNat1to1IpMappingHost);
116            }
117        } else if ext_ip_mapper.candidate_type == CandidateType::ServerReflexive
118            && !candidate_types.contains(&CandidateType::ServerReflexive)
119        {
120            return Err(Error::ErrIneffectiveNat1to1IpMappingSrflx);
121        }
122        Ok(Some(ext_ip_mapper))
123    }
124}
125
126/// Which nomination a controlled agent uses when the controlling agent makes more than one.
127#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
128#[non_exhaustive]
129pub enum NominationAcceptance {
130    /// RFC 8445 Section 8.1.1: "If more than one candidate pair is nominated by the
131    /// controlling agent, and if the controlled agent accepts multiple nominations requests,
132    /// the agents MUST produce the selected pairs and use the pairs with the highest
133    /// priority." Every nomination is accepted; the selected pair is the nominated valid pair
134    /// with the highest priority. A nominated pair of lower priority takes over only when
135    /// consent is lost on the selected one (RFC 7675: that pair may no longer be sent on).
136    #[default]
137    HighestPriority,
138    /// libwebrtc's behaviour: the latest nomination wins, and with the `NOMINATION` attribute
139    /// (libwebrtc's renomination) the highest value does. libwebrtc moves a session to another
140    /// pair after it connected by nominating that pair, whatever its priority.
141    Latest,
142}
143
144/// A pacing budget several agents share (RFC 8445 Section 14.2: "all agents together send
145/// no more than one transaction per 5 ms" — the "global" Ta of an implementation that runs
146/// several agents). Give the same `Arc` to every agent (through
147/// [`AgentConfig::pacing_group`] or the peer connection's
148/// `SettingEngineBuilder::with_ice_pacing_group`): each starts a connectivity check only when
149/// none of them has started one in the last 5 ms, on top of its own Ta. An agent without a
150/// group paces alone, by its Ta.
151#[derive(Debug, Default)]
152pub struct PacingGroup {
153    next: std::sync::Mutex<Option<std::time::Instant>>,
154}
155
156impl PacingGroup {
157    /// A new budget, shared by every agent given it.
158    pub fn new() -> std::sync::Arc<Self> {
159        std::sync::Arc::new(Self::default())
160    }
161
162    /// Takes the budget at `now` if it is free: `Ok(())`, or `Err(at)` with when it next is.
163    pub(crate) fn take(
164        &self,
165        now: std::time::Instant,
166    ) -> std::result::Result<(), std::time::Instant> {
167        let mut next = self
168            .next
169            .lock()
170            .unwrap_or_else(|poisoned| poisoned.into_inner());
171        match *next {
172            Some(at) if at > now => Err(at),
173            _ => {
174                *next = Some(now + MIN_TA);
175                Ok(())
176            }
177        }
178    }
179}
180
181/// What an agent does when a nomination fails (RFC 8445 Section 7.2.5.2): the controlling
182/// agent's check with USE-CANDIDATE on a valid pair, or the controlled agent's check that a
183/// received USE-CANDIDATE triggered (Section 7.3.1.5). The check fails when its transaction times out (`Rc` requests, the
184/// last given `Rm` times the RTO, Section 14.3 and RFC 8489 Section 6.2.1: 39.5 seconds at an
185/// RTO of 500 ms), it is answered with an unrecoverable error response, or the response is
186/// not symmetric.
187#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
188#[non_exhaustive]
189pub enum FailedNomination {
190    /// RFC 8445 Section 7.2.5.3.4 (the default), for both roles: "If the request fails
191    /// (Section 7.2.5.2), the agent MUST remove the candidate pair from the valid list, set
192    /// the candidate pair state to Failed, and set the checklist state to Failed", and for
193    /// the controlled agent "If the triggered request fails, [...] set the checklist state to
194    /// Failed". The agent fails; the peer may stay connected until its consent expires (RFC
195    /// 7675).
196    #[default]
197    FailChecklist,
198    /// The pair stays valid (it has received a success response, RFC 8445 Section
199    /// 7.2.5.3.3) and a nomination that times out is sent again, for as long as the peer is
200    /// heard from on it (an authenticated request or response less than the consent expiry,
201    /// 30 seconds, ago). Once the peer has not been heard from for that long, or the
202    /// nomination is answered with an error or from the wrong address, the pair fails and
203    /// the next valid pair is nominated; with none left the checklist fails. Under heavy
204    /// loss every request of a transaction, or every response, can be lost while the peer is
205    /// there and has accepted the nomination: this keeps both sides connected then. A
206    /// controlled agent whose triggered check fails fails that pair only: the checklist keeps
207    /// running, and the controlling agent may nominate another pair.
208    Retry,
209}
210
211/// What the agent does with a Binding request that fails the short-term credential check.
212#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
213#[non_exhaustive]
214pub enum UnauthenticatedRequests {
215    /// RFC 8489 Section 9.1.3 (which RFC 8445 Section 7.3 makes the ICE procedure): a request
216    /// without MESSAGE-INTEGRITY or USERNAME is answered 400 (Bad Request), one with an
217    /// unknown username or a wrong MESSAGE-INTEGRITY 401 (Unauthenticated). The error
218    /// responses are rate limited (a token bucket of
219    /// [`MAX_UNAUTHENTICATED_RESPONSE_BURST`] responses, one more every
220    /// [`UNAUTHENTICATED_RESPONSE_INTERVAL`]), each is smaller than the request it answers,
221    /// and past the limit the request is dropped: the agent cannot be made to reflect traffic
222    /// at a spoofed source.
223    #[default]
224    Reject,
225    /// Such a request is dropped without an answer (what this crate did before, and what
226    /// libwebrtc does for a request whose username is not for it).
227    Drop,
228}
229
230/// The error responses to unauthenticated requests the agent may send in a burst.
231pub const MAX_UNAUTHENTICATED_RESPONSE_BURST: u32 = 5;
232
233/// How often the agent may send one more error response to an unauthenticated request.
234pub const UNAUTHENTICATED_RESPONSE_INTERVAL: Duration = Duration::from_millis(200);
235
236pub(crate) fn default_candidate_types() -> Vec<CandidateType> {
237    vec![
238        CandidateType::Host,
239        CandidateType::ServerReflexive,
240        CandidateType::Relay,
241    ]
242}
243
244/// Collects the arguments to `ice::Agent` construction into a single structure, for
245/// future-proofness of the interface.
246#[derive(Default)]
247pub struct AgentConfig {
248    /// The STUN and TURN servers to gather reflexive and relay candidates from.
249    pub urls: Vec<Url>,
250
251    /// It is used to perform connectivity checks. The values MUST be unguessable, with at least
252    /// 128 bits of random number generator output used to generate the password, and at least 24
253    /// bits of output to generate the username fragment.
254    pub local_ufrag: String,
255    /// It is used to perform connectivity checks. The values MUST be unguessable, with at least
256    /// 128 bits of random number generator output used to generate the password, and at least 24
257    /// bits of output to generate the username fragment.
258    pub local_pwd: String,
259
260    /// Controls mDNS query timeout
261    /// If the duration is 0, we will never go to failed.
262    pub multicast_dns_query_timeout: Option<Duration>,
263
264    /// Controls mDNS behavior for the ICE agent.
265    pub multicast_dns_mode: MulticastDnsMode,
266
267    /// Controls the local name for this agent. If none is specified a random one will be generated.
268    pub multicast_dns_local_name: String,
269
270    /// Control mDNS local IP address
271    pub multicast_dns_local_ip: Option<IpAddr>,
272
273    /// How long a consent request on the selected pair may go unanswered before the agent is
274    /// `Disconnected` (a lite agent: how long without an authenticated request from the peer).
275    /// Defaults to 5 seconds when this property is nil.
276    /// If the duration is 0, the ICE Agent will never go to disconnected.
277    pub disconnected_timeout: Option<Duration>,
278
279    /// With `disconnected_timeout`, how long the agent goes without the peer's consent before
280    /// it is `Failed`, and how long it may stay `Checking`. Defaults to 25 seconds when this
281    /// property is nil. If the duration is 0, a checking agent never goes to failed.
282    ///
283    /// A connected full agent fails 30 seconds after the last consent response at the latest,
284    /// whatever is configured here, a zero included: RFC 7675 Section 5.1 forbids sending
285    /// without consent for longer. A shorter sum fails it sooner.
286    pub failed_timeout: Option<Duration>,
287
288    /// The basic period of the consent checks on the selected pair (RFC 7675), which are also
289    /// the keepalives of RFC 8445 Section 11. Each interval is drawn from 0.8 to 1.2 times
290    /// this. Defaults to 5 seconds when this is nil, and a shorter period is raised to 5
291    /// seconds: RFC 7675 forbids less than 4 seconds between two checks.
292    /// A keepalive interval of 0 means we never send keepalive packets (and consent then
293    /// expires 30 seconds after the pair was validated).
294    pub keepalive_interval: Option<Duration>,
295
296    /// An optional configuration for disabling or enabling support for specific candidate types.
297    pub candidate_types: Vec<CandidateType>,
298
299    /// An optional configuration for disabling or enabling support for specific network types.
300    /// If empty, all network types are supported.
301    pub network_types: Vec<NetworkType>,
302
303    /// Controls how often our internal task loop runs when in the connecting state and nothing
304    /// is due sooner. Only useful for testing.
305    pub check_interval: Duration,
306
307    /// Ta, the pacing of connectivity checks: one check is started per Ta (RFC 8445 Section
308    /// 6.1.4.2). 50 ms when nil; never under 5 ms (Section 14.2).
309    pub ta: Option<Duration>,
310
311    /// The most candidate pairs the checklist holds (RFC 8445 Section 6.1.2.5). 100 when nil.
312    /// When it is full a new pair replaces a Failed one, else a lower-priority one that has
313    /// not been checked yet, else it is dropped.
314    pub max_candidate_pairs: Option<usize>,
315
316    /// The requests of one connectivity-check transaction, the first and its retransmissions
317    /// (Rc of RFC 8489 Section 6.2.1; 7 when nil). They go out RTO, 2 RTO, 4 RTO, ... apart
318    /// (RTO is at least 500 ms), and the pair fails 16 RTO after the last one. Over TCP a
319    /// request is sent once.
320    pub max_binding_requests: Option<u16>,
321
322    /// Whether this agent takes the controlling role.
323    pub is_controlling: bool,
324
325    /// lite agents do not perform connectivity check and only provide host candidates.
326    pub lite: bool,
327
328    /// webrtc-extensions 7 `icecandidatepairnominate`, cancelable: when true, a controlling
329    /// agent that has picked a pair to nominate proposes it first
330    /// ([`Event::CandidatePairNominationProposed`](crate::agent::Event)) and waits for
331    /// [`Agent::resolve_nomination_proposal`](crate::agent::Agent::resolve_nomination_proposal);
332    /// a declined pair is not nominated, and the agent keeps checking. False (the default):
333    /// the agent nominates at once, as for an event nobody cancels.
334    pub candidate_pair_proposals: bool,
335
336    /// Specify a minimum wait time before selecting host candidates.
337    pub host_acceptance_min_wait: Option<Duration>,
338    /// Specify a minimum wait time before selecting srflx candidates.
339    pub srflx_acceptance_min_wait: Option<Duration>,
340    /// Specify a minimum wait time before selecting prflx candidates.
341    pub prflx_acceptance_min_wait: Option<Duration>,
342    /// Specify a minimum wait time before selecting relay candidates.
343    pub relay_acceptance_min_wait: Option<Duration>,
344
345    /// Controls if self-signed certificates are accepted when connecting to TURN servers via TLS or
346    /// DTLS.
347    pub insecure_skip_verify: bool,
348
349    /// External addresses a 1:1 NAT gives this host (a cloud instance's public IP), each
350    /// `"<external ip>"` or `"<external ip>/<local ip>"`. The host candidates the application
351    /// adds are advertised with them, as `nat_1to1_ip_candidate_type` says. Empty: no mapping.
352    pub nat_1to1_ips: Vec<String>,
353
354    /// How `nat_1to1_ips` are advertised: [`CandidateType::Host`] (the default, also for
355    /// `Unspecified`) replaces a mapped host candidate's address with the external one;
356    /// [`CandidateType::ServerReflexive`] adds a server-reflexive candidate on the external
357    /// address beside it. Any other type is refused by [`Agent::new`](crate::Agent::new).
358    pub nat_1to1_ip_candidate_type: CandidateType,
359
360    /// Lets connectivity checks go to a loopback remote address (`127.0.0.0/8`, `::1`) from a
361    /// local candidate that is not itself on loopback. Off by default: a loopback remote
362    /// candidate is then paired only with a loopback local candidate, so a peer cannot make
363    /// this host send checks to its own services. See the [`remote_policy`] module.
364    pub allow_loopback_remote_candidates: bool,
365
366    /// Lets connectivity checks go to a link-local remote address (`169.254.0.0/16`,
367    /// `fe80::/10`) from a local candidate that is not itself link-local. Off by default.
368    pub allow_link_local_remote_candidates: bool,
369
370    /// Asked about every remote candidate's address (an mDNS candidate's once resolved) before
371    /// the agent holds it; `false` drops the candidate. Addresses that are never a valid unicast
372    /// destination (unspecified, multicast, broadcast, port 0) are dropped before it is asked.
373    pub remote_address_filter: Option<RemoteAddressFilter>,
374
375    /// The tiebreaker of RFC 8445 Section 5.2 ("a random number between 0 and 2**64 - 1",
376    /// drawn when nil). A fixed one makes the outcome of a role conflict reproducible; the
377    /// agent still draws a new one when a 487 (Role Conflict) tells it to (Section 7.2.5.1).
378    pub tie_breaker: Option<u64>,
379
380    /// Which of several nominations a controlled agent uses. The default is RFC 8445's rule
381    /// (the nominated pair with the highest priority); [`NominationAcceptance::Latest`] is
382    /// libwebrtc's.
383    pub nomination_acceptance: NominationAcceptance,
384
385    /// What the controlling agent does when its nomination fails:
386    /// [`FailedNomination::FailChecklist`] (the default) is RFC 8445 Section 7.2.5.3.4, the
387    /// pair and the checklist fail; [`FailedNomination::Retry`] nominates the pair again
388    /// while the peer is heard from.
389    pub failed_nomination: FailedNomination,
390
391    /// A pacing budget shared with other agents (RFC 8445 Section 14.2), if the application
392    /// runs several: see [`PacingGroup`]. `None`, the default, paces this agent alone.
393    pub pacing_group: Option<std::sync::Arc<PacingGroup>>,
394
395    /// The controlling agent's consent checks on the selected pair carry USE-CANDIDATE, as
396    /// libwebrtc's do. Off by default: RFC 8445 Section 7.1.2 asks for the attribute "in order
397    /// to nominate a candidate pair", which is done once (Section 8.1.1), and RFC 7675 asks
398    /// for nothing more than a Binding request. The agent repeats its nomination by itself
399    /// where the peer has shown that it lost it (a role conflict the agent wins after it
400    /// nominated).
401    pub nominate_on_consent_checks: bool,
402
403    /// What a Binding request that fails authentication gets: an error response (RFC 8489
404    /// Section 9.1.3, rate limited; the default) or nothing.
405    pub unauthenticated_requests: UnauthenticatedRequests,
406
407    /// Accept data (DTLS, SRTP) only from the selected pair's remote address. Off by default:
408    /// RFC 8445 Section 12.2 says an agent "SHOULD by default be prepared to receive data on
409    /// any of the candidates provided in the most recent candidate exchange", and the agent
410    /// accepts it from the remote candidate of any valid pair (a pair one of its own checks
411    /// succeeded on). See [`Agent::accepts_data`].
412    pub data_from_selected_pair_only: bool,
413
414    /// Whether the first mDNS query for a remote `.local` candidate waits a random 20 to 120
415    /// ms (RFC 6762 Section 5.2: every participant of a call is told of the name at the same
416    /// moment). `None` is on, as the RFC recommends; `Some(false)` sends it from the
417    /// `handle_timeout` that follows the candidate.
418    pub multicast_dns_first_query_delay: Option<bool>,
419
420    /// Whether the agent's mDNS answers to a query of more than one question (an A and an
421    /// AAAA question for its name, as browsers ask) wait a random 20 to 120 ms (RFC 6762
422    /// Section 6.3). `None` is on, as the RFC recommends; `Some(false)` answers a query about
423    /// its own names only at once.
424    pub multicast_dns_multi_question_delay: Option<bool>,
425
426    /// The driver hands every mDNS datagram to `handle_read` with the datagram's destination
427    /// in `local_addr` (from `IP_PKTINFO` / `IPV6_PKTINFO`): `224.0.0.251:5353` or
428    /// `[ff02::fb]:5353` for one that arrived on the group, the host's own address for one
429    /// sent to it by unicast. The mDNS connection then holds a unicast arrival to the rules
430    /// RFC 6762 has for it (Sections 5.5 and 6). Off by default: a socket's bound address
431    /// says nothing about how a datagram reached it.
432    pub multicast_dns_destination_reported: bool,
433
434    /// The first query for a name asks for a unicast response (the QU bit, RFC 6762 Section
435    /// 5.4, which draft-ietf-mmusic-mdns-ice-candidates Section 3.2.1 suggests). Off by
436    /// default: a unicast response reaches one socket on port 5353 only (RFC 6762 Section
437    /// 15.1), so beside a system responder the answer can be lost. Turn it on, with
438    /// `multicast_dns_destination_reported`, when the application's socket is the only one.
439    pub multicast_dns_unicast_response: bool,
440
441    /// The limit on the mDNS messages sent, to share between every agent of a process
442    /// (draft-ietf-mmusic-mdns-ice-candidates Section 7.1: the limit is the implementation's,
443    /// not one agent's): give each agent a clone of one [`mdns::MdnsRateLimit`]. `None`: a
444    /// limit of this agent's own (40 messages at once, 10 a second). The crate keeps no
445    /// process-wide state of its own, so it cannot share one unasked.
446    pub multicast_dns_rate_limit: Option<mdns::MdnsRateLimit>,
447
448    /// Send data on the best valid pair before a pair is selected (RFC 8445 Section 12.1: "An
449    /// ICE agent MAY send data on any valid pair before selected pairs have been produced").
450    /// Off by default: data is sent once a pair is selected.
451    pub send_data_before_nomination: bool,
452
453    /// [`Agent::add_local_candidate`](crate::agent::Agent::add_local_candidate) holds the
454    /// candidate as [`Agent::add_unconveyed_local_candidate`](crate::agent::Agent::add_unconveyed_local_candidate)
455    /// does: unpaired until the caller says it has been conveyed to the peer (RFC 8838
456    /// Section 10). Off by default: a caller of `add_local_candidate` conveys the candidate
457    /// with that call. A driver that hands candidates to an application to trickle (the peer
458    /// connection does) turns it on.
459    pub hold_local_candidates_until_conveyed: bool,
460
461    /// The path MTU in bytes, when the application knows it. RFC 8489 Section 6.1: a STUN
462    /// message over UDP fits it; `None` assumes 576 bytes for IPv4 and 1280 for IPv6, the
463    /// RFC's figures when it is not known. A check that would not fit is not sent and its pair
464    /// fails; no other STUN message larger than that is sent over UDP.
465    pub path_mtu: Option<usize>,
466
467    /// The SOFTWARE attribute of the agent's connectivity checks and of its success responses
468    /// to the peer's (RFC 8489 Sections 6.1, 6.3.1.1: requests and responses "SHOULD" carry
469    /// one; Section 16.1.2: its use "SHOULD" be configurable). `None`: `rtci-ice` and its
470    /// version. `Some("")`: none, for an application that would not tell its software to the
471    /// path (Section 16.1.2).
472    pub software: Option<String>,
473}