Skip to content

Commit

Permalink
fix(tui): add missing tui-icmp-extension-mode to settings dialog (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
fujiapple852 committed Aug 21, 2024
1 parent 65b65aa commit 23e6ca4
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions crates/trippy-tui/src/frontend/render/settings.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::config::{AddressMode, AsMode, GeoIpMode};
use crate::config::{AddressMode, AsMode, GeoIpMode, IcmpExtensionMode};
use crate::frontend::render::util;
use crate::frontend::theme;
use crate::frontend::tui_app::TuiApp;
Expand Down Expand Up @@ -178,6 +178,10 @@ fn format_tui_settings(app: &TuiApp) -> Vec<SettingsItem> {
format_address_mode(app.tui_config.address_mode),
),
SettingsItem::new("tui-as-mode", format_as_mode(app.tui_config.as_mode)),
SettingsItem::new(
"tui-icmp-extension-mode",
format_extension_mode(app.tui_config.icmp_extension_mode),
),
SettingsItem::new(
"tui-geoip-mode",
format_geoip_mode(app.tui_config.geoip_mode),
Expand Down Expand Up @@ -495,7 +499,7 @@ pub const SETTINGS_TAB_COLUMNS: usize = 6;

/// The name and number of items for each tabs in the setting dialog.
pub const SETTINGS_TABS: [(&str, usize); 7] = [
("Tui", 8),
("Tui", 9),
("Trace", 17),
("Dns", 5),
("GeoIp", 1),
Expand Down Expand Up @@ -537,6 +541,15 @@ fn format_dns_method(resolve_method: ResolveMethod) -> String {
}
}

fn format_extension_mode(icmp_extension_mode: IcmpExtensionMode) -> String {
match icmp_extension_mode {
IcmpExtensionMode::Off => "off".to_string(),
IcmpExtensionMode::Mpls => "mpls".to_string(),
IcmpExtensionMode::Full => "full".to_string(),
IcmpExtensionMode::All => "all".to_string(),
}
}

/// Format the `AsMode`.
fn format_as_mode(as_mode: AsMode) -> String {
match as_mode {
Expand Down

0 comments on commit 23e6ca4

Please sign in to comment.