tart-transport-tls
Stability: 1 - Experimental
TLS transport implementation for Tiny Actor Run-Time in JavaScript.
Contributors
Overview
An implementation of a TLS transport for Tiny Actor Run-Time in JavaScript.
Usage
To run the below example run:
npm run readme
"use strict"; var fs = ;var path = ;var tart = ;var tls = ;var transport = ; var sponsor = tart; var send = ;var sendWithOptions = ; var receivedMessageCount = 0;var receptionist = ; var serverCapabilities = transport;var close = ;var listen = ; var fail = ; var listenAck = ; ;
Tests
npm test
Documentation
Public API
- transport.sendBeh
- transport.sendWithOptions
- transport.server(receptionist)
- serverCapabilities.closeBeh
- serverCapabilities.listenBeh
transport.sendBeh
Actor behavior that will attempt to send messages over TLS.
Message format:
address
: String TCP address in URI format. Scheme, host, and port are required. Framgment is optional but usually necessary. For example:tcp://localhost:7847/#t5YM5nxnJ/xkPTo...
.content
: String JSON content to be sent.fail
: Actorfunction (error) {}
(Default: undefined) Optional actor to reporterror
(if any).ok
: Actorfunction () {}
(Default: undefined) Optional actor to report successful send to the destination.
TLS Options:
pfx
: See TLS connect options.key
: See TLS connect options.passhprase
: See TLS connect options.cert
: See TLS connect options.ca
: See TLS connect options.rejectUnauthorized
: See TLS connect options.NPNProtocols
: See TLS connect options.servername
: See TLS connect options.secureProtocol
: See TLS connect options.
var send = ;;
transport.sendWithOptions(tlsOptions)
tlsOptions
: Objectpfx
: See TLS connect options.key
: See TLS connect options.passhprase
: See TLS connect options.cert
: See TLS connect options.ca
: See TLS connect options.rejectUnauthorized
: See TLS connect options.NPNProtocols
: See TLS connect options.servername
: See TLS connect options.secureProtocol
: See TLS connect options.
Creates an actor behavior identical to transport.sendBeh, except that TLS Options portion for every send will be automatically populated from tlsOptions
provided.
var sendWithOptions = ;sendWithOptions = ;
transport.server(receptionist)
receptionist
: Actorfunction (message) {}
Actor to forward traffic received by this server in{address: <URI>, contents: <json>}
format.- Return: Object An object containing behaviors for listen and close capabilities.
closeBeh
: serverCapabilities.closeBehlistenBeh
: serverCapabilities.listenBeh
Creates an entangled pair of capabilities that will control a single TLS server.
serverCapabilities.closeBeh
Actor behavior that will close a listening server.
Message is an ack
Actor function () {}
, an actor that will be sent an empty message once the server closes.
var serverCapabilities = transport;var close = ;
serverCapabilities.listenBeh
Actor behavior that will create a new listening TLS server.
Message format:
host
: String TLS host to listen on.port
: Number TLS port to listen on.ok
: Actorfunction (message) {}
Optional actor to receive acknowledgment once the server is listening.fail
: Actorfunction (error) {}
Optional actor to receive any errors when starting the TLS transport.
TLS Options:
pfx
: See TLS server options.key
: See TLS server options.passphrase
: See TLS server options.cert
: See See TLS server options.ca
: See TLS server options.crl
: See TLS server options.ciphers
: See TLS server options.handshakeTimeout
: See TLS server options.honorCipherOrder
: See TLS server options.requestCert
: See TLS server options.rejectUnauthorized
: See TLS server options.NPNProtocols
: See TLS server options.sessionIdContext
: See TLS server options.secureProtocol
: See TLS server options.
var serverCapabilities = transport;var listen = ;;