pub struct StunProvider { /* private fields */ }Expand description
STUN provider for IP detection
Implementations§
Source§impl StunProvider
impl StunProvider
Sourcepub fn new(
name: impl Into<String>,
server: impl Into<String>,
port: u16,
) -> Self
pub fn new( name: impl Into<String>, server: impl Into<String>, port: u16, ) -> Self
Create a new STUN provider
Sourcepub fn binding_request_blocking(
&self,
version: IpVersion,
timeout: Duration,
) -> Result<IpAddr, ProviderError>
pub fn binding_request_blocking( &self, version: IpVersion, timeout: Duration, ) -> Result<IpAddr, ProviderError>
Perform STUN binding request synchronously using standard UDP sockets with a timeout
Trait Implementations§
Source§impl BlockingProvider for StunProvider
impl BlockingProvider for StunProvider
Source§fn supports_v4(&self) -> bool
fn supports_v4(&self) -> bool
Whether this provider supports IPv4
Source§fn supports_v6(&self) -> bool
fn supports_v6(&self) -> bool
Whether this provider supports IPv6
Source§fn get_ip(
&self,
version: IpVersion,
timeout: Duration,
) -> Result<IpAddr, ProviderError>
fn get_ip( &self, version: IpVersion, timeout: Duration, ) -> Result<IpAddr, ProviderError>
Get the public IP address synchronously with the given timeout. Read more
Source§fn clone_box(&self) -> BoxedBlockingProvider
fn clone_box(&self) -> BoxedBlockingProvider
Clone this provider into a boxed trait object
Source§fn supports_version(&self, version: IpVersion) -> bool
fn supports_version(&self, version: IpVersion) -> bool
Check if provider supports the given IP version
Source§impl Clone for StunProvider
impl Clone for StunProvider
Source§fn clone(&self) -> StunProvider
fn clone(&self) -> StunProvider
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StunProvider
impl Debug for StunProvider
Source§impl Provider for StunProvider
Available on crate feature tokio only.
impl Provider for StunProvider
Available on crate feature
tokio only.Source§fn supports_v4(&self) -> bool
fn supports_v4(&self) -> bool
Whether this provider supports IPv4
Source§fn supports_v6(&self) -> bool
fn supports_v6(&self) -> bool
Whether this provider supports IPv6
Source§fn get_ip(
&self,
version: IpVersion,
) -> Pin<Box<dyn Future<Output = Result<IpAddr, ProviderError>> + Send + '_>>
fn get_ip( &self, version: IpVersion, ) -> Pin<Box<dyn Future<Output = Result<IpAddr, ProviderError>> + Send + '_>>
Get the public IP address asynchronously
Source§fn supports_version(&self, version: IpVersion) -> bool
fn supports_version(&self, version: IpVersion) -> bool
Check if provider supports the given IP version
Auto Trait Implementations§
impl Freeze for StunProvider
impl RefUnwindSafe for StunProvider
impl Send for StunProvider
impl Sync for StunProvider
impl Unpin for StunProvider
impl UnsafeUnpin for StunProvider
impl UnwindSafe for StunProvider
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