Fix ip check
This commit is contained in:
7
index.js
7
index.js
@@ -70,16 +70,15 @@ async function vpnConnect(vpnName) {
|
|||||||
await sleep(1000);
|
await sleep(1000);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const response = await fetch('https://api.ipify.org', {
|
const response = await fetch('https://api.ipify.org/?format=json', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
const res = await response.json();
|
||||||
console.log(response.json());
|
const ip = res.data.ip;
|
||||||
const ip = await response.json();
|
|
||||||
consoleLog(`[${host}] VPN connection successfully established to ${vpnName} (IP: ${ip.data}).`, 'info');
|
consoleLog(`[${host}] VPN connection successfully established to ${vpnName} (IP: ${ip.data}).`, 'info');
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user