pub struct HttpProvider { /* private fields */ }Expand description
HTTP provider configuration
Implementations§
Source§impl HttpProvider
impl HttpProvider
Sourcepub fn new(name: impl Into<String>, url: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, url: impl Into<String>) -> Self
Create a new HTTP provider (plain text response)
Sourcepub fn with_parser(self, parser: ResponseParser) -> Self
pub fn with_parser(self, parser: ResponseParser) -> Self
Set custom response parser
Sourcepub fn with_v6_url(self, url: impl Into<String>) -> Self
pub fn with_v6_url(self, url: impl Into<String>) -> Self
Set IPv6 URL
Sourcepub fn fetch_blocking(
&self,
version: IpVersion,
timeout: Duration,
) -> Result<IpAddr, ProviderError>
pub fn fetch_blocking( &self, version: IpVersion, timeout: Duration, ) -> Result<IpAddr, ProviderError>
Fetch IP from URL synchronously using reqwest blocking client with a timeout
Trait Implementations§
Source§impl BlockingProvider for HttpProvider
impl BlockingProvider for HttpProvider
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 HttpProvider
impl Clone for HttpProvider
Source§fn clone(&self) -> HttpProvider
fn clone(&self) -> HttpProvider
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 HttpProvider
impl Debug for HttpProvider
Source§impl Provider for HttpProvider
Available on crate feature tokio only.
impl Provider for HttpProvider
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 !RefUnwindSafe for HttpProvider
impl !UnwindSafe for HttpProvider
impl Freeze for HttpProvider
impl Send for HttpProvider
impl Sync for HttpProvider
impl Unpin for HttpProvider
impl UnsafeUnpin for HttpProvider
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