pub enum RTCIceTransportPolicy {
Unspecified = 0,
All = 1,
Relay = 2,
}Expand description
ICE transport policy controlling which candidate types are used for connectivity.
This policy determines which ICE candidates the peer connection will use and gather during the connection establishment process. It’s primarily used for privacy control and network security requirements.
§Privacy Considerations
- All - Exposes local IP addresses (host candidates) and public IPs (srflx)
- Relay - Hides all IP addresses, only TURN server address visible (privacy mode)
§Examples
§Standard Configuration (All Candidates)
use rtc::peer_connection::configuration::{RTCConfigurationBuilder, RTCIceTransportPolicy};
// Use all candidates for best connectivity (default)
let config = RTCConfigurationBuilder::new()
.with_ice_transport_policy(RTCIceTransportPolicy::All)
.build();§Privacy Mode (Relay Only)
use rtc::peer_connection::configuration::{RTCConfigurationBuilder, RTCIceTransportPolicy};
use rtc::peer_connection::configuration::RTCIceServer;
// Only use TURN relays to hide IP addresses
let config = RTCConfigurationBuilder::new()
.with_ice_servers(vec![
RTCIceServer {
urls: vec!["turn:turn.example.com:3478".to_string()],
username: "user".to_string(),
credential: "password".to_string(),
..Default::default()
},
])
.with_ice_transport_policy(RTCIceTransportPolicy::Relay)
.build();§Specifications
Variants§
Unspecified = 0
Unspecified - not a valid policy, used as default value
All = 1
Use all types of ICE candidates (recommended for best connectivity).
Gathers and uses:
- Host candidates - Local IP addresses
- Server reflexive (srflx) - Public IP from STUN servers
- Relay candidates - TURN server addresses
This provides the best chance of establishing a connection but may expose local and public IP addresses.
Use when: Normal operation, prioritizing connectivity over privacy
Relay = 2
Only use relay candidates from TURN servers (privacy mode).
Only gathers and uses relay candidates obtained through TURN servers. This hides the client’s IP addresses from the remote peer but requires a TURN server and may reduce connection quality.
Use when: Privacy is critical, IP addresses must be hidden
Requirements: Must have TURN servers configured
Trait Implementations§
Source§impl Clone for RTCIceTransportPolicy
impl Clone for RTCIceTransportPolicy
Source§fn clone(&self) -> RTCIceTransportPolicy
fn clone(&self) -> RTCIceTransportPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RTCIceTransportPolicy
Source§impl Debug for RTCIceTransportPolicy
impl Debug for RTCIceTransportPolicy
Source§impl Default for RTCIceTransportPolicy
impl Default for RTCIceTransportPolicy
Source§fn default() -> RTCIceTransportPolicy
fn default() -> RTCIceTransportPolicy
Source§impl<'de> Deserialize<'de> for RTCIceTransportPolicy
impl<'de> Deserialize<'de> for RTCIceTransportPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for RTCIceTransportPolicy
impl Display for RTCIceTransportPolicy
impl Eq for RTCIceTransportPolicy
Source§impl From<&str> for RTCIceTransportPolicy
takes a string and converts it to ICETransportPolicy
impl From<&str> for RTCIceTransportPolicy
takes a string and converts it to ICETransportPolicy
Source§impl PartialEq for RTCIceTransportPolicy
impl PartialEq for RTCIceTransportPolicy
Source§fn eq(&self, other: &RTCIceTransportPolicy) -> bool
fn eq(&self, other: &RTCIceTransportPolicy) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for RTCIceTransportPolicy
impl Serialize for RTCIceTransportPolicy
impl StructuralPartialEq for RTCIceTransportPolicy
Auto Trait Implementations§
impl Freeze for RTCIceTransportPolicy
impl RefUnwindSafe for RTCIceTransportPolicy
impl Send for RTCIceTransportPolicy
impl Sync for RTCIceTransportPolicy
impl Unpin for RTCIceTransportPolicy
impl UnsafeUnpin for RTCIceTransportPolicy
impl UnwindSafe for RTCIceTransportPolicy
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.