The canihazip.com project stopped working. See the report at #2. As a fallback, this project is using ipify.org with patch 1.0.3 so it does not break old usages.
For new projects, I suggest using public-ip
. It is better maintained, built to be more robust (to avoid issues like #2) and has a better feature set.
Get public IP using
canihazip.comipify.org.
npm install --save canihazip
npm install --global canihazip
var canihazip = require('canihazip');
var ip = canihazip();
canihazip
This will return IP of the current machine, for example: 1.2.3.4
.
MIT © Marko Grešak