File tree Expand file tree Collapse file tree 4 files changed +15
-7
lines changed Expand file tree Collapse file tree 4 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -37,15 +37,17 @@ console.log(listOfIP);
37
37
38
38
let externalIP = require("@kcak11/myip/external");
39
39
externalIP().then((data) => {
40
- console.log("External IP: " + data);
40
+ console.log("External IP: " + data.myip);
41
+ console.log("Country: " + data.country);
41
42
});
42
43
```
43
44
44
45
Output:
45
46
```
46
47
["xyz.pqr.a.b","xyz.pq.abc.def"]
47
48
External IP: XXX.YY.ZZ.AAA
49
+ Country: CC
48
50
```
49
51
50
52
## License: [ MIT License] ( https://mit-license.kcak11.com )
51
- © ; 2019 [ kcak11.com] ( https://www.kcak11.com " Ashish's Web ")
53
+ © ; 2020 [ kcak11.com] ( https://www.kcak11.com " Ashish's Web ")
Original file line number Diff line number Diff line change @@ -52,11 +52,17 @@ require('../utils/io').blockInput();
52
52
} ;
53
53
54
54
externalip ( ) . then ( ( data ) => {
55
- let externalIP = chalk . bold ( data ) ;
55
+ let externalIP = chalk . bold ( data . myip ) ;
56
+ let country = chalk . bold ( data . country ) ;
56
57
print ( chalk . red . bgWhite ( ` ${ formatter ( "External(public) IP: " + externalIP , {
57
58
suffixPadding : true ,
58
59
length : BOX_SIZE + 1 ,
59
- extraPadding : externalIP . length - data . length
60
+ extraPadding : externalIP . length - data . myip . length
61
+ } ) } `) ) ;
62
+ print ( chalk . red . bgWhite ( ` ${ formatter ( "Country: " + country , {
63
+ suffixPadding : true ,
64
+ length : BOX_SIZE + 1 ,
65
+ extraPadding : country . length - data . country . length
60
66
} ) } `) ) ;
61
67
print ( EMPTY_LINE ) ;
62
68
endProg ( ) ;
Original file line number Diff line number Diff line change 3
3
* Author: @kcak11
4
4
*
5
5
* The external IP information is fetched from:
6
- * https://whatismyipaddress. com (Thanks for the API)
6
+ * https://cors.kcak11. com/?myip=yes
7
7
**/
8
8
9
9
const axios = require ( 'axios' ) ;
10
10
11
11
module . exports = function ( action ) {
12
- let promise = axios . get ( "https://ipv4bot.whatismyipaddress .com/" ) ;
12
+ let promise = axios . get ( "https://cors.kcak11 .com/?myip=yes " ) ;
13
13
return new Promise ( ( resolve , reject ) => {
14
14
promise . then ( ( response ) => {
15
15
resolve ( response . data ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @kcak11/myip" ,
3
- "version" : " 3.1 .0" ,
3
+ "version" : " 4.0 .0" ,
4
4
"description" : " A Utility to fetch IP Addresses" ,
5
5
"main" : " ./exec/index.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments