ignore som interfaces
This commit is contained in:
parent
af3d258e50
commit
69bb639b76
@ -7,6 +7,8 @@ use sysinfo::System;
|
|||||||
use crate::{DISKS, NETWORKS, SYS};
|
use crate::{DISKS, NETWORKS, SYS};
|
||||||
use ffplayout_lib::utils::PlayoutConfig;
|
use ffplayout_lib::utils::PlayoutConfig;
|
||||||
|
|
||||||
|
const IGNORE_INTERFACES: [&str; 7] = ["docker", "lxdbr", "tab", "tun", "virbr", "veth", "vnet"];
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
pub struct Cpu {
|
pub struct Cpu {
|
||||||
pub cores: f32,
|
pub cores: f32,
|
||||||
@ -79,13 +81,19 @@ pub fn stat(config: PlayoutConfig) -> SystemStat {
|
|||||||
let mut interfaces = vec![];
|
let mut interfaces = vec![];
|
||||||
|
|
||||||
for (name, ip) in network_interfaces.iter() {
|
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.push((name, ip))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaces.dedup_by(|a, b| a.0 == b.0);
|
interfaces.dedup_by(|a, b| a.0 == b.0);
|
||||||
|
|
||||||
|
println!("---interfaces: {:?}", interfaces);
|
||||||
|
|
||||||
disks.refresh();
|
disks.refresh();
|
||||||
networks.refresh();
|
networks.refresh();
|
||||||
sys.refresh_cpu_usage();
|
sys.refresh_cpu_usage();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user