A strategy for packing and unpacking a proxy stream (i.e. packets through a tunnel). Handles multiplexed and tls connections. Used by telebit and telebitd.
Go to file
AJ ONeal f1c0888302 auto-update ad 2016-12-30 02:23:09 -07:00
.gitignore Initial commit 2016-09-22 12:59:33 -06:00
LICENSE Initial commit 2016-09-22 12:59:33 -06:00
README.md auto-update ad 2016-12-30 02:23:09 -07:00
index.js moved Packer logic from stunneld 2016-09-30 22:07:01 -04:00
package.json v1.1.0 2016-10-06 16:04:06 -06:00
sni.hello.bin moved from tunnel-client 2016-09-22 13:11:54 -06:00
test.js update test 2016-09-30 02:35:29 -04:00

README.md

About Daplie: We're taking back the Internet!

Down with Google, Apple, and Facebook!

We're re-decentralizing the web and making it read-write again - one home cloud system at a time.

Tired of serving the Empire? Come join the Rebel Alliance:

jobs@daplie.com | Invest in Daplie on Wefunder | Pre-order Cloud, The World's First Home Server for Everyone

tunnel-packer

A strategy for packing and unpacking tunneled network messages (or any stream) in node.js

Examples

var Packer = require('tunnel-packer');

Packer.create({
  onmessage: function (msg) {
    // msg = { family, address, port, service, data };
  }
, onend: function (msg) {
    // msg = { family, address, port };
  }
, onerror: function (err) {
    // err = { message, family, address, port };
  }
});

var chunk = Packer.pack(address, data, service);
var addr = Packer.socketToAddr(socket);
var id = Packer.addrToId(address);
var id = Packer.socketToId(socket);

var myDuplex = Packer.Stream.create(socketOrStream);

var myTransform = Packer.Transform.create({
  address: {
    family: '...'
  , address: '...'
  , port: '...'
  }
  // hint at the service to be used
, service: 'https'
});