querysub 0.315.0 → 0.316.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
|
@@ -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
|
|
@@ -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>}
|
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
|
|
8
|
-
console.log(
|
|
9
|
-
|
|
10
|
-
console.log(getOwnThreadId());
|
|
11
|
-
|
|
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++) {
|