external-ip
Advanced tools
Comparing version 2.0.3 to 2.1.1
@@ -7,3 +7,3 @@ 'use strict'; | ||
replace: true, // true: replace the default services list, false: extend it, default: false | ||
services: ['http://icanhazip.com/', 'http://ident.me/'], | ||
services: ['https://ipinfo.io/ip', 'http://icanhazip.com/', 'http://ident.me/'], | ||
timeout: 600, // set timeout per request, default: 500ms | ||
@@ -18,2 +18,2 @@ getIP: 'parallel' | ||
console.log(ip); | ||
}); | ||
}); |
@@ -5,3 +5,3 @@ 'use strict'; | ||
replace: true, // true: replace the default services list, false: extend it, default: false | ||
services: ['http://icanhazip.com/', 'http://ident.me/'], | ||
services: ['https://ipinfo.io/ip', 'http://icanhazip.com/', 'http://ident.me/'], | ||
timeout: 600, // set timeout per request, default: 500ms | ||
@@ -16,2 +16,2 @@ getIP: 'parallel', | ||
console.error(error); | ||
}); | ||
}); |
@@ -60,2 +60,2 @@ #!/usr/bin/env node | ||
console.log(ip); | ||
}); | ||
}); |
@@ -16,2 +16,3 @@ { | ||
"default": [ | ||
"https://ipinfo.io/ip", | ||
"https://icanhazip.com/", | ||
@@ -45,2 +46,2 @@ "https://ident.me/", | ||
} | ||
} | ||
} |
{ | ||
"name": "external-ip", | ||
"version": "2.0.3", | ||
"version": "2.1.1", | ||
"lockfileVersion": 1, | ||
@@ -8,9 +8,10 @@ "requires": true, | ||
"ajv": { | ||
"version": "6.2.1", | ||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.2.1.tgz", | ||
"integrity": "sha1-KKarxJOiq+D7TIUHrK7bQ/pVBnE=", | ||
"version": "6.5.4", | ||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", | ||
"integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", | ||
"requires": { | ||
"fast-deep-equal": "1.1.0", | ||
"fast-json-stable-stringify": "2.0.0", | ||
"json-schema-traverse": "0.3.1" | ||
"fast-deep-equal": "^2.0.1", | ||
"fast-json-stable-stringify": "^2.0.0", | ||
"json-schema-traverse": "^0.4.1", | ||
"uri-js": "^4.2.2" | ||
} | ||
@@ -36,3 +37,3 @@ }, | ||
"requires": { | ||
"balanced-match": "1.0.0", | ||
"balanced-match": "^1.0.0", | ||
"concat-map": "0.0.1" | ||
@@ -48,13 +49,13 @@ } | ||
"chai": { | ||
"version": "4.1.2", | ||
"resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", | ||
"integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", | ||
"version": "4.2.0", | ||
"resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", | ||
"integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", | ||
"dev": true, | ||
"requires": { | ||
"assertion-error": "1.1.0", | ||
"check-error": "1.0.2", | ||
"deep-eql": "3.0.1", | ||
"get-func-name": "2.0.0", | ||
"pathval": "1.1.0", | ||
"type-detect": "4.0.8" | ||
"assertion-error": "^1.1.0", | ||
"check-error": "^1.0.2", | ||
"deep-eql": "^3.0.1", | ||
"get-func-name": "^2.0.0", | ||
"pathval": "^1.1.0", | ||
"type-detect": "^4.0.5" | ||
} | ||
@@ -69,5 +70,5 @@ }, | ||
"commander": { | ||
"version": "2.15.0", | ||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.0.tgz", | ||
"integrity": "sha512-7B1ilBwtYSbetCgTY1NJFg+gVpestg0fdA1MhC1Vs4ssyfSXnCAjFr+QcQM9/RedXC0EaUx1sG8Smgw2VfgKEg==" | ||
"version": "2.19.0", | ||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", | ||
"integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==" | ||
}, | ||
@@ -94,3 +95,3 @@ "concat-map": { | ||
"requires": { | ||
"mimic-response": "1.0.0" | ||
"mimic-response": "^1.0.0" | ||
} | ||
@@ -104,3 +105,3 @@ }, | ||
"requires": { | ||
"type-detect": "4.0.8" | ||
"type-detect": "^4.0.0" | ||
} | ||
@@ -121,5 +122,5 @@ }, | ||
"fast-deep-equal": { | ||
"version": "1.1.0", | ||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", | ||
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" | ||
"version": "2.0.1", | ||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", | ||
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" | ||
}, | ||
@@ -149,20 +150,20 @@ "fast-json-stable-stringify": { | ||
"requires": { | ||
"fs.realpath": "1.0.0", | ||
"inflight": "1.0.6", | ||
"inherits": "2.0.3", | ||
"minimatch": "3.0.4", | ||
"once": "1.4.0", | ||
"path-is-absolute": "1.0.1" | ||
"fs.realpath": "^1.0.0", | ||
"inflight": "^1.0.4", | ||
"inherits": "2", | ||
"minimatch": "^3.0.4", | ||
"once": "^1.3.0", | ||
"path-is-absolute": "^1.0.0" | ||
} | ||
}, | ||
"growl": { | ||
"version": "1.10.3", | ||
"resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", | ||
"integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", | ||
"version": "1.10.5", | ||
"resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", | ||
"integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", | ||
"dev": true | ||
}, | ||
"has-flag": { | ||
"version": "2.0.0", | ||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", | ||
"integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", | ||
"version": "3.0.0", | ||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", | ||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", | ||
"dev": true | ||
@@ -182,4 +183,4 @@ }, | ||
"requires": { | ||
"once": "1.4.0", | ||
"wrappy": "1.0.2" | ||
"once": "^1.3.0", | ||
"wrappy": "1" | ||
} | ||
@@ -194,10 +195,10 @@ }, | ||
"json-schema-traverse": { | ||
"version": "0.3.1", | ||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", | ||
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" | ||
"version": "0.4.1", | ||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", | ||
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" | ||
}, | ||
"mimic-response": { | ||
"version": "1.0.0", | ||
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.0.tgz", | ||
"integrity": "sha1-3z02Uqc/3ta5sLJBRub9BSNTRY4=" | ||
"version": "1.0.1", | ||
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", | ||
"integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" | ||
}, | ||
@@ -210,3 +211,3 @@ "minimatch": { | ||
"requires": { | ||
"brace-expansion": "1.1.11" | ||
"brace-expansion": "^1.1.7" | ||
} | ||
@@ -230,9 +231,9 @@ }, | ||
"mocha": { | ||
"version": "5.0.4", | ||
"resolved": "https://registry.npmjs.org/mocha/-/mocha-5.0.4.tgz", | ||
"integrity": "sha512-nMOpAPFosU1B4Ix1jdhx5e3q7XO55ic5a8cgYvW27CequcEY+BabS0kUVL1Cw1V5PuVHZWeNRWFLmEPexo79VA==", | ||
"version": "5.2.0", | ||
"resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", | ||
"integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", | ||
"dev": true, | ||
"requires": { | ||
"browser-stdout": "1.3.1", | ||
"commander": "2.11.0", | ||
"commander": "2.15.1", | ||
"debug": "3.1.0", | ||
@@ -242,12 +243,13 @@ "diff": "3.5.0", | ||
"glob": "7.1.2", | ||
"growl": "1.10.3", | ||
"growl": "1.10.5", | ||
"he": "1.1.1", | ||
"minimatch": "3.0.4", | ||
"mkdirp": "0.5.1", | ||
"supports-color": "4.4.0" | ||
"supports-color": "5.4.0" | ||
}, | ||
"dependencies": { | ||
"commander": { | ||
"version": "2.11.0", | ||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", | ||
"integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", | ||
"version": "2.15.1", | ||
"resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", | ||
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", | ||
"dev": true | ||
@@ -268,3 +270,3 @@ } | ||
"requires": { | ||
"wrappy": "1.0.2" | ||
"wrappy": "1" | ||
} | ||
@@ -284,2 +286,7 @@ }, | ||
}, | ||
"punycode": { | ||
"version": "2.1.1", | ||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", | ||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" | ||
}, | ||
"simple-concat": { | ||
@@ -291,18 +298,18 @@ "version": "1.0.0", | ||
"simple-get": { | ||
"version": "2.7.0", | ||
"resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.7.0.tgz", | ||
"integrity": "sha512-RkE9rGPHcxYZ/baYmgJtOSM63vH0Vyq+ma5TijBcLla41SWlh8t6XYIGMR/oeZcmr+/G8k+zrClkkVrtnQ0esg==", | ||
"version": "3.0.3", | ||
"resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.0.3.tgz", | ||
"integrity": "sha512-Wvre/Jq5vgoz31Z9stYWPLn0PqRqmBDpFSdypAnHu5AvRVCYPRYGnvryNLiXu8GOBNDH82J2FRHUGMjjHUpXFw==", | ||
"requires": { | ||
"decompress-response": "3.3.0", | ||
"once": "1.4.0", | ||
"simple-concat": "1.0.0" | ||
"decompress-response": "^3.3.0", | ||
"once": "^1.3.1", | ||
"simple-concat": "^1.0.0" | ||
} | ||
}, | ||
"supports-color": { | ||
"version": "4.4.0", | ||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", | ||
"integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", | ||
"version": "5.4.0", | ||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", | ||
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", | ||
"dev": true, | ||
"requires": { | ||
"has-flag": "2.0.0" | ||
"has-flag": "^3.0.0" | ||
} | ||
@@ -316,2 +323,10 @@ }, | ||
}, | ||
"uri-js": { | ||
"version": "4.2.2", | ||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", | ||
"integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", | ||
"requires": { | ||
"punycode": "^2.1.0" | ||
} | ||
}, | ||
"wrappy": { | ||
@@ -318,0 +333,0 @@ "version": "1.0.2", |
{ | ||
"name": "external-ip", | ||
"version": "2.0.3", | ||
"version": "2.1.1", | ||
"description": "A node.js library to get your external ip from multiple services", | ||
@@ -29,2 +29,6 @@ "main": "index.js", | ||
"email": "nikolas.andronopoulos@gmail.com" | ||
}, | ||
{ | ||
"name": "Uman Shahzad", | ||
"email": "uman@mslm.me" | ||
} | ||
@@ -38,10 +42,10 @@ ], | ||
"dependencies": { | ||
"ajv": "^6.2.1", | ||
"commander": "^2.15.0", | ||
"simple-get": "^2.7.0" | ||
"ajv": "^6.5.4", | ||
"commander": "^2.19.0", | ||
"simple-get": "^3.0.3" | ||
}, | ||
"devDependencies": { | ||
"chai": "^4.1.2", | ||
"mocha": "^5.0.4" | ||
"chai": "^4.2.0", | ||
"mocha": "^5.2.0" | ||
} | ||
} |
@@ -1,2 +0,3 @@ | ||
# external-ip | ||
# external-ip | ||
[![Build Status](https://travis-ci.org/J-Chaniotis/external-ip.svg?branch=master)](https://travis-ci.org/J-Chaniotis/external-ip) | ||
@@ -30,4 +31,4 @@ [![Dependency Status](https://david-dm.org/j-Chaniotis/external-ip.svg)](https://david-dm.org/j-Chaniotis/external-ip) | ||
}); | ||
``` | ||
``` | ||
with configuration | ||
@@ -42,3 +43,3 @@ | ||
replace: true, | ||
services: ['http://ifconfig.co/x-real-ip', 'http://ifconfig.io/ip'], | ||
services: ['https://ipinfo.io/ip', 'http://ifconfig.co/x-real-ip', 'http://ifconfig.io/ip'], | ||
timeout: 600, | ||
@@ -55,6 +56,7 @@ getIP: 'parallel', | ||
}); | ||
``` | ||
``` | ||
### Promises | ||
The API of this library is designed around the classic node.js error-first callback. | ||
The API of this library is designed around the classic node.js error-first callback. | ||
As of node.js V8, converting this type of callback into a promise is pretty straight forward and | ||
@@ -64,2 +66,3 @@ requires one more line of code. | ||
basic | ||
```javascript | ||
@@ -76,4 +79,4 @@ 'use strict'; | ||
}); | ||
``` | ||
``` | ||
with configuration | ||
@@ -86,3 +89,3 @@ | ||
replace: true, | ||
services: ['http://icanhazip.com/', 'http://ident.me/'], | ||
services: ['https://ipinfo.io/ip', 'http://icanhazip.com/', 'http://ident.me/'], | ||
timeout: 600, | ||
@@ -99,4 +102,5 @@ getIP: 'parallel', | ||
``` | ||
If you believe this extra step shouldn be there, feel free to open an issue and/or a pull request | ||
If you believe this extra step shouldn't be there, feel free to open an issue and/or a pull request. | ||
## Configuration | ||
@@ -119,3 +123,5 @@ | ||
### getIP(callback) | ||
The callback gets 2 arguments: | ||
1. error: if every service in the list fails to return a valid ip | ||
@@ -125,4 +131,6 @@ 2. ip: your external ip | ||
## CLI | ||
install as a global package with `npm install -g external-ip`. | ||
``` | ||
```bash | ||
$ external-ip -h | ||
@@ -161,8 +169,11 @@ | ||
``` | ||
## Test | ||
Change your working directory to the project's root, `npm install` to get the development dependencies and then run `npm test` | ||
## Links | ||
* [moira](https://www.npmjs.org/package/moira) | ||
* [externalip](https://www.npmjs.org/package/externalip) | ||
* [extip](https://www.npmjs.org/package/extip) |
@@ -29,3 +29,3 @@ 'use strict'; | ||
replace: true, // true: replace the default services list, false: extend it, default: false | ||
services: ['http://ident.me/', 'http://icanhazip.com/'], | ||
services: ['https://ipinfo.io/ip', 'http://ident.me/', 'http://icanhazip.com/'], | ||
timeout: timeout, // set timeout per request, default: 500ms, | ||
@@ -54,2 +54,2 @@ getIP: 'parallel' | ||
}); | ||
}); | ||
}); |
@@ -156,3 +156,7 @@ 'use strict'; | ||
expect(ip).to.equal(null); | ||
expect(error.message).to.contain('ENOTFOUND'); | ||
if (process.platform === 'win32') {// Hack cause windows does not produce ENOTFOUND :/ | ||
expect(error.message).to.contain('Request timed out'); | ||
} else { | ||
expect(error.message).to.contain('ENOTFOUND'); | ||
} | ||
done(); | ||
@@ -183,2 +187,2 @@ }); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36672
845
170
+ Addeddecompress-response@4.2.1(transitive)
+ Addedmimic-response@2.1.0(transitive)
+ Addedsimple-get@3.1.1(transitive)
- Removeddecompress-response@3.3.0(transitive)
- Removedmimic-response@1.0.1(transitive)
- Removedsimple-get@2.8.2(transitive)
Updatedajv@^6.5.4
Updatedcommander@^2.19.0
Updatedsimple-get@^3.0.3