From 9c7fddf4e4bc484f3f63bf79e82d8f4c7abbb67c Mon Sep 17 00:00:00 2001 From: Valeriy Manzhos <47538801+InvisibleRain@users.noreply.github.com> Date: Wed, 8 Apr 2026 18:43:42 +0300 Subject: [PATCH] Bind the TUN toggle button to starting/stoppping hev-socsk5-tunnel --- v2rayN/ServiceLib/Manager/CoreManager.cs | 6 ++++++ v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/v2rayN/ServiceLib/Manager/CoreManager.cs b/v2rayN/ServiceLib/Manager/CoreManager.cs index 724bf411..db382685 100644 --- a/v2rayN/ServiceLib/Manager/CoreManager.cs +++ b/v2rayN/ServiceLib/Manager/CoreManager.cs @@ -88,6 +88,12 @@ public class CoreManager await WindowsUtils.RemoveTunDevice(); } + if (Utils.IsLinux() && !_config.TunModeItem.EnableTun) + { + await DeleteTUNRoutes(); + await KillTUNProcess(); + } + await CoreStart(mainContext); await CoreStartPreService(preContext); diff --git a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs index b8154c16..c794d4ed 100644 --- a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs @@ -480,6 +480,10 @@ public class StatusBarViewModel : MyReactiveObject await AppManager.Instance.RebootAsAdmin(); return; } + else if (Utils.IsLinux()) { + await CoreManager.StartTUNProcess(); + await CoreManager.CreateTUNRoutes(); + } else { bool? passwordResult = await _updateView?.Invoke(EViewAction.PasswordInput, null); @@ -502,7 +506,7 @@ public class StatusBarViewModel : MyReactiveObject } else if (Utils.IsLinux()) { - return AppManager.Instance.LinuxSudoPwd.IsNotEmpty(); + return false; } else if (Utils.IsMacOS()) {