This commit is contained in:
2023-06-25 14:12:29 +02:00
parent d58c4599b3
commit 8e439a0e68

View File

@@ -75,21 +75,14 @@ async function vpnConnect(vpnName) {
const status = await execSync('nmcli connection show --active').toString().includes(vpnName);
if (!status) {
console.log('Not connected!');
consoleLog(`[${host}] Failed to connect to VPN: ${vpnName}. Retrying (attempt ${attempt} of ${maxAttempts})...`, 'error');
await sleep(1000);
}
else {
console.log('Connected!');
}
if (status == true) {
const ip = await get('https://api.ipify.org');
consoleLog(`[${host}] VPN connection successfully established to ${vpnName} (IP: ${ip.data}).`, 'info');
return 0;
}
else {
consoleLog(`[${host}] Failed to connect to VPN: ${vpnName}. Retrying (attempt ${attempt} of ${maxAttempts})...`, 'error');
await sleep(1000);
}
}
catch (error) {
consoleLog(`[${host}] Failed to connect to VPN: ${vpnName}. Retrying (attempt ${attempt} of ${maxAttempts})...`, 'error');