Skip to content

matasarei/node-mbedtls-server

 
 

Repository files navigation

Node MbedTLS server

Node DTLS server wrapping mbedtls.

Changes made to the fork:

Setup & Build

git submodule update --init mbedtls
npm i

DTLS Server API:

// Key is the only required option. The rest are optional.
const options = {
  key:                '...', // Path to the server's private key.
  identityPskCallback: null, // Callback. PSK resolver, if we're using PSK.
  handshakeTimeoutMin: 3000, // How many milliseconds can a handshake subtend before being dropped?
  debug:               0     // How chatty is the library? Larger values generate more log.
};

const dtlsserver = dtls.createServer(opts, socket => {
  // socket is a duplex stream.
  socket.on('data', data => {
    // Handle incoming data.
  });
});

Events

error when the server has a problem.

// err: Error string/code.
server.on('error', (err) => {});

close when the server stops listening.

// No arguments to callback.
server.on('error', (err) => {});

listening when the server setup completes without problems.

// No arguments to callback.
server.on('listening', () => {});

Packages

No packages published

Languages

  • C++ 57.6%
  • JavaScript 31.3%
  • Python 6.8%
  • C 4.3%