noahlevenson / ministun

A zero dependency STUN server
MIT License
49 stars 3 forks source link
nat nat-traversal node-js nodejs p2p p2p-network rfc-3489 rfc-5389 rfc3489 rfc5389 server stun stun-server stunserver udp

ministun

Unit tests

STUN (Session Traversal Utilities for NAT) is a simple protocol. A STUN implementation should be simple too.

ministun is a zero dependency STUN server for Node.js. It implements "Basic Server Behavior" as defined by section 13 of RFC 5389, including backwards compatibility with RFC 3489.

Requirements

Node.js >= 12.14.0

Installation

npm i ministun

Usage

const Ministun = require("ministun");

const config = {
    udp4: true,
    udp6: true,
    port: 3478,
    log: console.log,
    err: console.err,
    sw: true
};

const server = new Ministun(config);

async function startServer() {
    await server.start();
}

async function stopServer() {
    await server.stop();
}

Configuration

TODO

Better test coverage