aboutsummaryrefslogtreecommitdiff
path: root/src/fw_actor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/fw_actor.rs')
-rw-r--r--src/fw_actor.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/fw_actor.rs b/src/fw_actor.rs
index 0ef08eb..523bdaa 100644
--- a/src/fw_actor.rs
+++ b/src/fw_actor.rs
@@ -1,8 +1,4 @@
-use igd::aio::*;
-use igd::PortMappingProtocol;
-use std::net::SocketAddrV4;
-use log::*;
-use anyhow::{Result, Context};
+use anyhow::Result;
use tokio::{
select,
sync::watch,
@@ -10,6 +6,7 @@ use tokio::{
self,
Duration
}};
+use log::*;
use iptables;
use crate::messages;
@@ -17,7 +14,7 @@ use crate::fw;
use std::collections::HashSet;
pub struct FirewallActor {
- ipt: iptables::IPTables,
+ pub ipt: iptables::IPTables,
rx_ports: watch::Receiver<messages::PublicExposedPorts>,
last_ports: messages::PublicExposedPorts,
refresh: Duration
@@ -25,8 +22,6 @@ pub struct FirewallActor {
impl FirewallActor {
pub async fn new(_refresh: Duration, rxp: &watch::Receiver<messages::PublicExposedPorts>) -> Result<Self> {
-
-
let ctx = Self {
ipt: iptables::new(false).unwrap(),
rx_ports: rxp.clone(),
@@ -61,7 +56,6 @@ impl FirewallActor {
}
pub async fn do_fw_update(&self) -> Result<()> {
-
let curr_opened_ports = fw::get_opened_ports(&self.ipt).unwrap();
let diff_tcp = self.last_ports.tcp_ports.difference(&curr_opened_ports.tcp_ports).copied().collect::<HashSet<u16>>();