diff options
author | darkgallium <florian+github@aloneinthedark.xyz> | 2020-07-04 16:59:41 +0200 |
---|---|---|
committer | darkgallium <florian+github@aloneinthedark.xyz> | 2020-07-04 17:01:27 +0200 |
commit | 4f4b6b048d53f3c4c9cc2437ba6bc6a9e70cb8c7 (patch) | |
tree | 1e4284195676f4586cd15cb4d3e1da03a9cd11b6 /src/fw_actor.rs | |
parent | a59ed3812151410c125f62f60b00aad673fd4c66 (diff) | |
download | diplonat-4f4b6b048d53f3c4c9cc2437ba6bc6a9e70cb8c7.tar.gz diplonat-4f4b6b048d53f3c4c9cc2437ba6bc6a9e70cb8c7.zip |
corrections after review
Diffstat (limited to 'src/fw_actor.rs')
-rw-r--r-- | src/fw_actor.rs | 8 |
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(()); } |