is-stun

Check if a Buffer is a STUN message.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
is-stun
002.0.05 years ago6 years agoMinified + gzip package size for is-stun in KB

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)

Related projects

License

MIT, 2017 (c) Dmitry Tsvettsikh