querysub 0.410.0 → 0.412.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
|
@@ -147,13 +147,16 @@ class IdentityControllerBase {
|
|
|
147
147
|
if (!areNodeIdsEqual(payload.serverId, localNodeId)) {
|
|
148
148
|
throw new Error(`Identity is for another server! The connection is calling us ${localNodeId}, but signature is for ${payload.serverId}`);
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
if (
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
// If they're calling from the browser, then they're not going to be able to use our machine ID, etc. However, they should be calling an actual https node, so it should still be secure for them.
|
|
151
|
+
if (payload.clientIsNode) {
|
|
152
|
+
let calledMachineId = getMachineId(payload.serverId);
|
|
153
|
+
if (calledMachineId !== "127-0-0-1" && calledMachineId !== getOwnMachineId()) {
|
|
154
|
+
throw new Error(`Tried to call a different machine. We are ${getOwnMachineId()}, they called ${calledMachineId}`);
|
|
155
|
+
}
|
|
156
|
+
let calledThreadId = decodeNodeId(payload.serverId)?.threadId;
|
|
157
|
+
if (calledThreadId && calledThreadId !== "127-0-0-1" && calledThreadId !== getOwnThreadId()) {
|
|
158
|
+
throw new Error(`Tried to call a different thread. We are ${getOwnThreadId()}, they called ${calledThreadId}`);
|
|
159
|
+
}
|
|
157
160
|
}
|
|
158
161
|
|
|
159
162
|
|
|
@@ -19,7 +19,7 @@ import { getControllerNodeIdList } from "../-g-core-values/NodeCapabilities";
|
|
|
19
19
|
import { blue, magenta } from "socket-function/src/formatting/logColors";
|
|
20
20
|
import { errorToUndefined } from "../errors";
|
|
21
21
|
import { deploySchema } from "./deploySchema";
|
|
22
|
-
import { proxyWatcher } from "../2-proxy/PathValueProxyWatcher";
|
|
22
|
+
import { atomic, proxyWatcher } from "../2-proxy/PathValueProxyWatcher";
|
|
23
23
|
import { Querysub } from "../4-querysub/QuerysubController";
|
|
24
24
|
import { onEdgeNodesChanged } from "./edgeBootstrap";
|
|
25
25
|
import { startEdgeNotifier } from "./edgeClientWatcher";
|
|
@@ -82,6 +82,7 @@ export async function registerEdgeNode(config: {
|
|
|
82
82
|
if (!SocketFunction.isMounted()) {
|
|
83
83
|
throw new Error("registerEdgeNode must be called after SocketFunction.mount");
|
|
84
84
|
}
|
|
85
|
+
console.log(magenta(`registerEdgeNode ${JSON.stringify(config.host)}`));
|
|
85
86
|
|
|
86
87
|
if (registeredEdgeNode) {
|
|
87
88
|
throw new Error(`registerEdgeNode already called. Should only host 1 edgeNode per node. Previously registered with ${JSON.stringify(registeredEdgeNode)}, new call used ${JSON.stringify(config)}`);
|
|
@@ -272,9 +273,14 @@ async function updateEdgeNodesFile() {
|
|
|
272
273
|
|
|
273
274
|
let liveHash = "";
|
|
274
275
|
if (!noSyncing()) {
|
|
275
|
-
liveHash = await Querysub.
|
|
276
|
-
return
|
|
276
|
+
liveHash = await Querysub.commitAsync(() => {
|
|
277
|
+
return atomic(deploySchema()[getDomain()].deploy.live.hash);
|
|
277
278
|
});
|
|
279
|
+
if (!liveHash) {
|
|
280
|
+
require("debugbreak")(2);
|
|
281
|
+
debugger;
|
|
282
|
+
throw new Error(`No live hash set?`);
|
|
283
|
+
}
|
|
278
284
|
}
|
|
279
285
|
|
|
280
286
|
let diff = !!compareArray(edgeNodeNodeIds.sort(), prevEdgeNodeIndex.edgeNodes.map(x => x.nodeId).sort());
|
|
@@ -75,8 +75,8 @@ export async function auditDiskValues(spec: AuthoritySpec) {
|
|
|
75
75
|
serverSnapshotsByAuthority.set(authority.nodeId, { spec: authority, serverMap });
|
|
76
76
|
authoritiesLoaded++;
|
|
77
77
|
console.log(magenta(`Loaded authority ${magenta(String(authoritiesLoaded))}/${green(formatNumber(authoritiesToCheck.length))}: ${authority.nodeId} (${magenta(formatNumber(serverSnapshot.length))} entries)`));
|
|
78
|
-
} catch (error) {
|
|
79
|
-
console.
|
|
78
|
+
} catch (error: any) {
|
|
79
|
+
console.warn(`Failed to get audit snapshot from authority ${authority.nodeId}`, { error: error.stack });
|
|
80
80
|
}
|
|
81
81
|
}));
|
|
82
82
|
let timeLoadAuthorities = Date.now() - timeStartLoadAuthorities;
|
package/tempnotes.txt
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
1) The machines think they're using a local IP, so something's wrong with how they're determining their own IP.
|
|
3
|
+
2) The machines all think their port is the same, but they shouldn't think that.
|
|
4
|
+
|
|
5
|
+
Oh, we broke our live file at some time. The host of everything is saying it's the same thing. It's just wrong. That's not the host based on the node ID. Where did that even come from?
|
|
6
|
+
|
|
7
|
+
Oh, our live hash in the edge node index file is wrong. Let's see if it's wrong in the database or if we're just creating the file wrong.
|
|
8
|
+
- As in, it's corrupted, as in it's the string object representation.
|
|
9
|
+
|
|
10
|
+
1) Test local querysub server
|
|
11
|
+
1.0) If it doesn't work, try to run the test script with a simple watcher to see if we can sync paths
|
|
12
|
+
1.1) If it does... run a public querysub server locally?
|
|
13
|
+
|
|
14
|
+
Well, let's run locally and see if our local query subserver works.
|
|
15
|
+
|
|
16
|
+
It's not working. The server isn't starting up.
|
|
17
|
+
|
|
2
18
|
|
|
3
19
|
3) Deploy EVERYTHING (all services) to remote servers
|
|
4
20
|
3.0) deploy the path value servers shard it like we were testing locally
|
package/test.ts
CHANGED
|
@@ -9,18 +9,19 @@ import { green, yellow } from "socket-function/src/formatting/logColors";
|
|
|
9
9
|
import { Querysub } from "./src/4-querysub/Querysub";
|
|
10
10
|
import { pathValueArchives } from "./src/0-path-value-core/pathValueArchives";
|
|
11
11
|
import { getAllAuthoritySpec } from "./src/0-path-value-core/PathRouterServerAuthoritySpec";
|
|
12
|
+
import { deploySchema } from "./src/4-deploy/deploySchema";
|
|
13
|
+
import { getDomain } from "./src/config";
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
async function main() {
|
|
15
17
|
await Querysub.hostService("test");
|
|
16
18
|
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
routeStart: 0.5,
|
|
22
|
-
routeEnd: 0.6,
|
|
19
|
+
let test = await Querysub.commitAsync(() => {
|
|
20
|
+
let live = deploySchema()[getDomain()].deploy.live.hash;
|
|
21
|
+
console.log({ live });
|
|
22
|
+
return String(live);
|
|
23
23
|
});
|
|
24
|
+
console.log({ test });
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
main().catch(console.error)
|