stopped using `stream-pair`
This commit is contained in:
parent
a216178ee0
commit
30777af804
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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="
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue