Roll back
This commit is contained in:
12
index.js
12
index.js
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user