Skip to content

Commit

Permalink
Sqaushed the 4 commits
Browse files Browse the repository at this point in the history
  • Loading branch information
trkelly23 committed Nov 13, 2023
1 parent f6e82dc commit 24e953e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,10 @@ impl TryFrom<(Args, &Platform)> for TrippyConfig {
constants::DEFAULT_REPORT_CYCLES,
);
let geoip_mmdb_file = cfg_layer_opt(args.geoip_mmdb_file, cfg_file_tui.geoip_mmdb_file);
let protocol = match (args.udp, args.tcp, protocol) {
(false, false, Protocol::Icmp) => TracerProtocol::Icmp,
(false, false, Protocol::Udp) | (true, _, _) => TracerProtocol::Udp,
(false, false, Protocol::Tcp) | (_, true, _) => TracerProtocol::Tcp,
let protocol = match (args.udp, args.tcp, args.icmp, protocol) {
(false, false, false, Protocol::Udp) | (true, _, _, _) => TracerProtocol::Udp,
(false, false, false, Protocol::Tcp) | (_, true, _, _) => TracerProtocol::Tcp,
(false, false, false, Protocol::Icmp) | (_, _, true, _) => TracerProtocol::Icmp,
};
let read_timeout = humantime::parse_duration(&read_timeout)?;
let min_round_duration = humantime::parse_duration(&min_round_duration)?;
Expand Down
23 changes: 21 additions & 2 deletions src/config/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,32 @@ pub struct Args {
pub protocol: Option<Protocol>,

/// Trace using the UDP protocol
#[arg(long, conflicts_with = "protocol", conflicts_with = "tcp")]
#[arg(
long,
conflicts_with = "protocol",
conflicts_with = "tcp",
conflicts_with = "icmp"
)]
pub udp: bool,

/// Trace using the TCP protocol
#[arg(long, conflicts_with = "protocol", conflicts_with = "udp")]
#[arg(
long,
conflicts_with = "protocol",
conflicts_with = "udp",
conflicts_with = "icmp"
)]
pub tcp: bool,

/// Trace using the ICMP protocol
#[arg(
long,
conflicts_with = "protocol",
conflicts_with = "udp",
conflicts_with = "tcp"
)]
pub icmp: bool,

/// Use IPv4 only
#[arg(short = '4', long, conflicts_with = "ipv6")]
pub ipv4: bool,
Expand Down

0 comments on commit 24e953e

Please sign in to comment.