ufwctl 0.1.0

Linux-only Rust library for managing UFW firewall rules
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use ufwctl::Firewall;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let fw = Firewall::new();

    println!("Installed: {}", fw.is_installed()?);
    println!("Enabled: {}", fw.is_enabled()?);

    fw.port(5050).allow().tcp().apply()?;

    let status = fw.port(5050).status().tcp()?;

    println!("Port 5050 TCP status: {status:?}");

    Ok(())
}