From 0ea9528b70b13462eadcf5204847e21623efff09 Mon Sep 17 00:00:00 2001 From: ezequielnick <107352853+ezequielnick@users.noreply.github.com> Date: Wed, 13 Aug 2025 10:34:35 +0800 Subject: [PATCH] feat: set default tun device name on macos (configurable) --- changelog.md | 2 ++ src/main/utils/template.ts | 2 +- src/renderer/src/pages/tun.tsx | 25 ++++++++++++------------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/changelog.md b/changelog.md index 9127e8a..c0905b9 100644 --- a/changelog.md +++ b/changelog.md @@ -4,10 +4,12 @@ - 如果当前没有以管理员模式运行,TUN 开关保持关闭 - 区分 app 日志与 core 日志输出为不同文件 - 完善内核权限鉴别,上一个内核以管理员模式启动的时候,弹出提示 +- 修改 MacOS 默认虚拟网卡名称为 utun1500,可自定义 ### 修复 (Fix) - 修复某些系统下的悬浮窗开启崩溃的问题(开启兼容模式=关闭硬件加速) - 开机自启在非管理员模式下报错的问题 +- 解决某些 macos 系统下无法开启虚拟网卡的问题(tun device名称冲突) ## 1.8.3 **本次更新移除了 Windows 下启动必须管理员模式的机制,改为只在启用虚拟网卡模式的时候,申请 UAC 权限重启软件,安全性更好,更灵活,给无法使用管理员模式运行软件的企业用户提供了更大的便利** diff --git a/src/main/utils/template.ts b/src/main/utils/template.ts index bc4798e..b05c87b 100644 --- a/src/main/utils/template.ts +++ b/src/main/utils/template.ts @@ -67,7 +67,7 @@ export const defaultControledMihomoConfig: Partial = { 'skip-auth-prefixes': ['127.0.0.1/32'], tun: { enable: false, - device: 'Mihomo', + device: process.platform === 'darwin' ? 'utun1500' : 'Mihomo', stack: 'mixed', 'auto-route': true, 'auto-redirect': false, diff --git a/src/renderer/src/pages/tun.tsx b/src/renderer/src/pages/tun.tsx index 9e036a6..1fde5f0 100644 --- a/src/renderer/src/pages/tun.tsx +++ b/src/renderer/src/pages/tun.tsx @@ -18,7 +18,7 @@ const Tun: React.FC = () => { const { tun } = controledMihomoConfig || {} const [loading, setLoading] = useState(false) const { - device = 'Mihomo', + device = platform === 'darwin' ? 'utun1500' : 'Mihomo', stack = 'mixed', 'auto-route': autoRoute = true, 'auto-redirect': autoRedirect = false, @@ -165,18 +165,17 @@ const Tun: React.FC = () => { - {platform !== 'darwin' && ( - - { - setValues({ ...values, device: v }) - }} - /> - - )} + + { + setValues({ ...values, device: v }) + }} + /> +