diff options
author | Quentin <quentin@deuxfleurs.fr> | 2020-02-09 21:23:32 +0100 |
---|---|---|
committer | Quentin <quentin@deuxfleurs.fr> | 2020-02-09 21:23:32 +0100 |
commit | 94ac5b58a1b5f07fb824d43b9a2de43c74d4f3c6 (patch) | |
tree | fd46cd8aaa0fe5b7ff8a3eb47f03ae7a10af5587 /docker/diplomate/src | |
parent | 96c6da392fc3236754c273a299728ad0360b3d51 (diff) | |
download | infrastructure-94ac5b58a1b5f07fb824d43b9a2de43c74d4f3c6.tar.gz infrastructure-94ac5b58a1b5f07fb824d43b9a2de43c74d4f3c6.zip |
[diplomate] We can get our public IP address!
Diffstat (limited to 'docker/diplomate/src')
-rw-r--r-- | docker/diplomate/src/main.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/docker/diplomate/src/main.rs b/docker/diplomate/src/main.rs index e7a11a9..24d9ec1 100644 --- a/docker/diplomate/src/main.rs +++ b/docker/diplomate/src/main.rs @@ -1,3 +1,14 @@ -fn main() { - println!("Hello, world!"); +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); } |