This repository has been archived on 2024-01-16. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Maneger/scripts/external_ip.js

20 lines
713 B
JavaScript
Raw Normal View History

2021-06-11 17:13:40 -03:00
// External User ip
2021-07-10 00:36:20 -03:00
const fetchSync = require("@the-bds-maneger/fetchsync");
2021-06-23 22:04:06 -03:00
const externalIP = {
ipv4: fetchSync("https://api.ipify.org/").text(),
ipv6: fetchSync("https://api64.ipify.org/").text()
}
2021-06-11 17:13:40 -03:00
module.exports.external_ip = externalIP
module.exports.ip = externalIP
2021-04-23 21:40:08 -03:00
2021-06-11 17:13:40 -03:00
// Internal ip user
2021-04-23 21:40:08 -03:00
const interfaces = require("os").networkInterfaces();
2021-04-01 23:01:53 -03:00
const internal_ip = []
2021-05-04 14:46:10 -03:00
for (let index of Object.getOwnPropertyNames(require("os").networkInterfaces())){
2021-04-18 23:36:41 -03:00
const inter = interfaces[index]
2021-04-01 23:01:53 -03:00
for (let ind in inter){
if (inter[ind].address.includes("::")) internal_ip.push(`[${inter[ind].address}]`)
else internal_ip.push(inter[ind].address)
2021-03-14 01:55:34 +00:00
}
2021-04-01 23:01:53 -03:00
}
module.exports.internal_ip = internal_ip