bdy 1.12.9-dev → 1.12.10-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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.12.9-dev",
4
+ "version": "1.12.10-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -118,8 +118,10 @@ class Tunnel extends events_1.default {
118
118
  sshServer;
119
119
  ssh;
120
120
  started;
121
+ httpAuthClient;
121
122
  constructor({ agent, id, type, target, region, timeout, domain, name, subdomain, whitelist, tlsSettings, httpSettings, sshSettings, sshHostKey, }) {
122
123
  super();
124
+ this.httpAuthClient = {};
123
125
  if (!sshHostKey)
124
126
  sshHostKey = (0, utils_1.createSshHostKey)();
125
127
  this.agent = agent;
@@ -475,8 +477,10 @@ class Tunnel extends events_1.default {
475
477
  password: user.pass,
476
478
  })
477
479
  });
478
- if (statusCode !== 200)
480
+ if (statusCode !== 200) {
481
+ await body.dump();
479
482
  return false;
483
+ }
480
484
  const result = await body.json();
481
485
  if (!result.success)
482
486
  return false;
@@ -489,11 +493,15 @@ class Tunnel extends events_1.default {
489
493
  }
490
494
  }
491
495
  _getHttpAuthClient() {
492
- return new undici_1.Client(cfg_1.default.getTokenHost(), {
493
- connect: {
494
- rejectUnauthorized: false
495
- }
496
- });
496
+ const host = cfg_1.default.getTokenHost();
497
+ if (!this.httpAuthClient[host]) {
498
+ this.httpAuthClient[host] = new undici_1.Pool(cfg_1.default.getTokenHost(), {
499
+ connect: {
500
+ rejectUnauthorized: false,
501
+ },
502
+ });
503
+ }
504
+ return this.httpAuthClient[host];
497
505
  }
498
506
  async _httpExchangeAuthCode(code) {
499
507
  const client = this._getHttpAuthClient();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.12.9-dev",
4
+ "version": "1.12.10-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {