add is_blocked method to Firewall

This commit is contained in:
2025-12-12 03:52:40 -05:00
committed by Sapphire
parent 50b5388f8a
commit e0a5821431
+6
View File
@@ -62,6 +62,12 @@ impl Firewall {
unsafe { rules.Remove(&BSTR::from(name)) }?;
Ok(())
}
pub fn is_blocked(&self, name: &str) -> Result<bool, Box<dyn Error>> {
let rules = unsafe { self.policy.Rules() }?;
let rule_exists = unsafe { rules.Item(&BSTR::from(name)) }.is_ok();
Ok(rule_exists)
}
}
pub enum RuleMode {