This commit is contained in:
AJ ONeal 2016-10-06 16:03:56 -06:00
parent 7b45cd81e5
commit af90be44c4
2 changed files with 37 additions and 1 deletions

View File

@ -1,2 +1,38 @@
# tunnel-packer # tunnel-packer
A strategy for packing and unpacking tunneled network messages (or any stream) in node.js 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'
});
```

View File

@ -1,6 +1,6 @@
{ {
"name": "tunnel-packer", "name": "tunnel-packer",
"version": "1.0.0", "version": "1.1.0",
"description": "A strategy for packing and unpacking tunneled network messages (or any stream)", "description": "A strategy for packing and unpacking tunneled network messages (or any stream)",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {