diff --git a/src/martillo_maldito.rs b/src/martillo_maldito.rs index 4a8d0ef..a98a4c3 100644 --- a/src/martillo_maldito.rs +++ b/src/martillo_maldito.rs @@ -109,6 +109,10 @@ impl MartilloMaldito { self.append_unique("filter", &format!("-s {} -j DROP", ip)) } + pub fn unban_ip(&self, ip: &str) -> Result<(), Box> { + self.remove_unique("filter", &format!("-s {} -j DROP", ip)) + } + pub fn secure_port( &self, port: u16, @@ -169,6 +173,10 @@ impl MartilloMaldito { self.iptables.append_unique(table, &self.chain, rule) } + fn remove_unique(&self, table: &str, rule: &str) -> Result<(), Box> { + self.iptables.delete(table, &self.chain, rule) + } + fn insert_unique( &self, table: &str,