Skip to content

Commit d3468c5

Browse files
committed
documentation for ICE transport policy
1 parent 494f1eb commit d3468c5

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

webrtc/src/peer_connection/policy/ice_transport_policy.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,31 @@ use std::fmt;
22

33
use serde::{Deserialize, Serialize};
44

5-
/// ICETransportPolicy defines the ICE candidate policy surface the
6-
/// permitted candidates. Only these candidates are used for connectivity checks.
5+
/// Defines the policy that will be used to determine the
6+
/// permitted ICE candidates that will be used for connectivity checks.
77
#[derive(Default, Debug, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)]
88
pub enum RTCIceTransportPolicy {
99
#[default]
1010
Unspecified = 0,
1111

12-
/// ICETransportPolicyAll indicates any type of candidate is used.
12+
/// Indicates that the ICE Agent can use any type of candidate.
1313
#[serde(rename = "all")]
1414
All = 1,
1515

16-
/// ICETransportPolicyRelay indicates only media relay candidates such
17-
/// as candidates passing through a TURN server are used.
16+
/// Indicates that the ICE Agent must use only media relay candidates,
17+
/// such as candidates passing through a TURN server.
18+
///
19+
/// This can be used to prevent the remote endpoint from learning the
20+
/// user's IP addresses via STUN requests, which may be desirable in
21+
/// certain use cases.
22+
///
23+
/// Keep in mind that media relay candidates can increase latency,
24+
/// reduce throughput, and consume more battery power than direct
25+
/// peer-to-peer connections.
1826
#[serde(rename = "relay")]
1927
Relay = 2,
2028
}
2129

22-
/// ICEGatherPolicy is the ORTC equivalent of ICETransportPolicy
23-
pub type ICEGatherPolicy = RTCIceTransportPolicy;
24-
2530
const ICE_TRANSPORT_POLICY_RELAY_STR: &str = "relay";
2631
const ICE_TRANSPORT_POLICY_ALL_STR: &str = "all";
2732

0 commit comments

Comments
 (0)