querysub 0.314.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;
|
|
@@ -168,7 +147,7 @@ const runEdgeDomainAliveLoop = lazy(() => {
|
|
|
168
147
|
// NOTE: Our DNS TTL is 1 minute, which means no matter how fast we poll,
|
|
169
148
|
// we can't get below that. Of course the worst case is that + our poll rate,
|
|
170
149
|
// but still, this means there is less and less benefit the lower this value is.
|
|
171
|
-
runInfinitePoll(timeInMinute, checkEdgeDomainsAlive);
|
|
150
|
+
runInfinitePoll(timeInMinute * 3, checkEdgeDomainsAlive);
|
|
172
151
|
});
|
|
173
152
|
async function checkEdgeDomainsAlive() {
|
|
174
153
|
if (isNoNetwork()) return;
|
|
@@ -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
|
}
|
|
@@ -207,55 +192,51 @@ async function publishEdgeDomain() {
|
|
|
207
192
|
if (callerIP === "0.0.0.0") {
|
|
208
193
|
callerIP = await getExternalIP();
|
|
209
194
|
}
|
|
195
|
+
if (!callerIP) {
|
|
196
|
+
console.warn(`publishEdgeDomain called before SocketFunction.mount was called, so we don't know the public ip.`);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
210
199
|
// IMPORTANT! We have to set our A record AFTER we create our cert, otherwise we might wait a while
|
|
211
200
|
// with our A record public while we create our cert.
|
|
212
201
|
runEdgeDomainAliveLoop();
|
|
213
202
|
const edgeDomain = getDomain();
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
203
|
+
console.log(`Starting publish check for A record for ${edgeDomain} to ${callerIP}`);
|
|
204
|
+
try {
|
|
205
|
+
let promises: Promise<void>[] = [];
|
|
206
|
+
let existingIPs = await getRecords("A", edgeDomain);
|
|
207
|
+
if (!isPublic()) {
|
|
208
|
+
if (existingIPs.length === 0) {
|
|
209
|
+
promises.push(addRecord("A", edgeDomain, callerIP));
|
|
210
|
+
} else if (existingIPs.length === 1 && existingIPs[0] === "127.0.0.1") {
|
|
211
|
+
// Good, do nothing
|
|
212
|
+
} else {
|
|
213
|
+
// Don't remove the public servers, this is probably just us accidentally running a
|
|
214
|
+
// test script for a public domain.
|
|
215
|
+
/*
|
|
216
|
+
// Maybe they took down all the public servers?
|
|
217
|
+
await removeDeadARecords();
|
|
218
|
+
existingIPs = await getRecords("A", edgeDomain);
|
|
219
219
|
if (existingIPs.length === 0) {
|
|
220
|
-
|
|
221
|
-
} else if (existingIPs.length === 1 && existingIPs[0] === "127.0.0.1") {
|
|
222
|
-
// Good, do nothing
|
|
220
|
+
await addRecord("A", edgeDomain, callerIP);
|
|
223
221
|
} else {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
/*
|
|
227
|
-
// Maybe they took down all the public servers?
|
|
228
|
-
await removeDeadARecords();
|
|
229
|
-
existingIPs = await getRecords("A", edgeDomain);
|
|
230
|
-
if (existingIPs.length === 0) {
|
|
231
|
-
await addRecord("A", edgeDomain, callerIP);
|
|
232
|
-
} else {
|
|
233
|
-
await addRecord("A", "127-0-0-1." + edgeDomain, "127.0.0.1");
|
|
234
|
-
console.warn(`Tried to serve an edge node on the local domain, but SocketFunction.mount did NOT specify a public ip (ex, { ip: "0.0.0.0" }) AND there are already existing public servers. You can't load balance between real ips and 127.0.0.1! ${existingIPs.join(", ")}. You will need to use 127-0-0-1.${edgeDomain} to access the local server (instead of just ${edgeDomain}).`);
|
|
235
|
-
}
|
|
236
|
-
*/
|
|
237
|
-
console.log(yellow(`Current process is not marked as public, but machine previous had public services. NOT setting ${edgeDomain} to 127.0.0.1, as this would make the public services inaccessible. Assuming the current process is for development, I recommend using 127-0-0-1.${edgeDomain} or 127-0-0-1.${edgeDomain} to access the server.`));
|
|
222
|
+
await addRecord("A", "127-0-0-1." + edgeDomain, "127.0.0.1");
|
|
223
|
+
console.warn(`Tried to serve an edge node on the local domain, but SocketFunction.mount did NOT specify a public ip (ex, { ip: "0.0.0.0" }) AND there are already existing public servers. You can't load balance between real ips and 127.0.0.1! ${existingIPs.join(", ")}. You will need to use 127-0-0-1.${edgeDomain} to access the local server (instead of just ${edgeDomain}).`);
|
|
238
224
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
let ips = await getRecords("A", edgeDomain);
|
|
247
|
-
if (!ips.includes(callerIP)) {
|
|
248
|
-
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!`);
|
|
249
|
-
await shutdown();
|
|
250
|
-
}
|
|
251
|
-
});
|
|
225
|
+
*/
|
|
226
|
+
console.log(yellow(`Current process is not marked as public, but machine previous had public services. NOT setting ${edgeDomain} to 127.0.0.1, as this would make the public services inaccessible. Assuming the current process is for development, I recommend using 127-0-0-1.${edgeDomain} or 127-0-0-1.${edgeDomain} to access the server.`));
|
|
227
|
+
}
|
|
228
|
+
} else {
|
|
229
|
+
if (existingIPs.includes("127.0.0.1")) {
|
|
230
|
+
console.log(magenta(`Switching from local development to production development (removing A record for 127.0.0.1, and using a real ip)`));
|
|
231
|
+
promises.push(deleteRecord("A", edgeDomain, "127.0.0.1"));
|
|
252
232
|
}
|
|
253
|
-
promises.push(addRecord("A",
|
|
254
|
-
// Add records in parallel, so we can wait for DNS propagation in parallel
|
|
255
|
-
await Promise.all(promises);
|
|
256
|
-
} catch (e) {
|
|
257
|
-
console.error(`Error updating DNS records, continuing without updating them`, e);
|
|
233
|
+
promises.push(addRecord("A", edgeDomain, callerIP, "proxied"));
|
|
258
234
|
}
|
|
235
|
+
promises.push(addRecord("A", "127-0-0-1." + edgeDomain, "127.0.0.1"));
|
|
236
|
+
// Add records in parallel, so we can wait for DNS propagation in parallel
|
|
237
|
+
await Promise.all(promises);
|
|
238
|
+
} catch (e) {
|
|
239
|
+
console.error(`Error updating DNS records, continuing without updating them`, e);
|
|
259
240
|
}
|
|
260
241
|
}
|
|
261
242
|
|
|
@@ -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>}
|
|
@@ -179,7 +179,6 @@ export class ErrorWarning extends qreact.Component {
|
|
|
179
179
|
}
|
|
180
180
|
}}
|
|
181
181
|
className={css.fontSize(12).pad2(4, 6)}
|
|
182
|
-
disabled={!this.state.suppressionInput.trim()}
|
|
183
182
|
>
|
|
184
183
|
Fixed
|
|
185
184
|
</Button>
|
|
@@ -196,7 +195,6 @@ export class ErrorWarning extends qreact.Component {
|
|
|
196
195
|
}
|
|
197
196
|
}}
|
|
198
197
|
className={css.fontSize(12).pad2(4, 6)}
|
|
199
|
-
disabled={!this.state.suppressionInput.trim()}
|
|
200
198
|
>
|
|
201
199
|
Not a bug
|
|
202
200
|
</Button>
|
|
@@ -21,6 +21,7 @@ yarn setup-machine 176.9.2.136
|
|
|
21
21
|
- Reset filter in FastArchiveViewer
|
|
22
22
|
- First observe the overlap with it and the BookOverview
|
|
23
23
|
- If we are actually on the book overview page and we close the management page then that shouldn't reset it. We just want to reset it when you change pages. Because we want you to be able to hide and show the management page quickly if you want to double check something. Generally speaking though, you won't be on a page with filter and then going back and forth. And if you are, whatever. That's just the management page. We just want to avoid the overall confusion and annoyance of having lots of pre-filled values (And mostly the confusion of having filter prefilled all the time because it's always going to be set because everyone uses it and no one resets it at the moment.
|
|
24
|
+
- DON'T reset tab. It's useful to remember the tab? Hmm... sometimes at least...
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
|
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++) {
|