https://github.com/ryanfarber/upnp
open ports on your router/gateway using UPNP
https://github.com/ryanfarber/upnp
Last synced: 30 days ago
JSON representation
open ports on your router/gateway using UPNP
- Host: GitHub
- URL: https://github.com/ryanfarber/upnp
- Owner: ryanfarber
- Created: 2022-11-09T02:31:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-09T03:17:06.000Z (over 3 years ago)
- Last Synced: 2025-03-02T16:48:53.294Z (over 1 year ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# upnp
open ports on your router/gateway using NAT/UPNP [(Universal Plug n Play)](https://en.wikipedia.org/wiki/Universal_Plug_and_Play)
```javascript
const Upnp = require("@ryanforever/upnp")
const upnp = new UPNP({
gateway: "192.168.1.1", // i.e. router address
port: 1337,
ttl: 0, // time in seconds port should be open. 0 is infinity
description: "my application port" // optional description of what this port is for
})
upnp.map() // map the port
upnp.unmap() // unmap the port
upnp.getMappings() // returns all mappings on router/gateway
```
choose different public and private ports
```javascript
const upnp = new UPNP({
gateway: "192.168.1.1",
public: 1337,
private: 1336,
ttl: 0,
description: "my application port"
})
```