bdy 1.22.67-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.67-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,14 +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
- stream.once('close', () => {
90
- this.injected -= 1;
91
- });
85
+ if (this.server)
92
86
  this.server.injectSocket(stream);
93
- }
94
87
  }
95
88
  checkValueSafe(input, allowed) {
96
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.67-master",
4
+ "version": "1.22.69-master",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {