pub struct StunClienteBuilder(/* private fields */);
Expand description
Builder for the STUN client. It allows to configure the client with the required parameters for the STUN usage.
// Next example shows how to create a STUN client that uses
// long-term credentials to authenticate with the server over
// an unreliable transport and mandates the use of the FINGERPRINT
// attribute.
let client = StunClienteBuilder::new(
TransportReliability::Unreliable(RttConfig::default()))
.with_mechanism("user", "password", CredentialMechanism::LongTerm)
.with_fingerprint()
.build()?;
Implementations§
Source§impl StunClienteBuilder
impl StunClienteBuilder
Sourcepub fn new(reliability: TransportReliability) -> StunClienteBuilder
pub fn new(reliability: TransportReliability) -> StunClienteBuilder
Creates a new STUN client builder with the given TransportReliability
.
Sourcepub fn with_max_transactions(self, max_transactions: usize) -> Self
pub fn with_max_transactions(self, max_transactions: usize) -> Self
Sets the maximum number of outstanding transactions to the same server. The default value is 10.
Sourcepub fn with_mechanism<U, P>(
self,
user_name: U,
password: P,
mechanism: CredentialMechanism,
) -> Self
pub fn with_mechanism<U, P>( self, user_name: U, password: P, mechanism: CredentialMechanism, ) -> Self
Sets the credentials for the STUN client.
Sourcepub fn with_fingerprint(self) -> Self
pub fn with_fingerprint(self) -> Self
Sets the use of the FINGERPRINT attribute in the STUN messages. The
FINGERPRINT mechanism is not backwards compatible with
RFC3489
and
cannot be used in environments where such compatibility is required.
Sourcepub fn build(self) -> Result<StunClient, StunAgentError>
pub fn build(self) -> Result<StunClient, StunAgentError>
Builds the STUN client with the given parameters.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StunClienteBuilder
impl RefUnwindSafe for StunClienteBuilder
impl Send for StunClienteBuilder
impl Sync for StunClienteBuilder
impl Unpin for StunClienteBuilder
impl UnwindSafe for StunClienteBuilder
Blanket Implementations§
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
Mutably borrows from an owned value. Read more