querysub 0.315.0 → 0.317.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "querysub",
3
- "version": "0.315.0",
3
+ "version": "0.317.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -71,27 +71,6 @@ export async function getSNICerts(config: {
71
71
  return certs;
72
72
  }
73
73
 
74
- function createGetBaseCert() {
75
- return async () => {
76
- /*
77
- // Code to create a self signed cert, for testing of expiration dates
78
- let keyPair = generateKeyPair();
79
- let certPair = createX509({
80
- keyPair,
81
- domain: rootCertDomain,
82
- // Very short duration for testing
83
- lifeSpan: 1000 * 60 * 15,
84
- issuer: "self",
85
- });
86
- return { key: certPair.key.toString(), cert: certPair.cert.toString() };
87
- //*/
88
-
89
- return getHTTPSKeyCert(getDomain());
90
- };
91
- }
92
-
93
- let getBaseCert = lazy(createGetBaseCert()) as () => Promise<{ key: string, cert: string }>;
94
-
95
74
  const certUpdateLoop = lazy(() => {
96
75
  logErrors((async () => {
97
76
  let firstLoop = true;
@@ -187,6 +166,12 @@ async function checkEdgeDomainsAlive() {
187
166
  for (let i = 0; i < 3; i++) {
188
167
  let isListening = await testTCPIsListening(ip, publicPort);
189
168
  if (isListening) return true;
169
+ let areWeOnline = await testTCPIsListening("1.1.1.1", publicPort);
170
+ if (!areWeOnline) {
171
+ // NOTE: I mean, while this case can happen, it also won't matter because we can't really delete the A record if we're not on the internet. I guess it's useful if we're offline when we check the IPs, but then we come back online right before we delete the records. But I doubt that will happen.t
172
+ console.warn(`Ignoring down ip, as we cannot even connect to 1.1.1.1:${publicPort}, so the other node isn't down, we're down!`);
173
+ return true;
174
+ }
190
175
  console.warn(`IP ${ip}:${publicPort} is not listening, waiting 10 seconds before retrying. If it fails 3 times in a row, the A record will be removed.`);
191
176
  await delay(timeInSecond * 10);
192
177
  }
@@ -215,6 +200,7 @@ async function publishEdgeDomain() {
215
200
  // with our A record public while we create our cert.
216
201
  runEdgeDomainAliveLoop();
217
202
  const edgeDomain = getDomain();
203
+ console.log(`Starting publish check for A record for ${edgeDomain} to ${callerIP}`);
218
204
  try {
219
205
  let promises: Promise<void>[] = [];
220
206
  let existingIPs = await getRecords("A", edgeDomain);
@@ -245,13 +231,6 @@ async function publishEdgeDomain() {
245
231
  promises.push(deleteRecord("A", edgeDomain, "127.0.0.1"));
246
232
  }
247
233
  promises.push(addRecord("A", edgeDomain, callerIP, "proxied"));
248
- runInfinitePoll(timeInMinute * 1, async () => {
249
- let ips = await getRecords("A", edgeDomain);
250
- if (!ips.includes(callerIP)) {
251
- console.error(`Our A record for ${edgeDomain} is no longer pointing to our ip (${callerIP}, as it is now pointing to ${JSON.stringify(ips)}). Terminating, hopefully when we restart we will fix it. This SHOULDN'T happen often!`);
252
- await shutdown();
253
- }
254
- });
255
234
  }
256
235
  promises.push(addRecord("A", "127-0-0-1." + edgeDomain, "127.0.0.1"));
257
236
  // Add records in parallel, so we can wait for DNS propagation in parallel
@@ -713,6 +713,8 @@ export class Querysub {
713
713
 
714
714
  sourceCheck?: MachineSourceCheck<any>;
715
715
  }) {
716
+ console.log(`Hosting server with config: ${JSON.stringify(config)}`);
717
+
716
718
  if (isClient()) {
717
719
  throw new Error(`--client processes cannot host a service. Either stop passing --client and keep the process on the network and trusted, or stop calling hostServer and call Querysub.configRootDiscoveryLocation instead.`);
718
720
  }
@@ -121,16 +121,16 @@ export class LogViewer2 extends qreact.Component {
121
121
  </div>
122
122
 
123
123
  {!errorNotifyToggleURL.value && <div className={css.hbox(10)}>
124
- <Button hue={enableLogsURL.value ? 120 : undefined} onClick={() => enableLogsURL.value = !enableLogsURL.value}>
124
+ <Button hue={enableLogsURL.value ? 120 : undefined} onClick={() => { enableLogsURL.value = !enableLogsURL.value; this.rerun(); }}>
125
125
  Logs
126
126
  </Button>
127
- <Button hue={enableInfosURL.value ? 120 : undefined} onClick={() => enableInfosURL.value = !enableInfosURL.value}>
127
+ <Button hue={enableInfosURL.value ? 120 : undefined} onClick={() => { enableInfosURL.value = !enableInfosURL.value; this.rerun(); }}>
128
128
  Infos
129
129
  </Button>
130
- <Button hue={enableWarningsURL.value ? 120 : undefined} onClick={() => enableWarningsURL.value = !enableWarningsURL.value}>
130
+ <Button hue={enableWarningsURL.value ? 120 : undefined} onClick={() => { enableWarningsURL.value = !enableWarningsURL.value; this.rerun(); }}>
131
131
  Warnings
132
132
  </Button>
133
- <Button hue={enableErrorsURL.value ? 120 : undefined} onClick={() => enableErrorsURL.value = !enableErrorsURL.value}>
133
+ <Button hue={enableErrorsURL.value ? 120 : undefined} onClick={() => { enableErrorsURL.value = !enableErrorsURL.value; this.rerun(); }}>
134
134
  Errors
135
135
  </Button>
136
136
  </div>}
@@ -5,15 +5,14 @@ Very small amount of data
5
5
 
6
6
 
7
7
 
8
- 4) Setup new hetnzer server
9
-
10
- yarn setup-machine 176.9.2.136
11
-
12
8
  5) Update all services, and move them to that machine
13
9
  5) Verify the hezner server can run the site well
14
10
  6) Take down our digital ocean server
15
11
  7) Destroy our digital ocean server
16
12
 
13
+ 10) "Started Listening" isn't being logged?
14
+ - https://127-0-0-1.querysubtest.com:7007/?enableLogs&page=login&showingmanagement&endTime=1757835685102.667&managementpage=LogViewer2&machineview=service-detail&startTime=1757745685102.667&serviceId=service-1756340309836&filter=__machineId%20%3D%20a794fbcf7b104c68%20%26%20Edge
15
+ - Or... maybe logs are lost SOMETIMES, and ALWAYS when we kill the server? Although... that would mean we have multiple issues. Ugh...
17
16
 
18
17
  6) Update URLParam to allow linking it to other parameters, resetting when they change.
19
18
  - With a function, and have standard one beside URLParam (that uses page and tab)
package/testEntry2.ts CHANGED
@@ -2,13 +2,16 @@ import { delay } from "socket-function/src/batching";
2
2
  import { getOwnMachineId } from "./src/-a-auth/certs";
3
3
  import { getOwnThreadId } from "./src/-f-node-discovery/NodeDiscovery";
4
4
  import { shutdown } from "./src/diagnostics/periodic";
5
+ import { testTCPIsListening } from "socket-function/src/networking";
5
6
 
6
7
  export async function testMain() {
7
- await delay(0);
8
- console.log(getOwnThreadId());
9
- console.error(`Test warning for ErrorWarning testing`);
10
- console.log(getOwnThreadId());
11
- await shutdown();
8
+ let test = await testTCPIsListening("1.1.1.1", 443);
9
+ console.log(test);
10
+ // await delay(0);
11
+ // console.log(getOwnThreadId());
12
+ // console.error(`Test warning for ErrorWarning testing`);
13
+ // console.log(getOwnThreadId());
14
+ // await shutdown();
12
15
  //await Querysub.hostService("test");
13
16
  // for (let i = 0; i < 1000 * 10; i++) {
14
17
  // for (let j = 0; j < 1000; j++) {