-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrials.js
40 lines (33 loc) · 901 Bytes
/
trials.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const ipGetter = require('./getters/IpGetter');
const ipProviders = require('./getters/providers.json').ipProviders;
const ipGetters = ipProviders.map(row => new ipGetter(row.name, row.url)) ;
console.log(ipGetters);
(async () => {
let result = await ipGetters[0].get_ip();
console.log(result)
})();
//
// async function getIPText() {
// let res = await superagent.get('https://jsonip.com');
// return typeof res === 'object' ? JSON.stringify(res.text) : res.text;
// // request("https://jsonip.com", { json: false }, (err, res, body) => {
// // if (err) { return console.log(err); }
// // return body;
// // });
// }
//
//
// (async () => {
//
// let res = await getIPText();
//
// let result = res.match(ip_regex);
//
// let array = result.filter(ip => ipaddr.isValid(ip));
// //
// console.log(array);
//
// console.log(`The ip is : ${array}`)
// })();
//
//