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 🙏

© 2024 – Pkg Stats / Ryan Hefner

openssl-dtls

v2.0.2

Published

Bindings for OpenSSL DTLS1.2

Downloads

74

Readme

OpenSSL DTLS1.2 Bindings

This module enables your application to listen for incoming DTLS1.2 connections. It uses OpenSSL 1.1.1, which is shipped with Node.js version 10 up to version 16.

API

const DTLS = require('openssl-dtls');
const srv = DTLS.createServer(opts);

Spawns a new server. opts is an object:

  • key: Buffer. The server's private key in PEM format. Mandatory.
  • cert: Buffer. The server's certificate in PEM format. Mandatory.
  • ca: Buffer. CA certificate for validation of client certificates. Optional.
  • requestCert: Boolean. Request certificate from client. Default: false.
  • rejectUnauthorized: Boolean. Reject invalid client certificates. Default: false.
  • mtu: Number. The wire's MTU. Default: 1500 Ethernet MTU - 40 IPv6 Header - 8 UDP Header = 1452.
  • ciphers: String. Allowed ciphers. Further details: OpenSSL Cipher List Format. Optional.
  • socket: Instances of dgram.Socket. By default a new 'udp6' dgram socket will be created.
  • handshakeTimeout: Duration in milliseconds how long a DTLS handshake can take until it will be aborted and the state is removed. Default: 30 * 1000ms
  • connectionTimeout: Duration in milliseconds how long a DTLS connection can stay established without any received data until the connection is closed. Default: 10 * 60 * 1000ms
  • retransmitTimeout: Number or Function. A number states the initial retransmit timeout in microseconds that is doubled in every iteration. Function: (lastTimeout) => nextTimeout, where lastTimeout is zero in the first iteration. Default: 1000000.

Class: Server

Method: bind()

srv.bind(...);

Proxy method for the bind() method of the socket specified with DTLS.createServer(). If you haven't specified anything, have a look into the documentation of UDP/Datagram.

Method: close()

srv.close([cb]);

Shuts down the server and calls cb once the underlying socket has been closed.

Event: connection

srv.on('connection', (info) => {...});

Is raised if a client has started a handshake. info:

  • address: Remote address.
  • port: Remote port.

Event: error

srv.on('error', (err, info) => {...});

Is raised if something went wrong. err is an instance of Error. info:

  • address: Remote address.
  • port: Remote port.

Event: secureConnection

srv.on('secureConnection', (peer) => {...});

Is raised once a handshake has been successfully finished. peer is an instance of Peer.

Class: Peer

Method: address()

const info = peer.address();

Returns the peers address. info:

  • address: Remote address.
  • port: Remote port.

Method: getCertChain()

const chain = peer.getCertChain();

Returns the peers certificate chain. chain is a Buffer containing the certificates in PEM format. If no certificates has been prensented by the client, chain is and empty Buffer.

Method: send()

peer.send(message);

Sends message to the client. message has to be a Buffer.

Method: end()

peer.end();

Closes connection to peer.

Event: message

peer.on('message', (message) => {...});

Is raised if a message has been received from peer.

Event: close

peer.on('close', () => {...});

Is raised if the connection to peer has been closed.