paullouisageneau / node-portmapping

Multi-protocol Port Mapping for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multi-protocol NAT Port Mapping for Node.js

License: MPL 2.0 NPM package

node-portmapping allows to forward ports on Network Address Translators (NAT). It implements the protocols PCP, NAT-PMP, and UPnP, and automatically detects which one to use.

This project consists in Node.js bindings for libplum, which is licensed under MPL 2.0.

Example

const nodePortMapping = require('node-portmapping');

nodePortMapping.init();

const mapping = nodePortMapping.createMapping(8080, (info) => {
    if (info.state == 'Success') {
        console.log(`${info.externalHost}:${info.externalPort}`);
    }
});

Install

$ npm install node-portmapping

About

Multi-protocol Port Mapping for Node.js

License:Mozilla Public License 2.0


Languages

Language:C++ 85.7%Language:CMake 9.0%Language:JavaScript 5.3%