[][src]Struct stunclient::StunClient

pub struct StunClient {
    pub timeout: Duration,
    pub retry_interval: Duration,
    pub stun_server: SocketAddr,
    pub software: Option<&'static str>,
}

Options for querying STUN server

Fields

timeout: Duration

"End-to-end" timeout for the operation.

retry_interval: Duration

How often to repeat STUN binding requests

stun_server: SocketAddr

Address of the STUN server

software: Option<&'static str>

SOFTWARE attribute value in binding request

Methods

impl StunClient[src]

pub fn new(stun_server: SocketAddr) -> Self[src]

A constructor with default parameters

pub fn with_google_stun_server() -> Self[src]

Use hard coded STUN server stun.l.google.com:19302.

Not for production use, for tests, prototypes and demos. May block the thread. May panic if case of address resolution problems.

pub fn set_timeout(&mut self, timeout: Duration) -> &mut Self[src]

Set timeout field, builder pattern.

pub fn set_retry_interval(&mut self, retry_interval: Duration) -> &mut Self[src]

Set retry_interval field, builder pattern.

pub fn set_software(&mut self, software: Option<&'static str>) -> &mut Self[src]

Set software field, builder pattern.

impl StunClient[src]

pub fn query_external_address(
    &self,
    udp: &UdpSocket
) -> Result<SocketAddr, Error>
[src]

Get external (server-reflexive transport address) IP address and port of specified UDP socket

pub fn query_external_address_async(
    self,
    udp: UdpSocket
) -> impl Future<Item = (UdpSocket, SocketAddr), Error = Error>
[src]

async version of query_external_address.

Requires async crate feature to be enabled (it is by default)

Auto Trait Implementations

impl Send for StunClient

impl Sync for StunClient

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Erased for T