From 30777af804774495eeb36a83b98a126e52942cf5 Mon Sep 17 00:00:00 2001 From: tigerbot Date: Tue, 13 Jun 2017 14:32:26 -0600 Subject: [PATCH] stopped using `stream-pair` --- lib/goldilocks.js | 22 ++++------------------ package-lock.json | 4 ---- package.json | 1 - 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/lib/goldilocks.js b/lib/goldilocks.js index 3c510ae..75ac256 100644 --- a/lib/goldilocks.js +++ b/lib/goldilocks.js @@ -122,7 +122,6 @@ module.exports.create = function (deps, config) { // here "writer" means the remote-looking part of the socket that driving the connection var writer; var wrapOpts = {}; - var rawTls = opts.tls || (0x16 === opts.data[0]) && (0x01 === opts.data[5]); function usePair(err, reader) { if (err) { @@ -160,8 +159,6 @@ module.exports.create = function (deps, config) { netHandler(reader, wrapOpts); process.nextTick(function () { - //opts.data = wrapOpts.data; - // this cb will cause the stream to emit its (actually) first data event // (even though it already gave a peek into that first data chunk) console.log('[tunnel] callback, data should begin to flow'); @@ -171,22 +168,11 @@ module.exports.create = function (deps, config) { wrapOpts.firstChunk = opts.data; wrapOpts.hyperPeek = !!opts.data; - // encrypted meaning is *terminated* TLS - // tls meaning is *raw* TLS - if (rawTls) { - // TLS sockets must actually use a socket with a file descriptor - // https://nodejs.org/api/net.html#net_class_net_socket - - writer = require('socket-pair').create(function (err, other) { - usePair(err, other); - }); - } - else { - // stream-pair can only be used by TCP sockets, not tls - writer = require('stream-pair').create(); - usePair(null, writer.other); - } + // We used to use `stream-pair` for non-tls connections, but there are places + // that require properties/functions to be present on the socket that aren't + // present on a JSStream so it caused problems. + writer = require('socket-pair').create(usePair); return writer; } }; diff --git a/package-lock.json b/package-lock.json index f0f9b68..8ab7816 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1081,10 +1081,6 @@ "version": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" }, - "stream-pair": { - "version": "https://registry.npmjs.org/stream-pair/-/stream-pair-1.0.3.tgz", - "integrity": "sha1-vIdY/jnTgQuva3VMj5BI8PuRNn0=" - }, "string_decoder": { "version": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz", "integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=" diff --git a/package.json b/package.json index 7cd941a..d018c67 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,6 @@ "server-destroy": "^1.0.1", "sni": "^1.0.0", "socket-pair": "^1.0.1", - "stream-pair": "^1.0.3", "stunnel": "git+https://git.daplie.com/Daplie/node-tunnel-client.git#v1", "tunnel-packer": "^1.3.0" }