diff --git a/easytier-gui/locales/cn.yml b/easytier-gui/locales/cn.yml index 49633c3..bb66a04 100644 --- a/easytier-gui/locales/cn.yml +++ b/easytier-gui/locales/cn.yml @@ -13,6 +13,7 @@ proxy_cidrs: 子网代理CIDR enable_vpn_portal: 启用VPN门户 vpn_portal_listen_port: 监听端口 vpn_portal_client_network: 客户端子网 +dev_name: TUN接口名称 advanced_settings: 高级设置 basic_settings: 基础设置 listener_urls: 监听地址 @@ -45,6 +46,7 @@ enable_auto_launch: 开启开机自启 exit: 退出 chips_placeholder: 例如: {0}, 按回车添加 hostname_placeholder: '留空默认为主机名: {0}' +dev_name_placeholder: 注意:当多个网络同时使用相同的TUN接口名称时,将会在设置TUN的IP时产生冲突,留空以自动生成随机名称 off_text: 点击关闭 on_text: 点击开启 show_config: 显示配置 diff --git a/easytier-gui/locales/en.yml b/easytier-gui/locales/en.yml index 588b2a9..a0fe185 100644 --- a/easytier-gui/locales/en.yml +++ b/easytier-gui/locales/en.yml @@ -13,6 +13,7 @@ proxy_cidrs: Subnet Proxy CIDRs enable_vpn_portal: Enable VPN Portal vpn_portal_listen_port: VPN Portal Listen Port vpn_portal_client_network: Client Sub Network +dev_name: TUN interface name advanced_settings: Advanced Settings basic_settings: Basic Settings listener_urls: Listener URLs @@ -46,6 +47,7 @@ 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}' +dev_name_placeholder: 'Note: When multiple networks use the same TUN interface name at the same time, there will be a conflict when setting the TUN''s IP. Leave blank to automatically generate a random name.' off_text: Press to disable on_text: Press to enable show_config: Show Config diff --git a/easytier-gui/src-tauri/src/lib.rs b/easytier-gui/src-tauri/src/lib.rs index 08bbe0f..2433dbe 100644 --- a/easytier-gui/src-tauri/src/lib.rs +++ b/easytier-gui/src-tauri/src/lib.rs @@ -61,6 +61,8 @@ struct NetworkConfig { listener_urls: Vec, rpc_port: i32, latency_first: bool, + + dev_name: String, } impl NetworkConfig { @@ -163,6 +165,7 @@ impl NetworkConfig { } let mut flags = Flags::default(); flags.latency_first = self.latency_first; + flags.dev_name = self.dev_name.clone(); cfg.set_flags(flags); Ok(cfg) } diff --git a/easytier-gui/src/components/Config.vue b/easytier-gui/src/components/Config.vue index 4072bc8..6c008f7 100644 --- a/easytier-gui/src/components/Config.vue +++ b/easytier-gui/src/components/Config.vue @@ -174,7 +174,7 @@ onMounted(async () => { @@ -278,11 +278,21 @@ onMounted(async () => {
+ +
+
+ + +
+
diff --git a/easytier-gui/src/components/Status.vue b/easytier-gui/src/components/Status.vue index 5ec20ad..6bb4b70 100644 --- a/easytier-gui/src/components/Status.vue +++ b/easytier-gui/src/components/Status.vue @@ -131,8 +131,16 @@ const myNodeInfoChips = computed(() => { if (!my_node_info) return chips - // virtual ipv4 + // TUN Device Name + const dev_name = curNetworkInst.value.detail?.dev_name + if (dev_name) { + chips.push({ + label: `TUN Device Name: ${dev_name}`, + icon: '', + } as Chip) + } + // virtual ipv4 chips.push({ label: `Virtual IPv4: ${my_node_info.virtual_ipv4}`, icon: '', diff --git a/easytier-gui/src/types/network.ts b/easytier-gui/src/types/network.ts index 7a03398..4714f27 100644 --- a/easytier-gui/src/types/network.ts +++ b/easytier-gui/src/types/network.ts @@ -32,6 +32,8 @@ export interface NetworkConfig { listener_urls: string[] rpc_port: number latency_first: boolean + + dev_name: string } export function DEFAULT_NETWORK_CONFIG(): NetworkConfig { @@ -64,6 +66,7 @@ export function DEFAULT_NETWORK_CONFIG(): NetworkConfig { ], rpc_port: 0, latency_first: true, + dev_name: '', } } @@ -77,6 +80,7 @@ export interface NetworkInstance { } export interface NetworkInstanceRunningInfo { + dev_name: string my_node_info: NodeInfo events: Record node_info: NodeInfo diff --git a/easytier/src/launcher.rs b/easytier/src/launcher.rs index 1a2c35f..e0fe49e 100644 --- a/easytier/src/launcher.rs +++ b/easytier/src/launcher.rs @@ -267,6 +267,7 @@ impl Drop for EasyTierLauncher { #[derive(Deserialize, Serialize, Debug)] pub struct NetworkInstanceRunningInfo { + pub dev_name: String, pub my_node_info: MyNodeInfo, pub events: Vec<(DateTime, GlobalCtxEvent)>, pub node_info: MyNodeInfo, @@ -306,6 +307,7 @@ impl NetworkInstance { let peer_route_pairs = list_peer_route_pair(peers.clone(), routes.clone()); Some(NetworkInstanceRunningInfo { + dev_name: self.config.get_flags().dev_name.clone(), my_node_info: launcher.get_node_info(), events: launcher.get_events(), node_info: launcher.get_node_info(),