How to get my external IP address with node.js?

后端 未结 14 1539
情深已故
情深已故 2020-12-06 05:00

I\'m using node.js and I need to get my external IP address, provided by my ISP. Is there a way to achieve this without using a service like http://myexternalip.com/raw ?

14条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 05:31

    use externalip package

    https://github.com/alsotang/externalip

    externalip(function (err, ip) {
      console.log(ip); // => 8.8.8.8
    });
    

提交回复
热议问题