querysub 0.527.0 → 0.528.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/bin/storageserve.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
require("typenode");
|
|
4
|
-
require("../src/
|
|
5
|
-
const config = require("../src/config");
|
|
6
|
-
let url = `https://storage.${config.getDomain()}:${config.getPort()}`;
|
|
7
|
-
process.argv.push(`--url=${url}`);
|
|
8
|
-
require("sliftutils/storage/remoteStorage/storageServerCli");
|
|
4
|
+
require("../src/storageSetup.ts");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "querysub",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.528.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,7 +71,7 @@
|
|
|
71
71
|
"pako": "^2.1.0",
|
|
72
72
|
"peggy": "^5.0.6",
|
|
73
73
|
"sliftutils": "^1.7.5",
|
|
74
|
-
"socket-function": "^1.2.
|
|
74
|
+
"socket-function": "^1.2.16",
|
|
75
75
|
"terser": "^5.31.0",
|
|
76
76
|
"typenode": "^6.6.1",
|
|
77
77
|
"typesafecss": "^0.32.0",
|
|
@@ -197,7 +197,7 @@ class IdentityControllerBase {
|
|
|
197
197
|
});
|
|
198
198
|
|
|
199
199
|
let duration = Date.now() - time;
|
|
200
|
-
console.
|
|
200
|
+
console.info(`Authenticated identity for ${caller.nodeId} in ${formatTime(duration)}, at ${Date.now()}`, {
|
|
201
201
|
clientId: caller.nodeId,
|
|
202
202
|
reconnectNodeId,
|
|
203
203
|
duration,
|
|
@@ -208,7 +208,7 @@ class IdentityControllerBase {
|
|
|
208
208
|
SocketFunction.onNextDisconnect(caller.nodeId, () => {
|
|
209
209
|
// NOTE: I don't really see any purpose of deleting from caller info. I don't think we're going to run out of memory because of too many callers authenticating.
|
|
210
210
|
// However, logging here is useful as it allows us to complete the life cycle so we know how long a client was connected for.
|
|
211
|
-
console.
|
|
211
|
+
console.info(`Disconnected client`, {
|
|
212
212
|
clientId: caller.nodeId,
|
|
213
213
|
});
|
|
214
214
|
});
|
|
@@ -104,6 +104,11 @@ let populateTrustedCache = lazy(async () => {
|
|
|
104
104
|
}, TRUSTED_CACHE_RESET_INTERVAL);
|
|
105
105
|
});
|
|
106
106
|
|
|
107
|
+
export async function getTrustedMachineIds() {
|
|
108
|
+
await populateTrustedCache();
|
|
109
|
+
return Array.from(trustedCache);
|
|
110
|
+
}
|
|
111
|
+
|
|
107
112
|
export async function isNodeTrusted(nodeId: string) {
|
|
108
113
|
let domainName = getNodeIdDomainMaybeUndefined(nodeId);
|
|
109
114
|
if (!domainName) return false;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import "./inject";
|
|
2
|
+
import { getDomain, getPort } from "./config";
|
|
3
|
+
import { getTrustedMachineIds } from "./-d-trust/NetworkTrust2";
|
|
4
|
+
import { getExternalIP } from "socket-function/src/networking";
|
|
5
|
+
|
|
6
|
+
// The storage server entry point (see bin/storageserve.js): sets up the CLI args the sliftutils storage server expects, synchronizes our network trust list into its trust store, and runs its CLI.
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
if (!process.argv.includes("--url")) {
|
|
10
|
+
let ip = await getExternalIP();
|
|
11
|
+
let ipDomain = ip.replaceAll(".", "-");
|
|
12
|
+
process.argv.push("--url", `https://${ipDomain}.${getDomain()}:${getPort()}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let trustedMachineIds = await getTrustedMachineIds();
|
|
16
|
+
|
|
17
|
+
let { setTrustedMachines } = await import("sliftutils/storage/remoteStorage/storageServerState");
|
|
18
|
+
await setTrustedMachines({ account: "root", machineIds: trustedMachineIds });
|
|
19
|
+
console.log(`Synchronized ${trustedMachineIds.length} trusted machines`);
|
|
20
|
+
|
|
21
|
+
await import("sliftutils/storage/remoteStorage/storageServerCli");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
main().catch(e => {
|
|
25
|
+
console.error(e.stack || e);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
});
|
package/test.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { chdir } from "process";
|
|
2
|
-
import {
|
|
2
|
+
import { getRecords, setRecord } from "./src/-b-authorities/dnsAuthority";
|
|
3
3
|
import { timeInMinute } from "socket-function/src/misc";
|
|
4
4
|
chdir("D:/repos/qs-cyoa/");
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
async function main() {
|
|
8
|
-
let rawRecords = await
|
|
8
|
+
let rawRecords = await getRecords("A", "test.querysubtest.com");
|
|
9
9
|
for (let record of rawRecords) {
|
|
10
10
|
console.log(record);
|
|
11
11
|
}
|