2.0.1 • Published 2 years ago

nat-upnp-ts v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

UPnP TS

Port mapping via UPnP APIs

Installation

npm i nat-upnp-ts
OR
npm i git+https://github.com/kaden-sharpin/nat-upnp-ts.git

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();
2.0.1

2 years ago

2.0.0

2 years ago