Roll back

This commit is contained in:
2023-06-25 16:01:28 +02:00
parent 0a4fa4072b
commit 912e501025

View File

@@ -1,7 +1,6 @@
const { execSync } = require('child_process');
const fs = require('node:fs');
const os = require('os');
const { publicIpv4 } = (...args) => import('public-ip').then(({ default: fth }) => fth(...args));
const host = os.hostname();
const args = process.argv.slice(2);
@@ -71,7 +70,16 @@ async function vpnConnect(vpnName) {
await sleep(1000);
}
else {
await consoleLog(`[${host}] VPN connection successfully established to ${vpnName} (IP: ${await publicIpv4()}).`, 'info');
const response = await fetch('https://api.ipify.org/?format=json', {
method: 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
});
const res = await response.json();
const ip = res.ip;
await consoleLog(`[${host}] VPN connection successfully established to ${vpnName} (IP: ${ip}).`, 'info');
return 0;
}
}