Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

is-stun

nodertc22.9kMIT2.0.0

Check if a Buffer is a STUN message.

stun, rfc7983, rfc5764, rfc5389, packet, message, test, detect, demultiplexing, demultiplex, demux

readme

is-stun

Build Status npm node license downloads

Check if a Buffer is a STUN message. Used for demultiplex packets that are arriving on the same port. Follows RFC7983.

Usage

const dgram = require('dgram')
const is_stun = require('is-stun')

const socket = dgram.createSocket('udp4')

socket.on('message', (packet) => {
  if (is_stun(packet)) {
    // handle STUN...
  }
})

socket.bind(0)

License

MIT, 2017 (c) Dmitry Tsvettsikh