vortix 0.2.1

Terminal UI for WireGuard and OpenVPN with real-time telemetry and leak guarding
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Linux network statistics via `/proc/net/dev`.

use crate::constants;
use crate::core::telemetry::parse_proc_net_dev;
use crate::platform::NetworkStatsProvider;

/// Linux network stats from /proc/net/dev.
pub struct LinuxNetworkStats;

impl NetworkStatsProvider for LinuxNetworkStats {
    fn get_total_bytes() -> (u64, u64) {
        match std::fs::read_to_string(constants::PROC_NET_DEV_PATH) {
            Ok(content) => parse_proc_net_dev(&content),
            Err(_) => (0, 0),
        }
    }
}