@serfab/cadre-core 1.22.0 → 1.24.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/README.md +216 -294
- package/dist/arachnode-stub.d.ts +12 -4
- package/dist/arachnode-stub.js +15 -8
- package/dist/arachnode-stub.js.map +1 -1
- package/dist/cadre-invite-protocol.js +5 -4
- package/dist/cadre-invite-protocol.js.map +1 -1
- package/dist/cadre-node.d.ts +159 -53
- package/dist/cadre-node.js +276 -89
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-authorization.d.ts +14 -2
- package/dist/control-authorization.js +8 -3
- package/dist/control-authorization.js.map +1 -1
- package/dist/control-cohort.d.ts +27 -13
- package/dist/control-cohort.js +21 -14
- package/dist/control-cohort.js.map +1 -1
- package/dist/control-database.d.ts +18 -16
- package/dist/control-database.js +57 -22
- package/dist/control-database.js.map +1 -1
- package/dist/control-protocol-guard.d.ts +1 -1
- package/dist/control-protocol-guard.js +7 -3
- package/dist/control-protocol-guard.js.map +1 -1
- package/dist/control-read-retry.d.ts +49 -11
- package/dist/control-read-retry.js +56 -15
- package/dist/control-read-retry.js.map +1 -1
- package/dist/control-retry.d.ts +32 -3
- package/dist/control-retry.js +35 -4
- package/dist/control-retry.js.map +1 -1
- package/dist/control-schema-version.d.ts +5 -5
- package/dist/control-schema-version.js +5 -5
- package/dist/control-schema-version.js.map +1 -1
- package/dist/control-schema.d.ts +5 -5
- package/dist/control-schema.js +1032 -1011
- package/dist/control-schema.js.map +1 -1
- package/dist/control-write-retry.d.ts +54 -65
- package/dist/control-write-retry.js +134 -158
- package/dist/control-write-retry.js.map +1 -1
- package/dist/delegate-admission.d.ts +1 -1
- package/dist/delegate-admission.js +1 -1
- package/dist/edge-node/config.d.ts +4 -3
- package/dist/edge-node/config.js +11 -9
- package/dist/edge-node/config.js.map +1 -1
- package/dist/edge-node/dissolve.d.ts +4 -4
- package/dist/edge-node/dissolve.js +4 -4
- package/dist/edge-node/edge-join.d.ts +1 -1
- package/dist/edge-node/edge-join.js +1 -1
- package/dist/edge-node/edge-node.js +2 -2
- package/dist/edge-node/edge-node.js.map +1 -1
- package/dist/edge-node/index.d.ts +1 -0
- package/dist/edge-node/index.js +1 -0
- package/dist/edge-node/index.js.map +1 -1
- package/dist/edge-node/join-credential.d.ts +1 -1
- package/dist/edge-node/join-credential.js +1 -1
- package/dist/edge-node/lazy-raw-storage.js +12 -0
- package/dist/edge-node/lazy-raw-storage.js.map +1 -1
- package/dist/edge-node/listen-addrs.d.ts +21 -0
- package/dist/edge-node/listen-addrs.js +25 -0
- package/dist/edge-node/listen-addrs.js.map +1 -0
- package/dist/edge-node/owner-grant.d.ts +1 -1
- package/dist/edge-node/owner-grant.js +1 -1
- package/dist/edge-node/platform.d.ts +5 -4
- package/dist/edge-node/platform.js.map +1 -1
- package/dist/edge-node/strand-move.d.ts +1 -1
- package/dist/edge-node/strand-move.js +1 -1
- package/dist/edge-node/strands.js +27 -11
- package/dist/edge-node/strands.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +18 -7
- package/dist/index.js.map +1 -1
- package/dist/invitation-bootstrap.d.ts +28 -5
- package/dist/invitation-bootstrap.js +41 -8
- package/dist/invitation-bootstrap.js.map +1 -1
- package/dist/link-budget.d.ts +53 -4
- package/dist/link-budget.js +58 -5
- package/dist/link-budget.js.map +1 -1
- package/dist/machine-removal.d.ts +2 -2
- package/dist/machine-removal.js +4 -3
- package/dist/machine-removal.js.map +1 -1
- package/dist/membership-connection-gater.d.ts +2 -2
- package/dist/membership-connection-gater.js +2 -2
- package/dist/membership-view.d.ts +2 -2
- package/dist/membership-view.js +6 -3
- package/dist/membership-view.js.map +1 -1
- package/dist/node-claim-payload.d.ts +15 -7
- package/dist/node-claim-payload.js +25 -9
- package/dist/node-claim-payload.js.map +1 -1
- package/dist/node-class.d.ts +36 -0
- package/dist/node-class.js +26 -0
- package/dist/node-class.js.map +1 -0
- package/dist/node-default-transports.d.ts +50 -3
- package/dist/node-default-transports.js +48 -3
- package/dist/node-default-transports.js.map +1 -1
- package/dist/node-roles.d.ts +118 -0
- package/dist/node-roles.js +142 -0
- package/dist/node-roles.js.map +1 -0
- package/dist/node-transports.d.ts +6 -2
- package/dist/node-transports.js +39 -7
- package/dist/node-transports.js.map +1 -1
- package/dist/owner-anchor-sync.js +1 -1
- package/dist/owner-key-export.js +1 -1
- package/dist/owner-key-flows.d.ts +1 -1
- package/dist/owner-key-store.js +1 -1
- package/dist/owner-signer.js +1 -1
- package/dist/peer-authorization.d.ts +3 -1
- package/dist/peer-authorization.js +3 -1
- package/dist/peer-authorization.js.map +1 -1
- package/dist/peer-dial.d.ts +74 -10
- package/dist/peer-dial.js +89 -17
- package/dist/peer-dial.js.map +1 -1
- package/dist/peer-join-backfill.js +4 -4
- package/dist/peer-join-backfill.js.map +1 -1
- package/dist/peer-record.d.ts +34 -9
- package/dist/peer-record.js +66 -13
- package/dist/peer-record.js.map +1 -1
- package/dist/pending-join-runner.d.ts +1 -1
- package/dist/pending-join-runner.js +1 -1
- package/dist/provider/client.d.ts +6 -5
- package/dist/provider/client.js +3 -3
- package/dist/provider/client.js.map +1 -1
- package/dist/provider/descriptor.d.ts +1 -1
- package/dist/provider/descriptor.js +1 -1
- package/dist/provider/oauth.d.ts +1 -1
- package/dist/provider/oauth.js +1 -1
- package/dist/provider/rent-node.d.ts +4 -3
- package/dist/provider/rent-node.js +3 -3
- package/dist/provider/rent-node.js.map +1 -1
- package/dist/relay-addrs.d.ts +62 -7
- package/dist/relay-addrs.js +74 -11
- package/dist/relay-addrs.js.map +1 -1
- package/dist/relay-reservation.d.ts +1 -1
- package/dist/relay-reservation.js +1 -1
- package/dist/relay-server.d.ts +6 -5
- package/dist/relay-server.js +5 -5
- package/dist/relay-server.js.map +1 -1
- package/dist/schema-verification.d.ts +13 -10
- package/dist/schema-verification.js +32 -24
- package/dist/schema-verification.js.map +1 -1
- package/dist/sealed-party-key.js +1 -1
- package/dist/seed-bootstrap.d.ts +4 -3
- package/dist/seed-bootstrap.js +6 -7
- package/dist/seed-bootstrap.js.map +1 -1
- package/dist/strand-addr-protocol.d.ts +8 -6
- package/dist/strand-addr-protocol.js +12 -10
- package/dist/strand-addr-protocol.js.map +1 -1
- package/dist/strand-app-schema-report.d.ts +16 -2
- package/dist/strand-app-schema-report.js +15 -0
- package/dist/strand-app-schema-report.js.map +1 -1
- package/dist/strand-cohort.d.ts +1 -4
- package/dist/strand-cohort.js.map +1 -1
- package/dist/strand-commit-durability.d.ts +1 -1
- package/dist/strand-database.d.ts +13 -6
- package/dist/strand-database.js +17 -9
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-first-sync-gate.d.ts +3 -2
- package/dist/strand-first-sync-gate.js +3 -2
- package/dist/strand-first-sync-gate.js.map +1 -1
- package/dist/strand-formation-deadlines.d.ts +2 -2
- package/dist/strand-formation-deadlines.js +2 -2
- package/dist/strand-formation-protocol.d.ts +1 -1
- package/dist/strand-formation-protocol.js +51 -16
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +134 -42
- package/dist/strand-instance-manager.js +331 -76
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-membership-reconciler.d.ts +8 -3
- package/dist/strand-membership-reconciler.js +8 -3
- package/dist/strand-membership-reconciler.js.map +1 -1
- package/dist/strand-membership-writer.d.ts +2 -2
- package/dist/strand-membership-writer.js +41 -39
- package/dist/strand-membership-writer.js.map +1 -1
- package/dist/strand-move.js +1 -1
- package/dist/strand-network-config.d.ts +15 -5
- package/dist/strand-network-config.js +7 -6
- package/dist/strand-network-config.js.map +1 -1
- package/dist/strand-party-key-rotation.d.ts +7 -3
- package/dist/strand-party-key-rotation.js +7 -3
- package/dist/strand-party-key-rotation.js.map +1 -1
- package/dist/strand-party-machines.d.ts +19 -8
- package/dist/strand-party-machines.js +26 -11
- package/dist/strand-party-machines.js.map +1 -1
- package/dist/strand-party-peers.d.ts +36 -14
- package/dist/strand-party-peers.js +24 -15
- package/dist/strand-party-peers.js.map +1 -1
- package/dist/strand-peer-redial.d.ts +1 -1
- package/dist/strand-peer-redial.js +1 -1
- package/dist/strand-reactivity.d.ts +20 -17
- package/dist/strand-reactivity.js +31 -18
- package/dist/strand-reactivity.js.map +1 -1
- package/dist/strand-revocation-enforcer.d.ts +3 -3
- package/dist/strand-revocation-enforcer.js +3 -3
- package/dist/strand-wake-protocol.d.ts +19 -7
- package/dist/strand-wake-protocol.js +22 -10
- package/dist/strand-wake-protocol.js.map +1 -1
- package/dist/strand-watcher.d.ts +1 -1
- package/dist/strand-watcher.js +1 -1
- package/dist/table-change-watch.js +1 -1
- package/dist/types.d.ts +127 -57
- package/dist/types.js.map +1 -1
- package/dist/webrtc-upgrade.d.ts +254 -0
- package/dist/webrtc-upgrade.js +355 -0
- package/dist/webrtc-upgrade.js.map +1 -0
- package/package.json +9 -9
- package/src/announce-addrs.ts +93 -93
- package/src/arachnode-stub.ts +18 -10
- package/src/bootstrap-peer-store-file.ts +44 -44
- package/src/bootstrap-peer-store.ts +214 -214
- package/src/cadre-invite-protocol.ts +741 -740
- package/src/cadre-node.ts +12462 -12252
- package/src/claim-proof.ts +147 -147
- package/src/control-authorization.ts +290 -276
- package/src/control-cohort.ts +223 -204
- package/src/control-database.ts +72 -28
- package/src/control-formation-recorder.ts +359 -359
- package/src/control-protocol-guard.ts +370 -366
- package/src/control-read-retry.ts +222 -180
- package/src/control-retry.ts +36 -4
- package/src/control-schema-version.ts +301 -301
- package/src/control-schema.ts +1108 -1087
- package/src/control-write-retry.ts +639 -669
- package/src/delegate-admission.ts +351 -351
- package/src/describe-thrown.ts +60 -60
- package/src/ed25519-key.ts +185 -185
- package/src/edge-node/config.ts +13 -10
- package/src/edge-node/dissolve.ts +252 -252
- package/src/edge-node/edge-join.ts +320 -320
- package/src/edge-node/edge-node.ts +1095 -1095
- package/src/edge-node/index.ts +60 -59
- package/src/edge-node/join-credential.ts +16 -16
- package/src/edge-node/lazy-raw-storage.ts +194 -178
- package/src/edge-node/listen-addrs.ts +26 -0
- package/src/edge-node/node-local.ts +84 -84
- package/src/edge-node/options.ts +195 -195
- package/src/edge-node/owner-grant.ts +63 -63
- package/src/edge-node/platform.ts +5 -4
- package/src/edge-node/strand-move.ts +266 -266
- package/src/edge-node/strands.ts +27 -12
- package/src/enrolled-machine-store-file.ts +43 -43
- package/src/enrolled-machine-store.ts +280 -280
- package/src/fetch-impl.ts +23 -23
- package/src/file-durable-slot.ts +64 -64
- package/src/file-safe-name.ts +32 -32
- package/src/formation-approval.ts +604 -604
- package/src/formation-token.ts +63 -63
- package/src/fs-atomic.ts +92 -92
- package/src/index.ts +987 -957
- package/src/invitation-bootstrap.ts +152 -118
- package/src/joined-strand-store.ts +553 -553
- package/src/key-store-file.ts +142 -142
- package/src/link-budget.ts +61 -5
- package/src/machine-removal.ts +211 -210
- package/src/member-redemption.ts +643 -643
- package/src/membership-connection-gater.ts +650 -650
- package/src/membership-view.ts +147 -144
- package/src/node-claim-payload.ts +34 -12
- package/src/node-class.ts +47 -0
- package/src/node-default-transports.ts +65 -3
- package/src/node-roles.ts +220 -0
- package/src/node-transports.ts +86 -49
- package/src/owner-anchor-sync.ts +172 -172
- package/src/owner-grant-protocol.ts +547 -547
- package/src/owner-key-export.ts +348 -348
- package/src/owner-key-flows.ts +109 -109
- package/src/owner-key-store.ts +1 -1
- package/src/owner-keys.ts +179 -179
- package/src/owner-signer.ts +92 -92
- package/src/peer-addr-book.ts +252 -252
- package/src/peer-authorization.ts +584 -582
- package/src/peer-dial.ts +698 -605
- package/src/peer-join-backfill.ts +961 -961
- package/src/peer-record.ts +71 -16
- package/src/pending-join-runner.ts +798 -798
- package/src/primary-lan-address.ts +47 -47
- package/src/provider/client.ts +327 -326
- package/src/provider/descriptor.ts +129 -129
- package/src/provider/index.ts +59 -59
- package/src/provider/oauth.ts +285 -285
- package/src/provider/rent-node.ts +276 -275
- package/src/relay-addrs.ts +90 -12
- package/src/relay-reservation.ts +1 -1
- package/src/relay-server.ts +99 -98
- package/src/schema-verification.ts +38 -23
- package/src/sealed-party-key.ts +190 -190
- package/src/seed-bootstrap.ts +8 -11
- package/src/seed-trust-policy.ts +353 -353
- package/src/self-address-update.ts +19 -19
- package/src/strand-addr-protocol.ts +17 -14
- package/src/strand-app-schema-report.ts +147 -122
- package/src/strand-cohort.ts +1 -5
- package/src/strand-commit-durability.ts +165 -165
- package/src/strand-database.ts +522 -510
- package/src/strand-first-sync-gate.ts +3 -2
- package/src/strand-formation-deadlines.ts +227 -227
- package/src/strand-formation-manager.ts +731 -731
- package/src/strand-formation-protocol.ts +1174 -1138
- package/src/strand-fret-addrs.ts +179 -179
- package/src/strand-instance-manager.ts +381 -85
- package/src/strand-membership-reconciler.ts +1315 -1310
- package/src/strand-membership-writer.ts +2152 -2150
- package/src/strand-move.ts +1 -1
- package/src/strand-network-config.ts +16 -6
- package/src/strand-offline.ts +178 -178
- package/src/strand-party-key-rotation.ts +440 -436
- package/src/strand-party-machines.ts +308 -293
- package/src/strand-party-peers.ts +151 -129
- package/src/strand-peer-redial.ts +1 -1
- package/src/strand-reactivity.ts +36 -19
- package/src/strand-revocation-enforcer.ts +758 -758
- package/src/strand-wake-protocol.ts +406 -394
- package/src/strand-watcher.ts +1 -1
- package/src/table-change-watch.ts +285 -285
- package/src/timed-step.ts +28 -28
- package/src/timeout-scheduler.ts +29 -29
- package/src/trusted-owner-store.ts +242 -242
- package/src/types.ts +3182 -3112
- package/src/webrtc-upgrade.ts +439 -0
|
@@ -38,11 +38,12 @@ export interface NodeClaimAddressOptions {
|
|
|
38
38
|
* unparsable ones are dropped, and so is plain TCP unless `includeTcp`.
|
|
39
39
|
* - Public names (`/dns*`) come first: they work away from home. Public IP addresses are
|
|
40
40
|
* kept only when there is no public name, since they reach the same machine.
|
|
41
|
-
* - Private addresses follow, narrowed by {@link NodeClaimAddressOptions.lan}; relay
|
|
42
|
-
* addresses last
|
|
41
|
+
* - Private addresses follow, narrowed by {@link NodeClaimAddressOptions.lan}; then relay
|
|
42
|
+
* addresses, and last of all a relayed address that needs ICE after its hop (`webrtc`),
|
|
43
|
+
* which answers nothing for about 23 s when ICE cannot connect.
|
|
43
44
|
*
|
|
44
|
-
* Pure
|
|
45
|
-
*
|
|
45
|
+
* Pure, like the codec beside it, so it loads on React Native too. Finding the LAN address is
|
|
46
|
+
* the caller's (Node: `@serfab/cadre-core/primary-lan-address`).
|
|
46
47
|
*/
|
|
47
48
|
export declare function selectNodeClaimAddresses(reported: readonly string[], peerId: string, options?: NodeClaimAddressOptions): string[];
|
|
48
49
|
/**
|
|
@@ -53,10 +54,17 @@ export declare function selectNodeClaimAddresses(reported: readonly string[], pe
|
|
|
53
54
|
*/
|
|
54
55
|
export declare function withClaimDestination(addr: string, peerId: string): string;
|
|
55
56
|
/**
|
|
56
|
-
* Where a phone could dial an address from: a relayed address (`/p2p-circuit`), a
|
|
57
|
-
* a public IP, a private (LAN, VPN,
|
|
57
|
+
* Where a phone could dial an address from: a relayed address (`/p2p-circuit`), a relayed
|
|
58
|
+
* address carrying WebRTC signalling, a public name, a public IP, a private (LAN, VPN,
|
|
59
|
+
* link-local) IP, or this machine's own loopback.
|
|
60
|
+
*
|
|
61
|
+
* `webrtc` is not restricted to the phone's own network — the relay carries its signalling from
|
|
62
|
+
* anywhere — but the connection itself opens only if ICE finds a path between the two networks,
|
|
63
|
+
* and otherwise answers nothing for about 23 s. So it is kept apart from `relay`, and everything
|
|
64
|
+
* that ranks these kinds puts it below the plain relayed address published beside it: see
|
|
65
|
+
* `docs/network/relay.md` → "Direct connections over WebRTC".
|
|
58
66
|
*/
|
|
59
|
-
export type DialAddressKind = 'relay' | 'name' | 'public' | 'private' | 'loopback';
|
|
67
|
+
export type DialAddressKind = 'relay' | 'webrtc' | 'name' | 'public' | 'private' | 'loopback';
|
|
60
68
|
/**
|
|
61
69
|
* Classify `addr` for a phone dialing it, or undefined when no phone can dial it at all: it
|
|
62
70
|
* does not parse, names the unspecified address, or is plain TCP without `includeTcp` (phones
|
|
@@ -9,14 +9,23 @@
|
|
|
9
9
|
* carries no party id: the claim supplies it, and the node records it.
|
|
10
10
|
*
|
|
11
11
|
* The decoder lives here, beside the encoder, because the phone and the host both need
|
|
12
|
-
* it and neither depends on the other.
|
|
13
|
-
* `@libp2p/peer-id` and `uint8arrays
|
|
12
|
+
* it and neither depends on the other. Its own code is pure, and it imports only
|
|
13
|
+
* `@multiformats/multiaddr`, `@libp2p/peer-id` and `uint8arrays` — nothing platform-bound —
|
|
14
|
+
* so it loads on React Native and in the browser.
|
|
15
|
+
*
|
|
16
|
+
* The one exception is {@link addrKindOfComponents} from `peer-dial.ts`, taken rather than
|
|
17
|
+
* restated so that "does this address need ICE after its relay hop" has ONE answer in the
|
|
18
|
+
* package (`docs/network/relay.md` → "Direct connections over WebRTC" is the rule it serves).
|
|
19
|
+
* That import's own graph reaches `link-budget.ts` and therefore `@optimystic/db-p2p`, which is
|
|
20
|
+
* heavier than anything else here but is not platform-bound either, and this module is reachable
|
|
21
|
+
* only through the package index, which loads it regardless.
|
|
14
22
|
*/
|
|
15
23
|
import { peerIdFromString } from '@libp2p/peer-id';
|
|
16
24
|
import { multiaddr, CODE_DNS, CODE_DNS4, CODE_DNS6, CODE_DNSADDR, CODE_IP4, CODE_IP6, CODE_IP6ZONE, CODE_P2P, CODE_P2P_CIRCUIT, CODE_WS, CODE_WSS, } from '@multiformats/multiaddr';
|
|
17
25
|
import { fromString as uint8ArrayFromString, toString as uint8ArrayToString } from 'uint8arrays';
|
|
18
26
|
import { canonicalJson } from './canonical-json.js';
|
|
19
27
|
import { parseClaimSecret } from './claim-proof.js';
|
|
28
|
+
import { addrKindOfComponents } from './peer-dial.js';
|
|
20
29
|
/** Version 1 of the payload; the only one either side reads. */
|
|
21
30
|
export const NODE_CLAIM_PAYLOAD_PREFIX = 'sereus-join:1.';
|
|
22
31
|
/** Encode a payload as the text the host shows. Refuses what {@link decodeNodeClaimPayload} would. */
|
|
@@ -66,24 +75,26 @@ export function decodeNodeClaimPayload(text) {
|
|
|
66
75
|
* unparsable ones are dropped, and so is plain TCP unless `includeTcp`.
|
|
67
76
|
* - Public names (`/dns*`) come first: they work away from home. Public IP addresses are
|
|
68
77
|
* kept only when there is no public name, since they reach the same machine.
|
|
69
|
-
* - Private addresses follow, narrowed by {@link NodeClaimAddressOptions.lan}; relay
|
|
70
|
-
* addresses last
|
|
78
|
+
* - Private addresses follow, narrowed by {@link NodeClaimAddressOptions.lan}; then relay
|
|
79
|
+
* addresses, and last of all a relayed address that needs ICE after its hop (`webrtc`),
|
|
80
|
+
* which answers nothing for about 23 s when ICE cannot connect.
|
|
71
81
|
*
|
|
72
|
-
* Pure
|
|
73
|
-
*
|
|
82
|
+
* Pure, like the codec beside it, so it loads on React Native too. Finding the LAN address is
|
|
83
|
+
* the caller's (Node: `@serfab/cadre-core/primary-lan-address`).
|
|
74
84
|
*/
|
|
75
85
|
export function selectNodeClaimAddresses(reported, peerId, options = {}) {
|
|
76
86
|
const names = [];
|
|
77
87
|
const publicIps = [];
|
|
78
88
|
const privates = [];
|
|
79
89
|
const relayed = [];
|
|
90
|
+
const webrtc = [];
|
|
80
91
|
for (const raw of reported) {
|
|
81
92
|
const classified = classifyClaimAddress(raw.trim(), peerId, options);
|
|
82
93
|
if (!classified)
|
|
83
94
|
continue;
|
|
84
|
-
({ name: names, public: publicIps, private: privates, relay: relayed })[classified.kind].push(classified.addr);
|
|
95
|
+
({ name: names, public: publicIps, private: privates, relay: relayed, webrtc })[classified.kind].push(classified.addr);
|
|
85
96
|
}
|
|
86
|
-
return [...new Set([...names, ...(names.length > 0 ? [] : publicIps), ...privates, ...relayed])];
|
|
97
|
+
return [...new Set([...names, ...(names.length > 0 ? [] : publicIps), ...privates, ...relayed, ...webrtc])];
|
|
87
98
|
}
|
|
88
99
|
/**
|
|
89
100
|
* `addr` as a node code carries it: with `/p2p/<peerId>` appended unless it already names a
|
|
@@ -114,8 +125,13 @@ function componentsOf(addr) {
|
|
|
114
125
|
}
|
|
115
126
|
/** {@link classifyDialAddress}, keeping the IP for a caller that narrows private addresses by it. */
|
|
116
127
|
function classifyComponents(components, includeTcp) {
|
|
117
|
-
|
|
128
|
+
// One answer to "does this need a relay hop, and does it need ICE after that hop"; the
|
|
129
|
+
// `CODE_P2P_CIRCUIT` test below in `destinationIn` asks a different question.
|
|
130
|
+
const relayHop = addrKindOfComponents(components);
|
|
131
|
+
if (relayHop === 'relayed')
|
|
118
132
|
return { kind: 'relay' };
|
|
133
|
+
if (relayHop === 'webrtc')
|
|
134
|
+
return { kind: 'webrtc' };
|
|
119
135
|
if (!includeTcp && !components.some((c) => c.code === CODE_WS || c.code === CODE_WSS))
|
|
120
136
|
return undefined;
|
|
121
137
|
const host = components[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-claim-payload.js","sourceRoot":"","sources":["../src/node-claim-payload.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"node-claim-payload.js","sourceRoot":"","sources":["../src/node-claim-payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EACN,SAAS,EACT,QAAQ,EACR,SAAS,EACT,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,QAAQ,GACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,gEAAgE;AAChE,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAgB,CAAC;AAW1D,sG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AAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACjD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAE,CAAC;QACjC,IAAI,SAAS,CAAC,IAAI,KAAK,gBAAgB;YAAE,OAAO,IAAI,CAAC;QACrD,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ,IAAI,SAAS,CAAC,KAAK;YAAE,OAAO,SAAS,CAAC,KAAK,CAAC;IAC5E,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What kind of machine a node runs on, and the stored form of that fact the control network
|
|
3
|
+
* replicates.
|
|
4
|
+
*
|
|
5
|
+
* Two separate vocabularies on purpose. {@link NodeClass} is what an embedder sets and what
|
|
6
|
+
* every reader in this repository reasons about. {@link PublishedProfile} is the older pair of
|
|
7
|
+
* codes the `CadrePeer.Profile` column holds, kept because the control store is the one place
|
|
8
|
+
* backwards compatibility applies (`docs/cadre/control-schema.md` → "Schema versions and
|
|
9
|
+
* migrations"): a column rename cannot be migrated, and a party's machines update one at a
|
|
10
|
+
* time, so an older build's `KnownProfile` check would refuse a value replicated from an
|
|
11
|
+
* updated sibling. This module is the only place the two meet — nothing else writes or
|
|
12
|
+
* compares the stored codes.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* What kind of machine a node runs on.
|
|
16
|
+
*
|
|
17
|
+
* `'device'` is a phone, laptop or browser running an app: intermittently connected, asleep or
|
|
18
|
+
* closed much of the time. `'server'` is an always-on node — a cadre-host child, a cadre-cli
|
|
19
|
+
* drone, a provider container. Both transact and both store; the class says how reachable the
|
|
20
|
+
* machine is, which is what the defaults derived from it (relay server, hosting unclaimed
|
|
21
|
+
* strands, the FRET profile db-p2p builds the node with) actually turn on.
|
|
22
|
+
*
|
|
23
|
+
* See `docs/cadre/node.md` → "Node classes".
|
|
24
|
+
*/
|
|
25
|
+
export type NodeClass = 'device' | 'server';
|
|
26
|
+
/**
|
|
27
|
+
* The stored form of `CadrePeer.Profile`. Kept as-is for control-store compatibility; it
|
|
28
|
+
* encodes only whether the machine is always on.
|
|
29
|
+
*/
|
|
30
|
+
export type PublishedProfile = 'transaction' | 'storage';
|
|
31
|
+
/** The stored form a machine publishes for whether it is always on. */
|
|
32
|
+
export declare function encodeAlwaysOn(alwaysOn: boolean): PublishedProfile;
|
|
33
|
+
/** Whether the machine that published `stored` is always on; null on a row it has not published. */
|
|
34
|
+
export declare function decodeAlwaysOn(stored: PublishedProfile | null): boolean | null;
|
|
35
|
+
/** Whether `value` is a stored `CadrePeer.Profile` the schema's `KnownProfile` check admits. */
|
|
36
|
+
export declare function isPublishedProfile(value: unknown): value is PublishedProfile;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What kind of machine a node runs on, and the stored form of that fact the control network
|
|
3
|
+
* replicates.
|
|
4
|
+
*
|
|
5
|
+
* Two separate vocabularies on purpose. {@link NodeClass} is what an embedder sets and what
|
|
6
|
+
* every reader in this repository reasons about. {@link PublishedProfile} is the older pair of
|
|
7
|
+
* codes the `CadrePeer.Profile` column holds, kept because the control store is the one place
|
|
8
|
+
* backwards compatibility applies (`docs/cadre/control-schema.md` → "Schema versions and
|
|
9
|
+
* migrations"): a column rename cannot be migrated, and a party's machines update one at a
|
|
10
|
+
* time, so an older build's `KnownProfile` check would refuse a value replicated from an
|
|
11
|
+
* updated sibling. This module is the only place the two meet — nothing else writes or
|
|
12
|
+
* compares the stored codes.
|
|
13
|
+
*/
|
|
14
|
+
/** The stored form a machine publishes for whether it is always on. */
|
|
15
|
+
export function encodeAlwaysOn(alwaysOn) {
|
|
16
|
+
return alwaysOn ? 'storage' : 'transaction';
|
|
17
|
+
}
|
|
18
|
+
/** Whether the machine that published `stored` is always on; null on a row it has not published. */
|
|
19
|
+
export function decodeAlwaysOn(stored) {
|
|
20
|
+
return stored === null ? null : stored === 'storage';
|
|
21
|
+
}
|
|
22
|
+
/** Whether `value` is a stored `CadrePeer.Profile` the schema's `KnownProfile` check admits. */
|
|
23
|
+
export function isPublishedProfile(value) {
|
|
24
|
+
return value === 'transaction' || value === 'storage';
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=node-class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-class.js","sourceRoot":"","sources":["../src/node-class.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAqBH,uEAAuE;AACvE,MAAM,UAAU,cAAc,CAAC,QAAiB;IAC/C,OAAO,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC;AAC7C,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,cAAc,CAAC,MAA+B;IAC7D,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC;AACtD,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAChD,OAAO,KAAK,KAAK,aAAa,IAAI,KAAK,KAAK,SAAS,CAAC;AACvD,CAAC"}
|
|
@@ -7,21 +7,68 @@
|
|
|
7
7
|
* built. A subpath module (`@serfab/cadre-core/node-default-transports`), like `push-node`,
|
|
8
8
|
* because it names `@libp2p/tcp`: some bundlers (the NativeScript reference app's webpack) take
|
|
9
9
|
* its Node implementation rather than its browser stub, and that needs `net`, `os` and `path`.
|
|
10
|
+
*
|
|
11
|
+
* It is also the only module in this repo that can give a Node host WebRTC, which is why
|
|
12
|
+
* `relay-addrs.ts` accepts a `/webrtc` listen entry only from a node that passed this function.
|
|
13
|
+
* See {@link loadNodeWebrtcTransport} for why that transport is loaded on demand and not
|
|
14
|
+
* imported here.
|
|
10
15
|
*/
|
|
11
16
|
import type { Libp2pTransports } from '@optimystic/db-p2p';
|
|
12
17
|
import type { ListenTransportOptions } from './relay-addrs.js';
|
|
18
|
+
import type { StunServer } from './relay-stun.js';
|
|
19
|
+
/** One entry of a libp2p transport list — what `tcp()`, `webSockets()` or `webRTC()` returns. */
|
|
20
|
+
type TransportFactory = Libp2pTransports[number];
|
|
21
|
+
/**
|
|
22
|
+
* Builds `@libp2p/webrtc`'s Node transport over a set of STUN servers: what
|
|
23
|
+
* {@link loadNodeWebrtcTransport} resolves to, and what {@link nodeDefaultTransports} takes so
|
|
24
|
+
* that it stays synchronous.
|
|
25
|
+
*/
|
|
26
|
+
export type NodeWebrtcTransport = (iceServers: readonly StunServer[]) => TransportFactory;
|
|
13
27
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
28
|
+
* Load `@libp2p/webrtc`'s Node transport factory. Call it once, at start, on the branch that
|
|
29
|
+
* asked for WebRTC, and hand the result to {@link nodeDefaultTransports}.
|
|
30
|
+
*
|
|
31
|
+
* A RUN-TIME import, deliberately — the one in this package. `@libp2p/webrtc`'s Node build
|
|
32
|
+
* reaches `node-datachannel`, which loads a native addon as its module is evaluated and throws
|
|
33
|
+
* when the running platform has no prebuilt binary for it. A node that did not ask for WebRTC
|
|
34
|
+
* must neither pay that load nor fail on it, and a static import would do both. The throw, when
|
|
35
|
+
* it comes, names `node-datachannel`, the platform and the architecture, which is what an
|
|
36
|
+
* operator on an unsupported platform needs to read.
|
|
37
|
+
*
|
|
38
|
+
* The STUN servers are supplied per call rather than baked in, because the resolved set depends
|
|
39
|
+
* on the node's relays (`relay-stun.ts` → `resolveStunServers`) and one process may build
|
|
40
|
+
* several nodes. No TURN server is configured anywhere: a WebRTC path that ICE cannot find stays
|
|
41
|
+
* on the circuit relay. See `docs/network/relay.md` → "Direct connections over WebRTC".
|
|
42
|
+
*
|
|
43
|
+
* NOTE: the load is conditional but the INSTALL is not. `@libp2p/webrtc` is a plain dependency
|
|
44
|
+
* of this package, so its 55-package closure — the `node-datachannel` prebuilt binary (about
|
|
45
|
+
* 19 MiB on Alpine x64) plus `react-native-webrtc`, `@peculiar/x509` and the rest — ships in
|
|
46
|
+
* every cadre-cli image whether any node turns WebRTC on; measured at about 33 MiB over
|
|
47
|
+
* cadre-cli's production closure without it. Fine while that is a third of a node image; if it
|
|
48
|
+
* ever has to come off the images that do not use it, move the dependency and this loader into
|
|
49
|
+
* a package of their own that a host installs on purpose.
|
|
50
|
+
*/
|
|
51
|
+
export declare function loadNodeWebrtcTransport(): Promise<NodeWebrtcTransport>;
|
|
52
|
+
/**
|
|
53
|
+
* TCP, WebSocket exactly when the node's listen entries switch it on, WebRTC when they switch
|
|
54
|
+
* that on and `webrtc` was loaded, and the circuit-relay transport.
|
|
16
55
|
*
|
|
17
56
|
* Passing an explicit list makes db-p2p ignore `wsPort` for transports, which is why WebSocket is
|
|
18
57
|
* decided here from the same switch. Its other use of `wsPort`, a default WebSocket listen
|
|
19
58
|
* address, never applies: a node with configured relays always has explicit listen entries.
|
|
20
59
|
*
|
|
60
|
+
* `webrtc` is a parameter rather than a static import so the native addon behind it is loaded
|
|
61
|
+
* only by a host that asked for WebRTC ({@link loadNodeWebrtcTransport}). Omitting it while a
|
|
62
|
+
* listen entry names `/webrtc` THROWS: that pairing is the silent-listener defect
|
|
63
|
+
* `resolveTransportOptions` exists to prevent (`relay-addrs.ts`), and libp2p would just drop the
|
|
64
|
+
* address. The usual caller is `cadre-cli`, which loads the factory and sets the listen entry
|
|
65
|
+
* from one setting.
|
|
66
|
+
*
|
|
21
67
|
* NOTE: mirrors `createLibp2pNode`'s default list in
|
|
22
68
|
* `../optimystic/packages/db-p2p/src/libp2p-node.ts` (cadre never sets its `disableTcp`). That file
|
|
23
69
|
* is the source of truth; if its defaults change, this list has to follow. If db-p2p ever takes an
|
|
24
70
|
* option to build its default list with relay discovery off, use that and drop this module and
|
|
25
71
|
* `NetworkConfig.defaultTransports`.
|
|
26
72
|
*/
|
|
27
|
-
export declare function nodeDefaultTransports({ wsPort }: ListenTransportOptions): Libp2pTransports;
|
|
73
|
+
export declare function nodeDefaultTransports({ wsPort, webrtcIceServers }: ListenTransportOptions, webrtc?: NodeWebrtcTransport): Libp2pTransports;
|
|
74
|
+
export {};
|
|
@@ -7,28 +7,73 @@
|
|
|
7
7
|
* built. A subpath module (`@serfab/cadre-core/node-default-transports`), like `push-node`,
|
|
8
8
|
* because it names `@libp2p/tcp`: some bundlers (the NativeScript reference app's webpack) take
|
|
9
9
|
* its Node implementation rather than its browser stub, and that needs `net`, `os` and `path`.
|
|
10
|
+
*
|
|
11
|
+
* It is also the only module in this repo that can give a Node host WebRTC, which is why
|
|
12
|
+
* `relay-addrs.ts` accepts a `/webrtc` listen entry only from a node that passed this function.
|
|
13
|
+
* See {@link loadNodeWebrtcTransport} for why that transport is loaded on demand and not
|
|
14
|
+
* imported here.
|
|
10
15
|
*/
|
|
11
16
|
import { tcp } from '@libp2p/tcp';
|
|
12
17
|
import { webSockets } from '@libp2p/websockets';
|
|
13
18
|
import { circuitRelayTransport } from '@libp2p/circuit-relay-v2';
|
|
14
19
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
20
|
+
* Load `@libp2p/webrtc`'s Node transport factory. Call it once, at start, on the branch that
|
|
21
|
+
* asked for WebRTC, and hand the result to {@link nodeDefaultTransports}.
|
|
22
|
+
*
|
|
23
|
+
* A RUN-TIME import, deliberately — the one in this package. `@libp2p/webrtc`'s Node build
|
|
24
|
+
* reaches `node-datachannel`, which loads a native addon as its module is evaluated and throws
|
|
25
|
+
* when the running platform has no prebuilt binary for it. A node that did not ask for WebRTC
|
|
26
|
+
* must neither pay that load nor fail on it, and a static import would do both. The throw, when
|
|
27
|
+
* it comes, names `node-datachannel`, the platform and the architecture, which is what an
|
|
28
|
+
* operator on an unsupported platform needs to read.
|
|
29
|
+
*
|
|
30
|
+
* The STUN servers are supplied per call rather than baked in, because the resolved set depends
|
|
31
|
+
* on the node's relays (`relay-stun.ts` → `resolveStunServers`) and one process may build
|
|
32
|
+
* several nodes. No TURN server is configured anywhere: a WebRTC path that ICE cannot find stays
|
|
33
|
+
* on the circuit relay. See `docs/network/relay.md` → "Direct connections over WebRTC".
|
|
34
|
+
*
|
|
35
|
+
* NOTE: the load is conditional but the INSTALL is not. `@libp2p/webrtc` is a plain dependency
|
|
36
|
+
* of this package, so its 55-package closure — the `node-datachannel` prebuilt binary (about
|
|
37
|
+
* 19 MiB on Alpine x64) plus `react-native-webrtc`, `@peculiar/x509` and the rest — ships in
|
|
38
|
+
* every cadre-cli image whether any node turns WebRTC on; measured at about 33 MiB over
|
|
39
|
+
* cadre-cli's production closure without it. Fine while that is a third of a node image; if it
|
|
40
|
+
* ever has to come off the images that do not use it, move the dependency and this loader into
|
|
41
|
+
* a package of their own that a host installs on purpose.
|
|
42
|
+
*/
|
|
43
|
+
export async function loadNodeWebrtcTransport() {
|
|
44
|
+
const { webRTC } = await import('@libp2p/webrtc');
|
|
45
|
+
return (iceServers) => webRTC({ rtcConfiguration: { iceServers: [...iceServers] } });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* TCP, WebSocket exactly when the node's listen entries switch it on, WebRTC when they switch
|
|
49
|
+
* that on and `webrtc` was loaded, and the circuit-relay transport.
|
|
17
50
|
*
|
|
18
51
|
* Passing an explicit list makes db-p2p ignore `wsPort` for transports, which is why WebSocket is
|
|
19
52
|
* decided here from the same switch. Its other use of `wsPort`, a default WebSocket listen
|
|
20
53
|
* address, never applies: a node with configured relays always has explicit listen entries.
|
|
21
54
|
*
|
|
55
|
+
* `webrtc` is a parameter rather than a static import so the native addon behind it is loaded
|
|
56
|
+
* only by a host that asked for WebRTC ({@link loadNodeWebrtcTransport}). Omitting it while a
|
|
57
|
+
* listen entry names `/webrtc` THROWS: that pairing is the silent-listener defect
|
|
58
|
+
* `resolveTransportOptions` exists to prevent (`relay-addrs.ts`), and libp2p would just drop the
|
|
59
|
+
* address. The usual caller is `cadre-cli`, which loads the factory and sets the listen entry
|
|
60
|
+
* from one setting.
|
|
61
|
+
*
|
|
22
62
|
* NOTE: mirrors `createLibp2pNode`'s default list in
|
|
23
63
|
* `../optimystic/packages/db-p2p/src/libp2p-node.ts` (cadre never sets its `disableTcp`). That file
|
|
24
64
|
* is the source of truth; if its defaults change, this list has to follow. If db-p2p ever takes an
|
|
25
65
|
* option to build its default list with relay discovery off, use that and drop this module and
|
|
26
66
|
* `NetworkConfig.defaultTransports`.
|
|
27
67
|
*/
|
|
28
|
-
export function nodeDefaultTransports({ wsPort }) {
|
|
68
|
+
export function nodeDefaultTransports({ wsPort, webrtcIceServers }, webrtc) {
|
|
69
|
+
if (webrtcIceServers !== undefined && webrtc === undefined) {
|
|
70
|
+
throw new Error('A /webrtc listen entry was resolved but no WebRTC transport was loaded. Pass the result of '
|
|
71
|
+
+ 'loadNodeWebrtcTransport() to nodeDefaultTransports, or drop the /webrtc listen entry.');
|
|
72
|
+
}
|
|
29
73
|
return [
|
|
30
74
|
tcp(),
|
|
31
75
|
...(wsPort === undefined ? [] : [webSockets()]),
|
|
76
|
+
...(webrtcIceServers === undefined || webrtc === undefined ? [] : [webrtc(webrtcIceServers)]),
|
|
32
77
|
circuitRelayTransport()
|
|
33
78
|
];
|
|
34
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-default-transports.js","sourceRoot":"","sources":["../src/node-default-transports.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"node-default-transports.js","sourceRoot":"","sources":["../src/node-default-transports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAejE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAClD,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,gBAAgB,EAAE,EAAE,UAAU,EAAE,CAAC,GAAG,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;AACvF,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,qBAAqB,CACnC,EAAE,MAAM,EAAE,gBAAgB,EAA0B,EACpD,MAA4B;IAE5B,IAAI,gBAAgB,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CACb,6FAA6F;cAC3F,uFAAuF,CAC1F,CAAC;IACJ,CAAC;IACD,OAAO;QACL,GAAG,EAAE;QACL,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC;QAC/C,GAAG,CAAC,gBAAgB,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAC7F,qBAAqB,EAAE;KACxB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The separately-settable decisions that make up a node's behaviour, and the {@link NodeClass}
|
|
3
|
+
* presets that supply the ones an embedder does not set.
|
|
4
|
+
*
|
|
5
|
+
* A node class says what kind of machine this is; it does not say what the machine should do.
|
|
6
|
+
* Four decisions follow from it by default, and each is worth setting on its own in a real
|
|
7
|
+
* deployment: whether the machine is always on, how much overlay work it takes, whether it
|
|
8
|
+
* forwards other subscribers' change notifications, and whether it holds and signs the data of
|
|
9
|
+
* the strands it runs. Bundling them into the class meant every consumer mapped the class
|
|
10
|
+
* itself, in its own place, with its own reasoning.
|
|
11
|
+
*
|
|
12
|
+
* Inside cadre-core this module is the only place a node class is turned into behaviour: a
|
|
13
|
+
* reader that wants behaviour reads the resolved {@link NodeRoles} instead of comparing
|
|
14
|
+
* `nodeClass` to a literal. The one site still deriving behaviour from the class itself is
|
|
15
|
+
* `arachnode-stub.ts`, a stub with no callers whose storage rings are unimplemented —
|
|
16
|
+
* `backlog/later/5-ring-zulu-storage-rings` owns it. (`provider/client.ts` also names the two
|
|
17
|
+
* values, to narrow an untrusted field of an HTTP response; that is parsing, not behaviour.)
|
|
18
|
+
*
|
|
19
|
+
* Outside cadre-core, cadre-host's orchestrator reads the class to decide what to PROVISION for
|
|
20
|
+
* a child — push credentials and a file store — before any node exists, which is its own
|
|
21
|
+
* decision and not a node role. Anything that configures a node, the integration-test harness
|
|
22
|
+
* included, reads {@link NODE_ROLE_PRESETS} rather than mapping the class again.
|
|
23
|
+
*
|
|
24
|
+
* See `docs/cadre/node.md` → "Node classes".
|
|
25
|
+
*/
|
|
26
|
+
import type { NodeClass } from './node-class.js';
|
|
27
|
+
/** How much overlay work a node takes: FRET's resource tier. */
|
|
28
|
+
export type OverlayTier = 'edge' | 'core';
|
|
29
|
+
/** Whether a node may carry other subscribers' change notifications, or only receive its own. */
|
|
30
|
+
export type ReactivityRole = 'forwarder' | 'subscriber';
|
|
31
|
+
/**
|
|
32
|
+
* What one node does, with every decision settled. Resolved once per node by
|
|
33
|
+
* {@link resolveNodeRoles} from the node's class and the embedder's overrides, and read from
|
|
34
|
+
* there by everything that configures the node.
|
|
35
|
+
*/
|
|
36
|
+
export interface NodeRoles {
|
|
37
|
+
/**
|
|
38
|
+
* Is this machine always on?
|
|
39
|
+
*
|
|
40
|
+
* Published to the party as this machine's `CadrePeer.Profile` (`node-class.ts` →
|
|
41
|
+
* `encodeAlwaysOn`), which is how a sibling knows to dial this machine first and how a seed
|
|
42
|
+
* marks a preferred peer. Also the default for running a circuit-relay server
|
|
43
|
+
* (`network.enableRelay`), for keeping a storage replica of every admitted strand
|
|
44
|
+
* (`CadreNodeConfig.hostUnclaimedStrands`) and for joining Arachnode's Ring Zulu.
|
|
45
|
+
*
|
|
46
|
+
* Setting this alone does not make a machine reachable — it states that it is, so set it to
|
|
47
|
+
* match the deployment.
|
|
48
|
+
*/
|
|
49
|
+
alwaysOn: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* FRET's resource tier for this node's libp2p nodes — the control node and every strand
|
|
52
|
+
* node, both built with it. `'core'` raises the rate limits, snapshot sizes and dial and
|
|
53
|
+
* inbound concurrency a machine with the capacity for them should use; `'edge'` is the
|
|
54
|
+
* settings a phone or a browser tab should run at.
|
|
55
|
+
*/
|
|
56
|
+
overlayTier: OverlayTier;
|
|
57
|
+
/**
|
|
58
|
+
* This node's part in change notifications: the Optimystic cohort-topic node profile every
|
|
59
|
+
* strand node with reactivity enabled is built with.
|
|
60
|
+
*
|
|
61
|
+
* `'forwarder'` may serve notifications on behalf of other subscribers (cohort-topic's core
|
|
62
|
+
* profile, willing to forward every tier). `'subscriber'` receives only its own (the edge
|
|
63
|
+
* profile, which forwards the tiers that carry transactions and chain serving and is
|
|
64
|
+
* permanently unwilling to forward reactivity pushes).
|
|
65
|
+
*
|
|
66
|
+
* No effect on a strand with reactivity off, and none on the control node, which never
|
|
67
|
+
* enables it. See `docs/strands/app-schema.md` → "Change notifications".
|
|
68
|
+
*/
|
|
69
|
+
reactivity: ReactivityRole;
|
|
70
|
+
/**
|
|
71
|
+
* Does this node hold and sign blocks for the strands it runs?
|
|
72
|
+
*
|
|
73
|
+
* Strands only: the control network always replicates to every party member, which is what
|
|
74
|
+
* lets any machine read the whole control database. `false` builds each strand node as an
|
|
75
|
+
* Optimystic **client** (`NodeOptions.servesBlocks: false`): it runs the strand — reads,
|
|
76
|
+
* writes, membership, change notifications — but stores none of its blocks, asks the
|
|
77
|
+
* embedder's storage provider for no per-strand store, and is in no cohort, so its reads
|
|
78
|
+
* and writes go to the strand's serving machines and a sleeping phone is never on the path
|
|
79
|
+
* of another machine's save. The shape a very large strand needs. Read in one place,
|
|
80
|
+
* `StrandInstanceManager.buildStrandRuntime`; what follows from it is in `docs/cadre/node.md`
|
|
81
|
+
* → "Node classes". Contradicts `hostUnclaimedStrands: true` ({@link resolveHostUnclaimedStrands}).
|
|
82
|
+
*/
|
|
83
|
+
strandCohortMember: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Whether a node runs the admitted strands no app has claimed as storage replicas
|
|
87
|
+
* (`CadreNodeConfig.hostUnclaimedStrands`): the explicit setting, else `alwaysOn` on a node that
|
|
88
|
+
* holds strand blocks and `false` on one that does not.
|
|
89
|
+
*
|
|
90
|
+
* A replica's whole job is to store and serve a strand, so a node with `strandCohortMember:
|
|
91
|
+
* false` cannot be one. The default therefore comes out `false` on such a node whatever
|
|
92
|
+
* `alwaysOn` says — an always-on dashboard node that holds no blocks is a plausible deployment
|
|
93
|
+
* and must not be refused for a setting it never made — and an EXPLICIT `true` beside
|
|
94
|
+
* `strandCohortMember: false` throws naming both, because the embedder asked for two things that
|
|
95
|
+
* cannot both hold.
|
|
96
|
+
*/
|
|
97
|
+
export declare function resolveHostUnclaimedStrands(explicit: boolean | undefined, roles: NodeRoles): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* What each node class means, in roles. These are defaults an embedder overrides one at a time,
|
|
100
|
+
* not a classification of the machine: a `device` that happens to be always on says so with
|
|
101
|
+
* `roles: { alwaysOn: true }` and keeps every other device default.
|
|
102
|
+
*
|
|
103
|
+
* `reactivity` is `'forwarder'` for both classes because that is what every node does today
|
|
104
|
+
* (cohort-topic's own default is its core profile). Whether a phone should forward is an open
|
|
105
|
+
* question — `feat-decide-phone-reactivity-role-by-simulation` — and this setting is what lets
|
|
106
|
+
* it be answered by configuring a simulation rather than by changing code.
|
|
107
|
+
*/
|
|
108
|
+
export declare const NODE_ROLE_PRESETS: Readonly<Record<NodeClass, Readonly<NodeRoles>>>;
|
|
109
|
+
/**
|
|
110
|
+
* The roles a node built with `nodeClass` runs, with `overrides` applied over its preset.
|
|
111
|
+
*
|
|
112
|
+
* A role the caller leaves out (absent, or present as `undefined`) takes the preset's value.
|
|
113
|
+
* A role the caller MISNAMES, or sets to anything outside its own set, THROWS rather than
|
|
114
|
+
* falling back to the preset: these values reach here from a config file or an environment
|
|
115
|
+
* variable by way of a JavaScript embedder, where a typo resolving silently to the preset would
|
|
116
|
+
* leave a node quietly doing the opposite of what was asked for.
|
|
117
|
+
*/
|
|
118
|
+
export declare function resolveNodeRoles(nodeClass: NodeClass, overrides?: Partial<NodeRoles>): NodeRoles;
|