Skip to content

Commit

Permalink
feat(config): restrict flows to Paris and Dublin strategies (#1007)
Browse files Browse the repository at this point in the history
  • Loading branch information
fujiapple852 committed Feb 12, 2024
1 parent 559c97b commit 3ea259b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,16 @@ impl TrippyConfig {
Self::build_config(args, cfg_file, platform)
}

/// The maximum number of flows allowed.
///
/// This is restricted to 1 for the classic strategy.
pub fn max_flows(&self) -> usize {
match self.multipath_strategy {
MultipathStrategy::Classic => 1,
_ => self.tui_max_flows,
}
}

#[allow(clippy::too_many_lines)]
fn build_config(args: Args, cfg_file: ConfigFile, platform: &Platform) -> anyhow::Result<Self> {
let &Platform {
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ fn start_tracer(
tracer_config,
channel_config,
cfg.tui_max_samples,
cfg.tui_max_flows,
cfg.max_flows(),
);
let trace_data = backend.trace();
thread::Builder::new()
Expand Down Expand Up @@ -344,7 +344,7 @@ fn make_tui_config(args: &TrippyConfig) -> TuiConfig {
args.tui_geoip_mode,
args.tui_max_addrs,
args.tui_max_samples,
args.tui_max_flows,
args.max_flows(),
args.tui_theme,
&args.tui_bindings,
&args.tui_custom_columns,
Expand Down

0 comments on commit 3ea259b

Please sign in to comment.