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.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/fw_actor.rs b/src/fw_actor.rs
index 523bdaa..b5e4c7e 100644
--- a/src/fw_actor.rs
+++ b/src/fw_actor.rs
@@ -23,13 +23,13 @@ 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(),
+ ipt: iptables::new(false)?,
rx_ports: rxp.clone(),
last_ports: messages::PublicExposedPorts::new(),
refresh: _refresh,
};
- fw::setup(&ctx.ipt).expect("iptables setup failed");
+ fw::setup(&ctx.ipt)?;
return Ok(ctx);
}
@@ -56,7 +56,7 @@ impl FirewallActor {
}
pub async fn do_fw_update(&self) -> Result<()> {
- let curr_opened_ports = fw::get_opened_ports(&self.ipt).unwrap();
+ let curr_opened_ports = fw::get_opened_ports(&self.ipt)?;
let diff_tcp = self.last_ports.tcp_ports.difference(&curr_opened_ports.tcp_ports).copied().collect::<HashSet<u16>>();
let diff_udp = self.last_ports.udp_ports.difference(&curr_opened_ports.udp_ports).copied().collect::<HashSet<u16>>();
@@ -66,7 +66,7 @@ impl FirewallActor {
udp_ports: diff_udp
};
- fw::open_ports(&self.ipt, ports_to_open).unwrap();
+ fw::open_ports(&self.ipt, ports_to_open)?;
return Ok(());
}