Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iteam1337/ipjs
resolve your external ip from node
https://github.com/iteam1337/ipjs
Last synced: about 4 hours ago
JSON representation
resolve your external ip from node
- Host: GitHub
- URL: https://github.com/iteam1337/ipjs
- Owner: Iteam1337
- License: mit
- Created: 2015-02-10T21:46:49.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-02-10T21:47:23.000Z (over 9 years ago)
- Last Synced: 2024-04-14T11:04:21.773Z (7 months ago)
- Language: JavaScript
- Size: 133 KB
- Stars: 0
- Watchers: 20
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
node ipjs
====## what is it?
It's a node lib to return your servers public facing IP adress from within nodejs.## how does it work?
It uses the public ip service provided by Iteam (which by the way is available as http endpoint too: ´curl ip.iteam.se´ ) - see http://ip.iteam.se for referenceThe first time you require('ip') the call to the external web service will be issued and after that it will be cached.
Warning! There is a built-in race condition, if you want to make sure the call is finished and the IP is resolved, please use the promise provided.
## install
npm install ipjs
## usage
var ip = require('ipjs');
ip.then(function(){
console.log(ip.toString()); // 11.22.33.44
})## as singleton
var ip = require('ipjs');
...
app.get('..', function(req,res){
res.send(ip.toString());
})