From 4578d593d88e9a141ab80c4adc93cae985656b29 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 6 Oct 2016 15:09:28 -0600 Subject: [PATCH] move block --- README.md | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 53d80d7..d50479c 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,17 @@ or decrypt https before passing it to the local http handler. You could do a little magic like this: ``` +var Dup = { + write: function (chunk, encoding, cb) { + this.__my_socket.write(chunk, encoding); + cb(); + } +, read: function (size) { + var x = this.__my_socket.read(size); + if (x) { this.push(x); } + } +}; + stunnel.connect({ // ... , net: { @@ -100,20 +111,6 @@ stunnel.connect({ // info = { data, servername, port, host, remoteAddress: { family, address, port } } // socket = { write, push, end, events: [ 'readable', 'data', 'error', 'end' ] }; - var Dup = { - write: function (chunk, encoding, cb) { - this.__my_socket.write(chunk, encoding); - cb(); - } - , read: function (size) { - var x = this.__my_socket.read(size); - if (x) { - console.log('_read', size); - this.push(x); - } - } - }; - var myDuplex = new (require('streams').Duplex); myDuplex.__my_socket = socket;