Skip to content

rejetto/nat-upnp-ts

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

NodeJS promise-based UPnP client with typescript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 53.8%
  • TypeScript 46.2%