nat-api
Version:
Port mapping with UPnP and NAT-PMP
15 lines (10 loc) • 347 B
JavaScript
const NatAPI = require('../')
const client = new NatAPI()
const port = 6690
client.map({ publicPort: port, privatePort: port, protocol: 'UDP' }, function (err) {
if (err) return console.log(err)
console.log('Port ' + port + ' mapped to ' + port + ' (TCP)')
client.destroy(function () {
console.log('NatAPI client destroyed')
})
})