nat-upnp-rejetto
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

UPnP TS

Port mapping via UPnP APIs

Installation

npm i nat-upnp-rejetto

Usage

// using ES modules
import { Client } from "nat-upnp-ts";
const client = new Client();

// using node require
const upnp = require("nat-upnp-ts");
const client = new upnp.Client();

client
  .createMapping({
    public: 12345,
    private: 54321,
    ttl: 10,
  })
  .then(() => {
    // Will be called once finished
  })
  .catch(() => {
    // Will be called on error
  });

async () => {
  await client.removeMapping({
    public: 12345,
  });
};

client.getMappings();

client.getMappings({
  local: true,
  description: "both of these fields are optional",
});

client.getPublicIp();

Readme

Keywords

none

Package Sidebar

Install

npm i nat-upnp-rejetto

Weekly Downloads

68

Version

2.0.2

License

MIT

Unpacked Size

29.1 kB

Total Files

14

Last publish

Collaborators

  • rejetto