aboutsummaryrefslogtreecommitdiff
path: root/src/gw.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/gw.rs')
-rw-r--r--src/gw.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gw.rs b/src/gw.rs
new file mode 100644
index 0000000..f716a3f
--- /dev/null
+++ b/src/gw.rs
@@ -0,0 +1,13 @@
+use igd::aio::Gateway;
+use igd::aio::search_gateway;
+use anyhow::{Result, Context};
+use log::*;
+
+pub async fn get_gateway() -> Result<igd::aio::Gateway> {
+ let gw = search_gateway(Default::default())
+ .await
+ .context("Failed to find gateway")?;
+
+ info!("Gateway: {}", gw);
+ return Ok(gw);
+}