npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

stunsrv

v0.0.3-1

Published

A STUN client/server package.

Readme

A STUN client and server NPM package

Overview

STUN (Simple Traversal of UDP through NAT: RFC3489) is a protocol that allows a client node to obtain an external IP address and port number assigned by a NAT the client is behind. It can also identify behavioral type of the NAT. It is implemented in JavaScript to run with node.js.

(This implementation is a packaged version of https://github.com/enobufs/stun so all thanks go to him/her)

System requirement

  • Node.js v0.4 or above
  • Two IP addresses on the same machine (for server)

How to install STUN server

$ npm install -g stunsrv

You may need to create a symlink to node

#!bash
$ sudo ln -s /usr/bin/nodejs /usr/bin/node

How to run STUN server

(1) execute stunsrv from the command line or (2) create and handle a stun server through the class from a js file

-- defaults are provided for all parameters (you'll probably need to use the first two though to do anything useful)

#!bash
# From terminal
$ stunsrv
$ stunsrv firstIP secondIP firstPort secondPort externalIP0 externalIP1
# Or programmatically
var stun = require('stunsrv');
var server = stun.createServer();
server.setAddress0("bindAddress0");
server.setAddress1("bindAddress1");
server.setPort0(port0);
server.setPort1(port1);
server.setResponseAddress0("externalIP0");
server.setResponseAddress1("externalIP1");
server.listen();

How to run STUN client

var stun = require('stunsrv');

//var STUN_SERVER_ADDR = "dntg-stun.usrd.scea.com";
//var STUN_SERVER_ADDR = "stun1.noc.ams-ix.net";
var STUN_SERVER_ADDR = "172.16.4.6";

var client = stun.createClient();
client.setServerAddr(STUN_SERVER_ADDR);
client.start(function(result)
{
    var mapped = client.getMappedAddr();
    // Dump client properties
    console.log("Complete(" + result + "): " + (client.isNatted()?"Natted":"Open") + " NB=" + client.getNB() + " EF=" + client.getEF() + " (" + client.getNatType() + ") mapped=" + mapped.address + ":" + mapped.port + " rtt=" + client.getRtt());
    client.close(function()
    {
        console.log("All sockets closed.");
    });
});

That is it!

Limitations

  • Current implementation does not support RFC 5389
  • Following attributes are not supported
    • RESPONSE-ADDRESS
    • CHANGED-ADDRESS
    • USERNAME
    • PASSWORD
    • MESSAGE-INTEGRITY
    • ERROR-CODE
    • UNKNOWN-ATTRIBUTE
    • REFLECTED-FROM
    • XOR-MAPPED-ADDRESS (RFC3489bis)

License

MIT Licensed

CONTRIBUTORS WANTED!!

Please contact me.