pub(crate) mod packet_loss;
pub(crate) mod rpm;
pub(crate) mod saturate;
pub(crate) mod up_down;
use crate::nq_core::ConnectionType;
use clap::{Parser, Subcommand, ValueEnum};
use packet_loss::PacketLossArgs;
use crate::args::rpm::RpmArgs;
use crate::args::saturate::SaturateArgs;
use crate::args::up_down::{DownloadArgs, UploadArgs};
#[derive(Debug, Parser)]
#[command(version, about, long_about = None)]
pub struct Cli {
#[command(flatten)]
pub verbosity: clap_verbosity_flag::Verbosity,
#[clap(subcommand)]
pub command: Option<Command>,
}
#[derive(Debug, Subcommand)]
pub enum Command {
Rpm(RpmArgs),
Download(DownloadArgs),
Upload(UploadArgs),
Rtt {
#[clap(default_value = "https://h3.speed.cloudflare.com/__down?bytes=10")]
#[clap(short, long)]
url: String,
#[clap(default_value = "20")]
#[clap(short, long)]
runs: usize,
},
PacketLoss(PacketLossArgs),
Saturate(SaturateArgs),
}
#[derive(Debug, Clone, ValueEnum)]
pub enum ConnType {
H1ClearText,
H1,
H2,
H3,
}
impl From<ConnType> for ConnectionType {
fn from(conn_type: ConnType) -> Self {
match conn_type {
ConnType::H1ClearText => ConnectionType::H1 { use_tls: false },
ConnType::H1 => ConnectionType::H1 { use_tls: true },
ConnType::H2 => ConnectionType::H2,
ConnType::H3 => ConnectionType::H3,
}
}
}