@session-foundation/qa-seeder 0.1.25 → 0.1.26

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/dist/index.js CHANGED
@@ -39,6 +39,27 @@ var import_lodash5 = require("lodash");
39
39
 
40
40
  // src/requests/seedRequest.ts
41
41
  var import_lodash = require("lodash");
42
+
43
+ // src/utils/httpAgents.ts
44
+ var import_http = require("http");
45
+ var import_https = require("https");
46
+ var httpAgentIPv4 = new import_http.Agent({
47
+ family: 4,
48
+ // Force IPv4
49
+ keepAlive: true
50
+ });
51
+ var httpsAgentIPv4 = new import_https.Agent({
52
+ family: 4,
53
+ // Force IPv4
54
+ keepAlive: true,
55
+ rejectUnauthorized: false
56
+ // Allow self-signed certificates for testing
57
+ });
58
+ function getAgentForUrl(url) {
59
+ return url.startsWith("https") ? httpsAgentIPv4 : httpAgentIPv4;
60
+ }
61
+
62
+ // src/requests/seedRequest.ts
42
63
  var fetchedSnodesFromSeed = {};
43
64
  async function getAllSnodesFromSeed(seedNodeUrl) {
44
65
  if (!seedNodeUrl.startsWith("http")) {
@@ -54,9 +75,12 @@ async function getAllSnodesFromSeed(seedNodeUrl) {
54
75
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
55
76
  console.info(`Fetching snodes from seed node: "${seedNodeUrl}/json_rpc"`);
56
77
  try {
57
- const result = await fetch(`${seedNodeUrl}/json_rpc`, {
78
+ const url = `${seedNodeUrl}/json_rpc`;
79
+ const result = await fetch(url, {
58
80
  body: JSON.stringify(getAll.build()),
59
- method: "POST"
81
+ method: "POST",
82
+ // @ts-expect-error - Node.js fetch supports agent option
83
+ agent: getAgentForUrl(url)
60
84
  });
61
85
  console.info("snode from list result status:", result.status);
62
86
  const json = await result.json();
@@ -430,7 +454,9 @@ var SessionUser = class {
430
454
  `https://${snode.ip}:${snode.port}/storage_rpc/v1`,
431
455
  {
432
456
  body: JSON.stringify(builtRequest),
433
- method: "POST"
457
+ method: "POST",
458
+ // @ts-expect-error - Node.js fetch supports agent option
459
+ agent: httpsAgentIPv4
434
460
  }
435
461
  );
436
462
  return ret.status;
@@ -658,7 +684,9 @@ var SessionGroup = class {
658
684
  `https://${snode.ip}:${snode.port}/storage_rpc/v1`,
659
685
  {
660
686
  body: JSON.stringify(builtRequest),
661
- method: "POST"
687
+ method: "POST",
688
+ // @ts-expect-error - Node.js fetch supports agent option
689
+ agent: httpsAgentIPv4
662
690
  }
663
691
  );
664
692
  return ret.status;
@@ -690,7 +718,9 @@ async function getSwarmOfUser(sessionId, snode) {
690
718
  `https://${snode.public_ip}:${snode.storage_port}/storage_rpc/v1`,
691
719
  {
692
720
  body: JSON.stringify(await swarmRequest.build()),
693
- method: "POST"
721
+ method: "POST",
722
+ // @ts-expect-error - Node.js fetch supports agent option
723
+ agent: httpsAgentIPv4
694
724
  }
695
725
  );
696
726
  const swarm = await swarmResult.json();
package/dist/index.mjs CHANGED
@@ -3,6 +3,27 @@ import { isArray, isEmpty as isEmpty3 } from "lodash";
3
3
 
4
4
  // src/requests/seedRequest.ts
5
5
  import { sample } from "lodash";
6
+
7
+ // src/utils/httpAgents.ts
8
+ import { Agent as HttpAgent } from "http";
9
+ import { Agent as HttpsAgent } from "https";
10
+ var httpAgentIPv4 = new HttpAgent({
11
+ family: 4,
12
+ // Force IPv4
13
+ keepAlive: true
14
+ });
15
+ var httpsAgentIPv4 = new HttpsAgent({
16
+ family: 4,
17
+ // Force IPv4
18
+ keepAlive: true,
19
+ rejectUnauthorized: false
20
+ // Allow self-signed certificates for testing
21
+ });
22
+ function getAgentForUrl(url) {
23
+ return url.startsWith("https") ? httpsAgentIPv4 : httpAgentIPv4;
24
+ }
25
+
26
+ // src/requests/seedRequest.ts
6
27
  var fetchedSnodesFromSeed = {};
7
28
  async function getAllSnodesFromSeed(seedNodeUrl) {
8
29
  if (!seedNodeUrl.startsWith("http")) {
@@ -18,9 +39,12 @@ async function getAllSnodesFromSeed(seedNodeUrl) {
18
39
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
19
40
  console.info(`Fetching snodes from seed node: "${seedNodeUrl}/json_rpc"`);
20
41
  try {
21
- const result = await fetch(`${seedNodeUrl}/json_rpc`, {
42
+ const url = `${seedNodeUrl}/json_rpc`;
43
+ const result = await fetch(url, {
22
44
  body: JSON.stringify(getAll.build()),
23
- method: "POST"
45
+ method: "POST",
46
+ // @ts-expect-error - Node.js fetch supports agent option
47
+ agent: getAgentForUrl(url)
24
48
  });
25
49
  console.info("snode from list result status:", result.status);
26
50
  const json = await result.json();
@@ -396,7 +420,9 @@ var SessionUser = class {
396
420
  `https://${snode.ip}:${snode.port}/storage_rpc/v1`,
397
421
  {
398
422
  body: JSON.stringify(builtRequest),
399
- method: "POST"
423
+ method: "POST",
424
+ // @ts-expect-error - Node.js fetch supports agent option
425
+ agent: httpsAgentIPv4
400
426
  }
401
427
  );
402
428
  return ret.status;
@@ -626,7 +652,9 @@ var SessionGroup = class {
626
652
  `https://${snode.ip}:${snode.port}/storage_rpc/v1`,
627
653
  {
628
654
  body: JSON.stringify(builtRequest),
629
- method: "POST"
655
+ method: "POST",
656
+ // @ts-expect-error - Node.js fetch supports agent option
657
+ agent: httpsAgentIPv4
630
658
  }
631
659
  );
632
660
  return ret.status;
@@ -660,7 +688,9 @@ async function getSwarmOfUser(sessionId, snode) {
660
688
  `https://${snode.public_ip}:${snode.storage_port}/storage_rpc/v1`,
661
689
  {
662
690
  body: JSON.stringify(await swarmRequest.build()),
663
- method: "POST"
691
+ method: "POST",
692
+ // @ts-expect-error - Node.js fetch supports agent option
693
+ agent: httpsAgentIPv4
664
694
  }
665
695
  );
666
696
  const swarm = await swarmResult.json();
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@session-foundation/qa-seeder",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
7
7
  "dependencies": {
8
8
  "lodash": "^4.17.21",
9
+ "@session-foundation/sodium": "^0.0.6",
9
10
  "@session-foundation/basic-types": "^0.0.6",
10
11
  "@session-foundation/mnemonic": "^0.0.8",
11
- "@session-foundation/libsession-wasm": "^0.0.10",
12
- "@session-foundation/sodium": "^0.0.6"
12
+ "@session-foundation/libsession-wasm": "^0.0.10"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@turbo/gen": "^2.4.4",