pub struct TurnConfig { /* private fields */ }Expand description
Configuration structure for handling TURN client configuration.
Holds the following information:
- Long term credentials for connecting to a TURN server.
- The
TransportTypeof the requested allocation. - A list of
AddressFamilys the allocation should be attempted to be created with.
Implementations§
Source§impl TurnConfig
impl TurnConfig
Sourcepub fn new(credentials: TurnCredentials) -> TurnConfig
pub fn new(credentials: TurnCredentials) -> TurnConfig
Construct a new TurnConfig with the provided credentials.
By default a IPV4/UDP allocation is requested.
§Examples
let credentials = TurnCredentials::new("user", "pass");
let config = TurnConfig::new(credentials.clone());
assert_eq!(config.credentials(), &credentials);
assert_eq!(config.allocation_transport(), TransportType::Udp);
assert_eq!(config.address_families(), &[AddressFamily::IPV4]);Sourcepub fn set_allocation_transport(&mut self, allocation_transport: TransportType)
pub fn set_allocation_transport(&mut self, allocation_transport: TransportType)
Set the allocation transport requested.
§Examples
let credentials = TurnCredentials::new("user", "pass");
let mut config = TurnConfig::new(credentials.clone());
config.set_allocation_transport(TransportType::Tcp);
assert_eq!(config.allocation_transport(), TransportType::Tcp);Sourcepub fn allocation_transport(&self) -> TransportType
pub fn allocation_transport(&self) -> TransportType
Retrieve the allocation transport requested.
Sourcepub fn add_address_family(&mut self, family: AddressFamily)
pub fn add_address_family(&mut self, family: AddressFamily)
Add an AddressFamily that will be requested.
Duplicate AddressFamilys are ignored.
§Examples
let credentials = TurnCredentials::new("user", "pass");
let mut config = TurnConfig::new(credentials.clone());
assert_eq!(config.address_families(), &[AddressFamily::IPV4]);
// Duplicate AddressFamily is ignored.
config.add_address_family(AddressFamily::IPV4);
assert_eq!(config.address_families(), &[AddressFamily::IPV4]);
config.add_address_family(AddressFamily::IPV6);
assert_eq!(config.address_families(), &[AddressFamily::IPV4, AddressFamily::IPV6]);Sourcepub fn set_address_family(&mut self, family: AddressFamily)
pub fn set_address_family(&mut self, family: AddressFamily)
Set the AddressFamily that will be requested.
§Examples
let credentials = TurnCredentials::new("user", "pass");
let mut config = TurnConfig::new(credentials.clone());
assert_eq!(config.address_families(), &[AddressFamily::IPV4]);
config.set_address_family(AddressFamily::IPV4);
assert_eq!(config.address_families(), &[AddressFamily::IPV4]);
config.set_address_family(AddressFamily::IPV6);
assert_eq!(config.address_families(), &[AddressFamily::IPV6]);Sourcepub fn address_families(&self) -> &[AddressFamily]
pub fn address_families(&self) -> &[AddressFamily]
Retrieve the AddressFamilys that are requested.
Sourcepub fn credentials(&self) -> &TurnCredentials
pub fn credentials(&self) -> &TurnCredentials
Retrieve the TurnCredentials used for authenticating with the TURN server.
Sourcepub fn add_supported_integrity(&mut self, integrity: IntegrityAlgorithm)
pub fn add_supported_integrity(&mut self, integrity: IntegrityAlgorithm)
Add a supported integrity algorithm that could be used.
Sourcepub fn set_supported_integrity(&mut self, integrity: IntegrityAlgorithm)
pub fn set_supported_integrity(&mut self, integrity: IntegrityAlgorithm)
Set the supported integrity algorithm used.
Sourcepub fn supported_integrity(&self) -> &[IntegrityAlgorithm]
pub fn supported_integrity(&self) -> &[IntegrityAlgorithm]
The supported integrity algorithms used.
Sourcepub fn set_anonymous_username(&mut self, anon: Feature)
pub fn set_anonymous_username(&mut self, anon: Feature)
Set whether anonymous username usage is required.
A value of Required requires the server to support RFC 8489 and the
Userhash attribute.
Sourcepub fn anonymous_username(&self) -> Feature
pub fn anonymous_username(&self) -> Feature
Whether anonymous username usage is required.
A value of Required requires the server to support RFC 8489 and the
Userhash attribute.
Trait Implementations§
Source§impl Clone for TurnConfig
impl Clone for TurnConfig
Source§fn clone(&self) -> TurnConfig
fn clone(&self) -> TurnConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more