summaryrefslogtreecommitdiffstats
path: root/src/os/lsof.rs
blob: 088d9cfd4e19ba8ca05c9043961d22068dcf22ac (plain)
1
2
3
4
5
6
7
8
9
use crate::{os::lsof_utils::get_connections, OpenSockets};

pub(crate) fn get_open_sockets() -> OpenSockets {
    let sockets_to_procs = get_connections()
        .filter_map(|raw| raw.as_local_socket().map(|s| (s, raw.process_name)))
        .collect();

    OpenSockets { sockets_to_procs }
}