bdy 1.23.6-dev → 1.23.7-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/distTs/package.json +10 -2
- package/distTs/src/agent/linux.js +53 -3
- package/distTs/src/agent/manager.js +3 -6
- package/distTs/src/agent/osx.js +51 -3
- package/distTs/src/agent/system.js +400 -21
- package/distTs/src/agent/windows.js +4 -7
- package/distTs/src/command/agent/debug.js +2 -2
- package/distTs/src/command/agent/install.js +37 -10
- package/distTs/src/command/agent/restart.js +2 -2
- package/distTs/src/command/agent/run.js +3 -0
- package/distTs/src/command/agent/start.js +2 -2
- package/distTs/src/command/agent/status.js +19 -0
- package/distTs/src/command/agent/stop.js +2 -2
- package/distTs/src/command/agent/uninstall.js +5 -8
- package/distTs/src/command/agent/update.js +2 -2
- package/distTs/src/command/artifact/publish.js +3 -1
- package/distTs/src/command/version.js +13 -5
- package/distTs/src/logger.js +40 -4
- package/distTs/src/texts.js +35 -19
- package/distTs/src/utils.js +98 -3
- package/node_modules/asn1/Jenkinsfile +65 -0
- package/node_modules/asn1/LICENSE +19 -0
- package/node_modules/asn1/README.md +50 -0
- package/node_modules/asn1/lib/ber/errors.js +13 -0
- package/node_modules/asn1/lib/ber/index.js +27 -0
- package/node_modules/asn1/lib/ber/reader.js +262 -0
- package/node_modules/asn1/lib/ber/types.js +36 -0
- package/node_modules/asn1/lib/ber/writer.js +317 -0
- package/node_modules/asn1/lib/index.js +20 -0
- package/node_modules/asn1/package.json +31 -0
- package/node_modules/bcrypt-pbkdf/CONTRIBUTING.md +13 -0
- package/node_modules/bcrypt-pbkdf/LICENSE +66 -0
- package/node_modules/bcrypt-pbkdf/README.md +45 -0
- package/node_modules/bcrypt-pbkdf/index.js +556 -0
- package/node_modules/bcrypt-pbkdf/package.json +15 -0
- package/node_modules/safer-buffer/LICENSE +21 -0
- package/node_modules/safer-buffer/Porting-Buffer.md +268 -0
- package/node_modules/safer-buffer/Readme.md +156 -0
- package/node_modules/safer-buffer/dangerous.js +58 -0
- package/node_modules/safer-buffer/package.json +34 -0
- package/node_modules/safer-buffer/safer.js +77 -0
- package/node_modules/safer-buffer/tests.js +406 -0
- package/node_modules/ssh2/.eslintignore +4 -0
- package/node_modules/ssh2/.eslintrc.js +5 -0
- package/node_modules/ssh2/.github/workflows/ci.yml +110 -0
- package/node_modules/ssh2/.github/workflows/lint.yml +27 -0
- package/node_modules/ssh2/LICENSE +19 -0
- package/node_modules/ssh2/README.md +1529 -0
- package/node_modules/ssh2/SFTP.md +413 -0
- package/node_modules/ssh2/examples/server-chat.js +238 -0
- package/node_modules/ssh2/examples/sftp-server-download-only.js +134 -0
- package/node_modules/ssh2/install.js +27 -0
- package/node_modules/ssh2/lib/Channel.js +295 -0
- package/node_modules/ssh2/lib/agent.js +1123 -0
- package/node_modules/ssh2/lib/client.js +2176 -0
- package/node_modules/ssh2/lib/http-agents.js +84 -0
- package/node_modules/ssh2/lib/index.js +44 -0
- package/node_modules/ssh2/lib/keygen.js +582 -0
- package/node_modules/ssh2/lib/protocol/Protocol.js +2136 -0
- package/node_modules/ssh2/lib/protocol/SFTP.js +4052 -0
- package/node_modules/ssh2/lib/protocol/constants.js +356 -0
- package/node_modules/ssh2/lib/protocol/crypto/binding.gyp +23 -0
- package/node_modules/ssh2/lib/protocol/crypto/poly1305.js +43 -0
- package/node_modules/ssh2/lib/protocol/crypto/src/binding.cc +2300 -0
- package/node_modules/ssh2/lib/protocol/crypto.js +1602 -0
- package/node_modules/ssh2/lib/protocol/handlers.js +16 -0
- package/node_modules/ssh2/lib/protocol/handlers.misc.js +1285 -0
- package/node_modules/ssh2/lib/protocol/kex.js +1908 -0
- package/node_modules/ssh2/lib/protocol/keyParser.js +1484 -0
- package/node_modules/ssh2/lib/protocol/node-fs-compat.js +115 -0
- package/node_modules/ssh2/lib/protocol/utils.js +356 -0
- package/node_modules/ssh2/lib/protocol/zlib.js +255 -0
- package/node_modules/ssh2/lib/server.js +1380 -0
- package/node_modules/ssh2/lib/utils.js +336 -0
- package/node_modules/ssh2/package.json +49 -0
- package/node_modules/ssh2/test/common.js +316 -0
- package/node_modules/ssh2/test/fixtures/bad_rsa_private_key +26 -0
- package/node_modules/ssh2/test/fixtures/https_cert.pem +33 -0
- package/node_modules/ssh2/test/fixtures/https_key.pem +52 -0
- package/node_modules/ssh2/test/fixtures/id_dsa +12 -0
- package/node_modules/ssh2/test/fixtures/id_ecdsa +5 -0
- package/node_modules/ssh2/test/fixtures/id_rsa +15 -0
- package/node_modules/ssh2/test/fixtures/id_rsa.ppk +26 -0
- package/node_modules/ssh2/test/fixtures/id_rsa_enc +30 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa +21 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc +22 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm +23 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa +9 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc +10 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm +10 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519 +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa +27 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc +28 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm +29 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa +12 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc +15 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa +5 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa +27 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc +30 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256 +54 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub.result +6 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.result +6 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc +17 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa +26 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc +18 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub +9 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub +10 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub +11 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub +11 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub +13 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/openssh_new_rsa +27 -0
- package/node_modules/ssh2/test/fixtures/ssh_host_dsa_key +12 -0
- package/node_modules/ssh2/test/fixtures/ssh_host_ecdsa_key +5 -0
- package/node_modules/ssh2/test/fixtures/ssh_host_rsa_key +15 -0
- package/node_modules/ssh2/test/test-exec.js +578 -0
- package/node_modules/ssh2/test/test-integration-openssh.js +486 -0
- package/node_modules/ssh2/test/test-keygen.js +60 -0
- package/node_modules/ssh2/test/test-misc-client-server.js +1460 -0
- package/node_modules/ssh2/test/test-openssh.js +261 -0
- package/node_modules/ssh2/test/test-protocol-crypto.js +631 -0
- package/node_modules/ssh2/test/test-protocol-keyparser.js +177 -0
- package/node_modules/ssh2/test/test-server-hostkeys.js +138 -0
- package/node_modules/ssh2/test/test-sftp.js +842 -0
- package/node_modules/ssh2/test/test-shell.js +109 -0
- package/node_modules/ssh2/test/test-userauth-agent-openssh.js +110 -0
- package/node_modules/ssh2/test/test-userauth-agent.js +171 -0
- package/node_modules/ssh2/test/test-userauth.js +611 -0
- package/node_modules/ssh2/test/test-worker-imports.js +25 -0
- package/node_modules/ssh2/test/test.js +20 -0
- package/node_modules/ssh2/util/build_pagent.bat +2 -0
- package/node_modules/ssh2/util/pagent.c +88 -0
- package/node_modules/ssh2/util/pagent.exe +0 -0
- package/node_modules/tweetnacl/.npmignore +4 -0
- package/node_modules/tweetnacl/AUTHORS.md +28 -0
- package/node_modules/tweetnacl/CHANGELOG.md +221 -0
- package/node_modules/tweetnacl/LICENSE +24 -0
- package/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md +20 -0
- package/node_modules/tweetnacl/README.md +459 -0
- package/node_modules/tweetnacl/nacl-fast.js +2388 -0
- package/node_modules/tweetnacl/nacl-fast.min.js +2 -0
- package/node_modules/tweetnacl/nacl.d.ts +98 -0
- package/node_modules/tweetnacl/nacl.js +1175 -0
- package/node_modules/tweetnacl/nacl.min.js +1 -0
- package/node_modules/tweetnacl/package.json +58 -0
- package/package.json +10 -2
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { kMaxLength } = require('buffer');
|
|
4
|
+
const {
|
|
5
|
+
createInflate,
|
|
6
|
+
constants: {
|
|
7
|
+
DEFLATE,
|
|
8
|
+
INFLATE,
|
|
9
|
+
Z_DEFAULT_CHUNK,
|
|
10
|
+
Z_DEFAULT_COMPRESSION,
|
|
11
|
+
Z_DEFAULT_MEMLEVEL,
|
|
12
|
+
Z_DEFAULT_STRATEGY,
|
|
13
|
+
Z_DEFAULT_WINDOWBITS,
|
|
14
|
+
Z_PARTIAL_FLUSH,
|
|
15
|
+
}
|
|
16
|
+
} = require('zlib');
|
|
17
|
+
const ZlibHandle = createInflate()._handle.constructor;
|
|
18
|
+
|
|
19
|
+
function processCallback() {
|
|
20
|
+
throw new Error('Should not get here');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function zlibOnError(message, errno, code) {
|
|
24
|
+
const self = this._owner;
|
|
25
|
+
// There is no way to cleanly recover.
|
|
26
|
+
// Continuing only obscures problems.
|
|
27
|
+
|
|
28
|
+
const error = new Error(message);
|
|
29
|
+
error.errno = errno;
|
|
30
|
+
error.code = code;
|
|
31
|
+
self._err = error;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function _close(engine) {
|
|
35
|
+
// Caller may invoke .close after a zlib error (which will null _handle).
|
|
36
|
+
if (!engine._handle)
|
|
37
|
+
return;
|
|
38
|
+
|
|
39
|
+
engine._handle.close();
|
|
40
|
+
engine._handle = null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
class Zlib {
|
|
44
|
+
constructor(mode) {
|
|
45
|
+
const windowBits = Z_DEFAULT_WINDOWBITS;
|
|
46
|
+
const level = Z_DEFAULT_COMPRESSION;
|
|
47
|
+
const memLevel = Z_DEFAULT_MEMLEVEL;
|
|
48
|
+
const strategy = Z_DEFAULT_STRATEGY;
|
|
49
|
+
const dictionary = undefined;
|
|
50
|
+
|
|
51
|
+
this._err = undefined;
|
|
52
|
+
this._writeState = new Uint32Array(2);
|
|
53
|
+
this._chunkSize = Z_DEFAULT_CHUNK;
|
|
54
|
+
this._maxOutputLength = kMaxLength;
|
|
55
|
+
this._outBuffer = Buffer.allocUnsafe(this._chunkSize);
|
|
56
|
+
this._outOffset = 0;
|
|
57
|
+
|
|
58
|
+
this._handle = new ZlibHandle(mode);
|
|
59
|
+
this._handle._owner = this;
|
|
60
|
+
this._handle.onerror = zlibOnError;
|
|
61
|
+
this._handle.init(windowBits,
|
|
62
|
+
level,
|
|
63
|
+
memLevel,
|
|
64
|
+
strategy,
|
|
65
|
+
this._writeState,
|
|
66
|
+
processCallback,
|
|
67
|
+
dictionary);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
writeSync(chunk, retChunks) {
|
|
71
|
+
const handle = this._handle;
|
|
72
|
+
if (!handle)
|
|
73
|
+
throw new Error('Invalid Zlib instance');
|
|
74
|
+
|
|
75
|
+
let availInBefore = chunk.length;
|
|
76
|
+
let availOutBefore = this._chunkSize - this._outOffset;
|
|
77
|
+
let inOff = 0;
|
|
78
|
+
let availOutAfter;
|
|
79
|
+
let availInAfter;
|
|
80
|
+
|
|
81
|
+
let buffers;
|
|
82
|
+
let nread = 0;
|
|
83
|
+
const state = this._writeState;
|
|
84
|
+
let buffer = this._outBuffer;
|
|
85
|
+
let offset = this._outOffset;
|
|
86
|
+
const chunkSize = this._chunkSize;
|
|
87
|
+
|
|
88
|
+
while (true) {
|
|
89
|
+
handle.writeSync(Z_PARTIAL_FLUSH,
|
|
90
|
+
chunk, // in
|
|
91
|
+
inOff, // in_off
|
|
92
|
+
availInBefore, // in_len
|
|
93
|
+
buffer, // out
|
|
94
|
+
offset, // out_off
|
|
95
|
+
availOutBefore); // out_len
|
|
96
|
+
if (this._err)
|
|
97
|
+
throw this._err;
|
|
98
|
+
|
|
99
|
+
availOutAfter = state[0];
|
|
100
|
+
availInAfter = state[1];
|
|
101
|
+
|
|
102
|
+
const inDelta = availInBefore - availInAfter;
|
|
103
|
+
const have = availOutBefore - availOutAfter;
|
|
104
|
+
|
|
105
|
+
if (have > 0) {
|
|
106
|
+
const out = (offset === 0 && have === buffer.length
|
|
107
|
+
? buffer
|
|
108
|
+
: buffer.slice(offset, offset + have));
|
|
109
|
+
offset += have;
|
|
110
|
+
if (!buffers)
|
|
111
|
+
buffers = out;
|
|
112
|
+
else if (buffers.push === undefined)
|
|
113
|
+
buffers = [buffers, out];
|
|
114
|
+
else
|
|
115
|
+
buffers.push(out);
|
|
116
|
+
nread += out.byteLength;
|
|
117
|
+
|
|
118
|
+
if (nread > this._maxOutputLength) {
|
|
119
|
+
_close(this);
|
|
120
|
+
throw new Error(
|
|
121
|
+
`Output length exceeded maximum of ${this._maxOutputLength}`
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
} else if (have !== 0) {
|
|
125
|
+
throw new Error('have should not go down');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Exhausted the output buffer, or used all the input create a new one.
|
|
129
|
+
if (availOutAfter === 0 || offset >= chunkSize) {
|
|
130
|
+
availOutBefore = chunkSize;
|
|
131
|
+
offset = 0;
|
|
132
|
+
buffer = Buffer.allocUnsafe(chunkSize);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (availOutAfter === 0) {
|
|
136
|
+
// Not actually done. Need to reprocess.
|
|
137
|
+
// Also, update the availInBefore to the availInAfter value,
|
|
138
|
+
// so that if we have to hit it a third (fourth, etc.) time,
|
|
139
|
+
// it'll have the correct byte counts.
|
|
140
|
+
inOff += inDelta;
|
|
141
|
+
availInBefore = availInAfter;
|
|
142
|
+
} else {
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
this._outBuffer = buffer;
|
|
148
|
+
this._outOffset = offset;
|
|
149
|
+
|
|
150
|
+
if (nread === 0)
|
|
151
|
+
buffers = Buffer.alloc(0);
|
|
152
|
+
|
|
153
|
+
if (retChunks) {
|
|
154
|
+
buffers.totalLen = nread;
|
|
155
|
+
return buffers;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (buffers.push === undefined)
|
|
159
|
+
return buffers;
|
|
160
|
+
|
|
161
|
+
const output = Buffer.allocUnsafe(nread);
|
|
162
|
+
for (let i = 0, p = 0; i < buffers.length; ++i) {
|
|
163
|
+
const buf = buffers[i];
|
|
164
|
+
output.set(buf, p);
|
|
165
|
+
p += buf.length;
|
|
166
|
+
}
|
|
167
|
+
return output;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
class ZlibPacketWriter {
|
|
172
|
+
constructor(protocol) {
|
|
173
|
+
this.allocStart = 0;
|
|
174
|
+
this.allocStartKEX = 0;
|
|
175
|
+
this._protocol = protocol;
|
|
176
|
+
this._zlib = new Zlib(DEFLATE);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
cleanup() {
|
|
180
|
+
if (this._zlib)
|
|
181
|
+
_close(this._zlib);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
alloc(payloadSize, force) {
|
|
185
|
+
return Buffer.allocUnsafe(payloadSize);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
finalize(payload, force) {
|
|
189
|
+
if (this._protocol._kexinit === undefined || force) {
|
|
190
|
+
const output = this._zlib.writeSync(payload, true);
|
|
191
|
+
const packet = this._protocol._cipher.allocPacket(output.totalLen);
|
|
192
|
+
if (output.push === undefined) {
|
|
193
|
+
packet.set(output, 5);
|
|
194
|
+
} else {
|
|
195
|
+
for (let i = 0, p = 5; i < output.length; ++i) {
|
|
196
|
+
const chunk = output[i];
|
|
197
|
+
packet.set(chunk, p);
|
|
198
|
+
p += chunk.length;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return packet;
|
|
202
|
+
}
|
|
203
|
+
return payload;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
class PacketWriter {
|
|
208
|
+
constructor(protocol) {
|
|
209
|
+
this.allocStart = 5;
|
|
210
|
+
this.allocStartKEX = 5;
|
|
211
|
+
this._protocol = protocol;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
cleanup() {}
|
|
215
|
+
|
|
216
|
+
alloc(payloadSize, force) {
|
|
217
|
+
if (this._protocol._kexinit === undefined || force)
|
|
218
|
+
return this._protocol._cipher.allocPacket(payloadSize);
|
|
219
|
+
return Buffer.allocUnsafe(payloadSize);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
finalize(packet, force) {
|
|
223
|
+
return packet;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
class ZlibPacketReader {
|
|
228
|
+
constructor() {
|
|
229
|
+
this._zlib = new Zlib(INFLATE);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
cleanup() {
|
|
233
|
+
if (this._zlib)
|
|
234
|
+
_close(this._zlib);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
read(data) {
|
|
238
|
+
return this._zlib.writeSync(data, false);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
class PacketReader {
|
|
243
|
+
cleanup() {}
|
|
244
|
+
|
|
245
|
+
read(data) {
|
|
246
|
+
return data;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
module.exports = {
|
|
251
|
+
PacketReader,
|
|
252
|
+
PacketWriter,
|
|
253
|
+
ZlibPacketReader,
|
|
254
|
+
ZlibPacketWriter,
|
|
255
|
+
};
|