From 99c47813c342a6fbc68159ea7c2d3e25d7d1a73f Mon Sep 17 00:00:00 2001 From: Jiangqiu Shen Date: Wed, 18 Sep 2024 15:49:56 -0400 Subject: [PATCH] add the options to enable latency first or not in the old behavior, the flags is not set, and it will be generated as default value in the first read. so the default value for the latency_first will be set to true according to the Default settings to Flag. so the Vue code init the latency first to true. --- easytier-gui/locales/cn.yml | 1 + easytier-gui/locales/en.yml | 2 +- easytier-gui/src-tauri/src/lib.rs | 7 +++++-- easytier-gui/src/components/Config.vue | 9 +++++++++ easytier-gui/src/types/network.ts | 2 ++ 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/easytier-gui/locales/cn.yml b/easytier-gui/locales/cn.yml index 6a7fcd70..49633c35 100644 --- a/easytier-gui/locales/cn.yml +++ b/easytier-gui/locales/cn.yml @@ -50,6 +50,7 @@ on_text: 点击开启 show_config: 显示配置 close: 关闭 +use_latency_first: 延迟优先模式 my_node_info: 当前节点信息 peer_count: 已连接 upload: 上传 diff --git a/easytier-gui/locales/en.yml b/easytier-gui/locales/en.yml index f4ddd9a5..588b2a9e 100644 --- a/easytier-gui/locales/en.yml +++ b/easytier-gui/locales/en.yml @@ -43,7 +43,7 @@ logging_copy_dir: Copy Log Path disable_auto_launch: Disable Launch on Reboot enable_auto_launch: Enable Launch on Reboot exit: Exit - +use_latency_first: Latency First Mode chips_placeholder: 'e.g: {0}, press Enter to add' hostname_placeholder: 'Leave blank and default to host name: {0}' off_text: Press to disable diff --git a/easytier-gui/src-tauri/src/lib.rs b/easytier-gui/src-tauri/src/lib.rs index 26067d4b..08bbe0f4 100644 --- a/easytier-gui/src-tauri/src/lib.rs +++ b/easytier-gui/src-tauri/src/lib.rs @@ -7,7 +7,7 @@ use anyhow::Context; use dashmap::DashMap; use easytier::{ common::config::{ - ConfigLoader, FileLoggerConfig, NetworkIdentity, PeerConfig, TomlConfigLoader, + ConfigLoader, FileLoggerConfig, Flags, NetworkIdentity, PeerConfig, TomlConfigLoader, VpnPortalConfig, }, launcher::{NetworkInstance, NetworkInstanceRunningInfo}, @@ -60,6 +60,7 @@ struct NetworkConfig { listener_urls: Vec, rpc_port: i32, + latency_first: bool, } impl NetworkConfig { @@ -160,7 +161,9 @@ impl NetworkConfig { })?, }); } - + let mut flags = Flags::default(); + flags.latency_first = self.latency_first; + cfg.set_flags(flags); Ok(cfg) } } diff --git a/easytier-gui/src/components/Config.vue b/easytier-gui/src/components/Config.vue index 67854fcb..4072bc8e 100644 --- a/easytier-gui/src/components/Config.vue +++ b/easytier-gui/src/components/Config.vue @@ -205,6 +205,15 @@ onMounted(async () => {
+
+
+
+ + +
+
+
+
diff --git a/easytier-gui/src/types/network.ts b/easytier-gui/src/types/network.ts index 17cb6ef2..7a033982 100644 --- a/easytier-gui/src/types/network.ts +++ b/easytier-gui/src/types/network.ts @@ -31,6 +31,7 @@ export interface NetworkConfig { listener_urls: string[] rpc_port: number + latency_first: boolean } export function DEFAULT_NETWORK_CONFIG(): NetworkConfig { @@ -62,6 +63,7 @@ export function DEFAULT_NETWORK_CONFIG(): NetworkConfig { 'wg://0.0.0.0:11011', ], rpc_port: 0, + latency_first: true, } }