1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
use std::{net::Ipv4Addr, path::PathBuf};
use clap::{Args, Parser};
use clap_verbosity_flag::{InfoLevel, Verbosity};
use derivative::Derivative;
#[derive(Clone, Debug, Derivative, Parser)]
#[derivative(Default)]
#[command(name = "bandwhich", version)]
pub struct Opt {
#[arg(short, long)]
/// The network interface to listen on, eg. eth0
pub interface: Option<String>,
#[arg(short, long)]
/// Machine friendlier output
pub raw: bool,
#[arg(short, long)]
/// Do not attempt to resolve IPs to their hostnames
pub no_resolve: bool,
#[arg(short, long)]
/// Show DNS queries
pub show_dns: bool,
#[arg(short, long)]
/// A dns server ip to use instead of the system default
pub dns_server: Option<Ipv4Addr>,
#[arg(long)]
/// Enable logging to a file
pub log_to: Option<PathBuf>,
#[command(flatten)]
#[derivative(Default(value = "Verbosity::new(0, 0)"))]
pub verbosity: Verbosity<InfoLevel>,
#[command(flatten)]
pub render_opts: RenderOpts,
}
#[derive(Copy, Clone, Debug, Default, Args)]
pub struct RenderOpts {
#[arg(short, long)]
/// Show processes table only
pub processes: bool,
#[arg(short, long)]
/// Show connections table only
pub connections: bool,
#[arg(short, long)]
/// Show remote addresses table only
pub addresses: bool,
#[arg(short, long)]
/// Show total (cumulative) usages
pub total_utilization: bool,
}
|