nat-api
nat-api copied to clipboard
The obtained external IP is not a real public IP address.
const NatAPI = require('nat-api')
const client = new NatAPI()
// Get external IP
client.externalIp(function(err, ip) {
if (err) return console.log('Error', err)
console.log('External IP:', ip)
})
External IP: 192.168.1.8
The obtained external IP is not a real public IP address.
You should request a website that can view the public IP address to get the real public external IP.
https://db-ip.com/
If the device is behind the multi-layer nat device, how to map the port to the external public ip?
https://www.ip.cn/