Crate socket_filter

source
Expand description

§socket_filter

socket_filter is a library to monitor the network traffic of a network interface. By passing a list of interface names to this library, it will attach to the interfaces and monitor the network traffic of the interfaces.

§Example

pub fn main() -> Result<(), Box<dyn std::error::Error>> {
    let socket_filter = socket_filter::TransmitCounter::new(socket_filter::IGNORED_IFACE)?;
    loop {
        println!(
            "current bytes: {} {}",
            socket_filter.get_egress(),
            socket_filter.get_ingress()
        );
        std::thread::sleep(std::time::Duration::from_secs(1));
    }
}

Structs§

Constants§