Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/paullouisageneau/node-portmapping
Multi-protocol Port Mapping for Node.js
https://github.com/paullouisageneau/node-portmapping
nat nat-gateway nat-pmp nat-traversal nodejs p2p pcp peer-to-peer port-forwarding port-mapping upnp
Last synced: 3 months ago
JSON representation
Multi-protocol Port Mapping for Node.js
- Host: GitHub
- URL: https://github.com/paullouisageneau/node-portmapping
- Owner: paullouisageneau
- License: mpl-2.0
- Created: 2022-01-27T21:46:37.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-18T11:53:59.000Z (9 months ago)
- Last Synced: 2024-09-24T11:47:25.401Z (4 months ago)
- Topics: nat, nat-gateway, nat-pmp, nat-traversal, nodejs, p2p, pcp, peer-to-peer, port-forwarding, port-mapping, upnp
- Language: C++
- Homepage:
- Size: 33.2 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Multi-protocol NAT Port Mapping for Node.js
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL_2.0-blue.svg)](https://www.mozilla.org/en-US/MPL/2.0/)
[![NPM package](https://img.shields.io/npm/v/node-portmapping?color=green)](https://www.npmjs.com/package/node-portmapping)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](https://github.com/paullouisageneau/libplum), which is licensed under MPL 2.0.
## Example
```js
const nodePortMapping = require('node-portmapping');nodePortMapping.init();
const mapping = nodePortMapping.createMapping(8080, (info) => {
if (info.state == 'Success') {
console.log(`${info.externalHost}:${info.externalPort}`);
}
});
```## Install
```sh
$ npm install node-portmapping
```