ignore som interfaces

This commit is contained in:
jb-alvarado 2024-01-31 21:31:21 +01:00
parent af3d258e50
commit 69bb639b76

View File

@ -7,6 +7,8 @@ use sysinfo::System;
use crate::{DISKS, NETWORKS, SYS};
use ffplayout_lib::utils::PlayoutConfig;
const IGNORE_INTERFACES: [&str; 7] = ["docker", "lxdbr", "tab", "tun", "virbr", "veth", "vnet"];
#[derive(Debug, Serialize)]
pub struct Cpu {
pub cores: f32,
@ -79,13 +81,19 @@ pub fn stat(config: PlayoutConfig) -> SystemStat {
let mut interfaces = vec![];
for (name, ip) in network_interfaces.iter() {
if !ip.is_loopback() {
if !ip.is_loopback()
&& !IGNORE_INTERFACES
.iter()
.any(|&prefix| name.starts_with(prefix))
{
interfaces.push((name, ip))
}
}
interfaces.dedup_by(|a, b| a.0 == b.0);
println!("---interfaces: {:?}", interfaces);
disks.refresh();
networks.refresh();
sys.refresh_cpu_usage();