aboutsummaryrefslogtreecommitdiff
path: root/src/igd_actor.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2020-05-22 18:41:13 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2020-05-22 18:41:13 +0200
commite1d0eadb9dc5e2e3bea8bc48f7b33ad9ef632554 (patch)
treed1e891b87684c7907ff1245ebd5ad403804f6fd9 /src/igd_actor.rs
parentdeeecd93e1fc5545e6e0280d1799436638e84a38 (diff)
downloaddiplonat-e1d0eadb9dc5e2e3bea8bc48f7b33ad9ef632554.tar.gz
diplonat-e1d0eadb9dc5e2e3bea8bc48f7b33ad9ef632554.zip
WIP software
Diffstat (limited to 'src/igd_actor.rs')
-rw-r--r--src/igd_actor.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/igd_actor.rs b/src/igd_actor.rs
new file mode 100644
index 0000000..6624ab3
--- /dev/null
+++ b/src/igd_actor.rs
@@ -0,0 +1,31 @@
+use igd::aio::*;
+use log::*;
+use tokio::sync::broadcast;
+use anyhow::{Result, Context};
+use std::cell::Cell;
+
+use crate::diplonat::*;
+use crate::node_state::*;
+
+pub struct IgdAdapter<'a> {
+ state: &'a Cell<NodeState>,
+ gateway: Gateway,
+}
+impl<'a> IgdAdapter<'a> {
+ pub async fn new(ns: &'a Cell<NodeState>, send: &broadcast::Sender<()>) -> Result<IgdAdapter<'a>> {
+ let gw = search_gateway(Default::default())
+ .await
+ .context("Failed to find gateway")?;
+ info!("Gateway: {}", gw);
+
+ let ctx = Self {
+ state: ns,
+ gateway: gw
+ };
+ return Ok(ctx);
+ }
+
+ fn run(&self) -> Result<()> {
+ return Ok(());
+ }
+}