mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
udp: statistics: print only for active protocols
This commit is contained in:
parent
f68bbff700
commit
f001c69dc7
1 changed files with 11 additions and 5 deletions
|
|
@ -5,17 +5,23 @@ use crate::common::*;
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
|
|
||||||
pub fn run_statistics_worker(config: Config, state: State) {
|
pub fn run_statistics_worker(config: Config, state: State) {
|
||||||
|
let ipv4_active = config.network.address.is_ipv4() || !config.network.only_ipv6;
|
||||||
|
let ipv6_active = config.network.address.is_ipv6();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
::std::thread::sleep(Duration::from_secs(config.statistics.interval));
|
::std::thread::sleep(Duration::from_secs(config.statistics.interval));
|
||||||
|
|
||||||
println!("General:");
|
println!("General:");
|
||||||
println!(" access list entries: {}", state.access_list.load().len());
|
println!(" access list entries: {}", state.access_list.load().len());
|
||||||
|
|
||||||
println!("IPv4:");
|
if ipv4_active {
|
||||||
gather_and_print_for_protocol(&config, &state.statistics_ipv4);
|
println!("IPv4:");
|
||||||
|
gather_and_print_for_protocol(&config, &state.statistics_ipv4);
|
||||||
println!("IPv6:");
|
}
|
||||||
gather_and_print_for_protocol(&config, &state.statistics_ipv6);
|
if ipv6_active {
|
||||||
|
println!("IPv6:");
|
||||||
|
gather_and_print_for_protocol(&config, &state.statistics_ipv6);
|
||||||
|
}
|
||||||
|
|
||||||
println!();
|
println!();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue