
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
abstract-stream-muxer
Advanced tools
A test suite and interface you can use to implement a stream muxer.
A test suite and interface you can use to implement a stream muxer. "A one stop shop for all your muxing needs"
The primary goal of this module is to enable developers to pick and swap their stream muxing module as they see fit for their application, without having to go through shims or compatibility issues. This module and test suite was heavily inspired by abstract-blog-store.
Publishing a test suite as a module lets multiple modules all ensure compatibility since they use the same test suite.
The API is presented with both Node.js and Go primitives, however, there is not actual limitations for it to be extended for any other language, pushing forward the cross compatibility and interop through diferent stacks.
Send a PR to add a new one if you happen to find or write one.
Include this badge in your readme if you make a new module that uses abstract-stream-muxer API.

Install abstract-stream-muxer as one of the dependencies of your project and as a test file, using tap, tape or a test runner with compatible API, do:
var tape = require('tape')
var tests = require('abstract-stream-muxer/tests')
var YourStreamMuxer = require('../src')
var common = {
setup: function (t, cb) {
cb(null, YourStreamMuxer)
},
teardown: function (t, cb) {
cb()
}
}
var megaTest = false // a really really intensive test case
tests(tape, common, megaTest)
WIP - being written
A valid (read: that follows this abstraction) stream muxer, must implement the following API.
Node.js conn = muxer.attach(transport, isListener)Go conn, err := muxer.Attach(transport, isListener)This method attaches our stream muxer to the desired transport (UDP, TCP) and returns/callbacks with the err, conn(error, connection).
If err is passed, no operation should be made in conn.
isListener is a bool that tells the side of the socket we are, isListener = true for listener/server and isListener = false for dialer/client side.
conn abstracts our established Connection with the other endpoint, it must offer an interface to open a stream inside this connection and to receive incomming stream requests.
Node.js stream = conn.dialStream([function (err, stream)])Go stream, err := conn.DialStream()This method negotiates and opens a new stream with the other endpoint.
If err is passed, no operation should be made in stream.
stream abstract our established Stream with the other endpoint, it must implement the Duplex Stream interface in Node.js or the ReadWriteCloser in Go.
In the Node.js case, if no callback is passed, stream will emit an 'ready' event when it is prepared or a 'error' event if it fails to establish the connection, until then, it will buffer the 'write' calls.
Node.js conn.on('stream', function (stream))Go stream := conn.Accept()Each time a dialing peer initiates the new stream handshake, a new stream is created on the listening side.
In Node.js, the Event Emitter pattern is expected to be used in order to receive new incoming streams, while in Go, it expects to wait when Accept is called.
0.2.3 (2015-07-15)
<a name="0.2.2"></a>
FAQs
A test suite and interface you can use to implement a stream muxer.
The npm package abstract-stream-muxer receives a total of 7 weekly downloads. As such, abstract-stream-muxer popularity was classified as not popular.
We found that abstract-stream-muxer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.