move block
This commit is contained in:
parent
08051e3401
commit
4578d593d8
21
README.md
21
README.md
|
@ -92,14 +92,6 @@ or decrypt https before passing it to the local http handler.
|
||||||
You could do a little magic like this:
|
You could do a little magic like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
stunnel.connect({
|
|
||||||
// ...
|
|
||||||
, net: {
|
|
||||||
createConnection: function (info, cb) {
|
|
||||||
// data is the hello packet / first chunk
|
|
||||||
// info = { data, servername, port, host, remoteAddress: { family, address, port } }
|
|
||||||
// socket = { write, push, end, events: [ 'readable', 'data', 'error', 'end' ] };
|
|
||||||
|
|
||||||
var Dup = {
|
var Dup = {
|
||||||
write: function (chunk, encoding, cb) {
|
write: function (chunk, encoding, cb) {
|
||||||
this.__my_socket.write(chunk, encoding);
|
this.__my_socket.write(chunk, encoding);
|
||||||
|
@ -107,13 +99,18 @@ stunnel.connect({
|
||||||
}
|
}
|
||||||
, read: function (size) {
|
, read: function (size) {
|
||||||
var x = this.__my_socket.read(size);
|
var x = this.__my_socket.read(size);
|
||||||
if (x) {
|
if (x) { this.push(x); }
|
||||||
console.log('_read', size);
|
|
||||||
this.push(x);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
stunnel.connect({
|
||||||
|
// ...
|
||||||
|
, net: {
|
||||||
|
createConnection: function (info, cb) {
|
||||||
|
// data is the hello packet / first chunk
|
||||||
|
// info = { data, servername, port, host, remoteAddress: { family, address, port } }
|
||||||
|
// socket = { write, push, end, events: [ 'readable', 'data', 'error', 'end' ] };
|
||||||
|
|
||||||
var myDuplex = new (require('streams').Duplex);
|
var myDuplex = new (require('streams').Duplex);
|
||||||
|
|
||||||
myDuplex.__my_socket = socket;
|
myDuplex.__my_socket = socket;
|
||||||
|
|
Loading…
Reference in New Issue