Expand description
Synchronous, blocking IP detection engine.
This module provides a zero-runtime-dependency synchronous API for resolving public IP addresses using standard library UDP sockets and threads.
Blocking calls return when their configured deadline is reached. Providers
are executed on worker threads so a non-cooperative custom provider cannot
block the caller indefinitely. Such provider code cannot be forcibly
cancelled and may finish later in the background, so custom providers should
still honor the timeout passed to BlockingProvider::get_ip.
§Examples
use ip_discovery::blocking::{get_ip, get_ipv4};
// Get any public IP
if let Ok(result) = get_ip() {
println!("Public IP: {} (via {})", result.ip, result.provider);
}
// Get IPv4 specifically
if let Ok(result) = get_ipv4() {
println!("IPv4: {}", result.ip);
}Structs§
- Resolver
- Coordinates synchronous IP detection across configured providers.
Functions§
- get_ip
- Get public IP address synchronously using default configuration.
- get_
ip_ with - Get public IP address synchronously with a custom
Config. - get_
ipv4 - Get public IPv4 address synchronously using default configuration.
- get_
ipv6 - Get public IPv6 address synchronously using default configuration.