1.1.1 • Published 3 years ago

upnpjs v1.1.1

Weekly downloads
14
License
Apache-2.0
Repository
github
Last release
3 years ago

UPnP Node.js Package

npm.io npm.io npm.io npm.io

Node.js package built for managing a router using UPnP.

Installation

Install upnpjs Library

    npm install upnpjs

Install upnp CLI

    # Use `upnp -h` to show help menu
    npm install upnpjs -g

Getting Started

Discover the Internet Gateway Device

    const upnp = require('upnpjs');

    const igd = await upnp.discover();

InternetGatewayDevice

InternetGatewayDevice allows access to different services potentially allowed by the device

addPortMapping

Service action for mapping ports on the router

await igd.addPortMapping({
    ip: 192.168.0.4,
    internalPort: 54321,
    externalPort: 54321,
    protocol: 'TCP', // Defaults to TCP
    description: 'Example port map from 54321 -> 54321', // Defaults to empty string
    enabled: false // Defaults to true
});

deletePortMapping

Service action for removing port mappings on the router

await igd.deletePortMapping({
    externalPort: 12345,
    protocol: 'UDP'
});

getExternalIPAddress

Service action for retrieving external ip address

const ip = await igd.getExternalIPAddress();

getPortMappingList

Service action for listing all currently mapped ports on the router

const list = await igd.getPortMappingList();

getPortMapping

Service action for remtrieving a single port map by index

const portmap = await igd.getPortMapping(2);

References

Documents

UPnP Architecture | Service Template | UPnP Background | Internet Gateway Device

Code Samples

miniupnp | TinyUPnP | weupnp | upnpclient | Node.js and SSDP

1.1.1

3 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago