blob: a67666270dc237e37a05e59c58736f6994c04a99 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
use igd::aio::search_gateway;
#[tokio::main]
async fn main() {
let gateway = match search_gateway(Default::default()).await {
Ok(g) => g,
Err(err) => return println!("Faild to find IGD: {}", err),
};
let pub_ip = match gateway.get_external_ip().await {
Ok(ip) => ip,
Err(err) => return println!("Failed to get external IP: {}", err),
};
println!("Our public IP is {}", pub_ip);
}
|