(keepProxy = false)
| 920 | } |
| 921 | |
| 922 | function stopV2ray(keepProxy = false) { |
| 923 | // Clear ping interval when disconnecting |
| 924 | if (pingInterval) { |
| 925 | clearInterval(pingInterval); |
| 926 | pingInterval = null; |
| 927 | } |
| 928 | |
| 929 | if (v2rayProcess) { |
| 930 | // Disable system proxy before killing the process, unless we're keeping it |
| 931 | if (!keepProxy) { |
| 932 | disableSystemProxy(); |
| 933 | } |
| 934 | |
| 935 | v2rayProcess.kill(); |
| 936 | v2rayProcess = null; |
| 937 | isConnected = false; |
| 938 | if (win) { |
| 939 | win.webContents.send('connection-status', false); |
| 940 | } |
| 941 | } |
| 942 | } |
| 943 | |
| 944 | // Add a function to switch servers without full disconnect/connect cycle |
| 945 | function switchServer(newConfigIndex) { |
no test coverage detected