summaryrefslogtreecommitdiffstats
path: root/src/os/lsof.rs
blob: aec444d9f38ddc719e1f93213993c13ed244de5b (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.proc_info)))
        .collect();

    OpenSockets { sockets_to_procs }
}