bdy 1.22.68-master → 1.22.69-master

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.22.68-master",
4
+ "version": "1.22.69-master",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -33,7 +33,6 @@ class ServerSsh extends events_1.default {
33
33
  login;
34
34
  password;
35
35
  server;
36
- injected = 0;
37
36
  constructor(agent, login, password, hostKey) {
38
37
  super();
39
38
  this.agent = agent;
@@ -83,25 +82,8 @@ class ServerSsh extends events_1.default {
83
82
  this.server = null;
84
83
  }
85
84
  handleSshTunnel(stream) {
86
- if (this.server) {
87
- this.injected += 1;
88
- logger_1.default.debug(`injectSocket: ${this.injected} concurrent injected connection(s)`);
89
- // Count inbound channel bytes the nested SSH server actually receives.
90
- // CHANNEL_DATA pushes into the readable via .push(), so wrapping it is a
91
- // read-only observation that does not change flow/backpressure.
92
- let inBytes = 0;
93
- const origPush = stream.push.bind(stream);
94
- stream.push = (chunk, enc) => {
95
- if (chunk)
96
- inBytes += chunk.length;
97
- return origPush(chunk, enc);
98
- };
99
- stream.once('close', () => {
100
- this.injected -= 1;
101
- logger_1.default.debug(`injectSocket received ${inBytes} inbound nested-SSH bytes (handshake already consumed)`);
102
- });
85
+ if (this.server)
103
86
  this.server.injectSocket(stream);
104
- }
105
87
  }
106
88
  checkValueSafe(input, allowed) {
107
89
  const autoReject = input.length !== allowed.length;
@@ -15,7 +15,6 @@ class SshClient extends events_1.default {
15
15
  password;
16
16
  keepalive;
17
17
  client;
18
- lastError;
19
18
  constructor(ip, port, username, password) {
20
19
  super();
21
20
  this.ip = ip;
@@ -31,13 +30,9 @@ class SshClient extends events_1.default {
31
30
  this.client = new ssh2_1.Client();
32
31
  this.client.setNoDelay();
33
32
  this.client.on('ready', () => {
34
- this.lastError = null;
35
33
  if (this.client) {
36
34
  this.client.removeAllListeners();
37
- this.client.on('error', (err) => {
38
- this.lastError = err;
39
- logger_1.default.debug(`SSH client transport error: ${err?.message}`);
40
- });
35
+ this.client.on('error', () => { });
41
36
  }
42
37
  resolve();
43
38
  });
@@ -73,19 +68,16 @@ class SshClient extends events_1.default {
73
68
  s.once('readable', resolve);
74
69
  });
75
70
  }
76
- async readStreamBytes(s, toRead, reads = 0) {
71
+ async readStreamBytes(s, toRead) {
77
72
  await this.waitForStreamReadable(s);
78
73
  const data = s.read(toRead) ?? s.read();
79
74
  if (data === null) {
80
- return this.readStreamBytes(s, toRead, reads + 1);
75
+ return this.readStreamBytes(s, toRead);
81
76
  }
82
77
  const newToRead = toRead - data.length;
83
- if (newToRead <= 0) {
84
- if (reads > 0)
85
- logger_1.default.debug(`handshake read took ${reads + 1} reads`);
78
+ if (newToRead <= 0)
86
79
  return data;
87
- }
88
- const newData = await this.readStreamBytes(s, newToRead, reads + 1);
80
+ const newData = await this.readStreamBytes(s, newToRead);
89
81
  return Buffer.concat([data, newData]);
90
82
  }
91
83
  async processStream(stream, info) {
@@ -153,7 +145,6 @@ class SshClient extends events_1.default {
153
145
  }
154
146
  if (type === tunnel_1.TUNNEL_SOCKET_TYPE.SSH) {
155
147
  logger_1.default.debug((0, texts_1.LOG_DETECTED_STREAM)('SSH'));
156
- logger_1.default.debug(`SSH handoff: ${stream.readableLength} leftover bytes buffered at injectSocket`);
157
148
  triggerStream(tunnel_1.TUNNEL_SSH_EVENT.STREAM_SSH, ip);
158
149
  return;
159
150
  }
@@ -189,7 +180,7 @@ class SshClient extends events_1.default {
189
180
  this.emit(tunnel_1.TUNNEL_SSH_EVENT.CONNECTED);
190
181
  if (this.client) {
191
182
  this.client.on('close', () => {
192
- logger_1.default.debug(`SSH client closed (reason: ${this.lastError?.message || 'clean close / no transport error'})`);
183
+ logger_1.default.debug(`SSH client closed`);
193
184
  if (this.keepalive)
194
185
  this.openKeepAlive();
195
186
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.22.68-master",
4
+ "version": "1.22.69-master",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {