node-mbedtls-server
v3.1.1
Published
DTLS server wrapping MbedTLS
Downloads
2
Readme
Node MbedTLS server
Node DTLS server wrapping mbedtls.
Changes made to the fork:
- Merged changes from a fork, node-mbed-dtls-modified, including Node.js 12 support;
- Merged changes from a fork, node-mbed-dtls, including N-API migration;
- Removed the client part of the library, which is now available as a separate package: node-mbedtls-client.
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', () => {});