aboutsummaryrefslogtreecommitdiff
path: root/src/diplonat.rs
diff options
context:
space:
mode:
authorQuentin <quentin@dufour.io>2020-07-04 17:16:21 +0200
committerQuentin <quentin@dufour.io>2020-07-04 17:16:21 +0200
commit7ec74a21d4b90a2ee9c8f4a7ce90babbebef824a (patch)
tree1e4284195676f4586cd15cb4d3e1da03a9cd11b6 /src/diplonat.rs
parent5dd4544360906de246de9e33abbfd741681d2fea (diff)
parent4f4b6b048d53f3c4c9cc2437ba6bc6a9e70cb8c7 (diff)
downloaddiplonat-7ec74a21d4b90a2ee9c8f4a7ce90babbebef824a.tar.gz
diplonat-7ec74a21d4b90a2ee9c8f4a7ce90babbebef824a.zip
Merge pull request 'Automatically manage firewall rules (iptables) for services' (#1) from add-firewall-rules into master
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/diplonat/pulls/1
Diffstat (limited to 'src/diplonat.rs')
-rw-r--r--src/diplonat.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/diplonat.rs b/src/diplonat.rs
index 1be00f7..798b779 100644
--- a/src/diplonat.rs
+++ b/src/diplonat.rs
@@ -1,13 +1,14 @@
use anyhow::Result;
-use log::*;
use tokio::try_join;
use crate::consul_actor::ConsulActor;
use crate::igd_actor::IgdActor;
use crate::environment::Environment;
+use crate::fw_actor::FirewallActor;
pub struct Diplonat {
consul: ConsulActor,
- igd: IgdActor
+ igd: IgdActor,
+ firewall: FirewallActor
}
impl Diplonat {
@@ -21,9 +22,15 @@ impl Diplonat {
&ca.rx_open_ports
).await?;
+ let fw = FirewallActor::new(
+ env.refresh_time,
+ &ca.rx_open_ports
+ ).await?;
+
let ctx = Self {
consul: ca,
- igd: ia
+ igd: ia,
+ firewall: fw
};
return Ok(ctx);
@@ -32,7 +39,8 @@ impl Diplonat {
pub async fn listen(&mut self) -> Result<()> {
try_join!(
self.consul.listen(),
- self.igd.listen()
+ self.igd.listen(),
+ self.firewall.listen()
)?;
return Ok(());