@serfab/cadre-core 1.10.0 → 1.11.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/dist/cadre-node.d.ts +0 -27
- package/dist/cadre-node.js +2 -94
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-schema.js +1066 -1066
- package/dist/diagnostics/connection-path.d.ts +1 -18
- package/dist/diagnostics/connection-path.js +1 -20
- package/dist/diagnostics/connection-path.js.map +1 -1
- package/dist/identity-key.d.ts +0 -30
- package/dist/identity-key.js +7 -40
- package/dist/identity-key.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/relay-stun.d.ts +24 -0
- package/dist/relay-stun.js +51 -0
- package/dist/relay-stun.js.map +1 -0
- package/dist/seed-bootstrap.js +4 -4
- package/dist/strand-membership-writer.js +32 -32
- package/package.json +2 -2
- package/src/cadre-node.ts +8654 -8753
- package/src/control-authorization.ts +117 -117
- package/src/control-cohort.ts +128 -128
- package/src/control-formation-recorder.ts +353 -353
- package/src/control-read-retry.ts +216 -216
- package/src/control-schema.ts +1078 -1078
- package/src/control-write-retry.ts +567 -567
- package/src/diagnostics/connection-path.ts +1 -29
- package/src/formation-approval.ts +610 -610
- package/src/hibernation-manager.ts +638 -638
- package/src/identity-key.ts +7 -62
- package/src/index.ts +644 -647
- package/src/invitation-bootstrap.ts +40 -40
- package/src/joined-strand-store.ts +498 -498
- package/src/link-budget.ts +684 -684
- package/src/membership-connection-gater.ts +570 -570
- package/src/node-local-snapshot.ts +298 -298
- package/src/peer-dial.ts +315 -315
- package/src/peer-join-backfill.ts +710 -710
- package/src/pending-join-runner.ts +735 -735
- package/src/relay-reservation.ts +1121 -1121
- package/src/relay-server.ts +98 -98
- package/src/relay-stun.ts +58 -0
- package/src/seed-bootstrap.ts +1448 -1448
- package/src/strand-addr-protocol.ts +547 -547
- package/src/strand-database.ts +287 -287
- package/src/strand-first-sync-gate.ts +391 -391
- package/src/strand-formation-deadlines.ts +227 -227
- package/src/strand-formation-manager.ts +725 -725
- package/src/strand-fret-addrs.ts +145 -145
- package/src/strand-instance-manager.ts +1789 -1789
- package/src/strand-membership-writer.ts +1974 -1974
- package/src/strand-network-state-file.ts +40 -40
- package/src/strand-network-state.ts +243 -243
- package/src/strand-revocation-enforcer.ts +654 -654
- package/src/strand-solicitation.ts +532 -532
- package/src/strand-wake-protocol.ts +401 -401
- package/src/types.ts +2222 -2222
- package/dist/diagnostics/webrtc-turn-tracker.d.ts +0 -50
- package/dist/diagnostics/webrtc-turn-tracker.js +0 -196
- package/dist/diagnostics/webrtc-turn-tracker.js.map +0 -1
- package/src/diagnostics/webrtc-turn-tracker.ts +0 -222
|
@@ -13,7 +13,6 @@ export type ConnectionPathKind = 'relayed' | 'direct';
|
|
|
13
13
|
export type ConnectionTransport =
|
|
14
14
|
| 'circuit-relay'
|
|
15
15
|
| 'webrtc'
|
|
16
|
-
| 'webrtc-turn' // WebRTC session whose ICE selected a TURN relay candidate
|
|
17
16
|
| 'webrtc-direct'
|
|
18
17
|
| 'websocket'
|
|
19
18
|
| 'tcp'
|
|
@@ -56,13 +55,6 @@ export interface ConnectionLike {
|
|
|
56
55
|
remoteAddr?: { toString(): string };
|
|
57
56
|
direction?: 'inbound' | 'outbound';
|
|
58
57
|
timeline?: { open?: number };
|
|
59
|
-
/**
|
|
60
|
-
* Set externally (by {@link CadreNode}, from a {@link TurnRelayTracker}
|
|
61
|
-
* observation) when ICE selected a TURN relay candidate for this `/webrtc`
|
|
62
|
-
* session. `undefined` = unknown (the multiaddr alone cannot reveal it). Only
|
|
63
|
-
* honoured for the `webrtc` transport — see {@link classifyConnectionPath}.
|
|
64
|
-
*/
|
|
65
|
-
turnRelayed?: boolean;
|
|
66
58
|
}
|
|
67
59
|
|
|
68
60
|
export const DEFAULT_SETTLE_WINDOW_MS = 10_000;
|
|
@@ -70,7 +62,6 @@ export const DEFAULT_SETTLE_WINDOW_MS = 10_000;
|
|
|
70
62
|
const ALL_TRANSPORTS: readonly ConnectionTransport[] = [
|
|
71
63
|
'circuit-relay',
|
|
72
64
|
'webrtc',
|
|
73
|
-
'webrtc-turn',
|
|
74
65
|
'webrtc-direct',
|
|
75
66
|
'websocket',
|
|
76
67
|
'tcp',
|
|
@@ -122,23 +113,6 @@ function addrString(conn: ConnectionLike): string {
|
|
|
122
113
|
}
|
|
123
114
|
}
|
|
124
115
|
|
|
125
|
-
/**
|
|
126
|
-
* Per-connection classifier. Starts from the pure multiaddr classification, then
|
|
127
|
-
* applies the TURN override: a `/webrtc` session whose ICE selected a TURN relay
|
|
128
|
-
* candidate (`conn.turnRelayed === true`, set externally — the multiaddr alone
|
|
129
|
-
* cannot reveal it) is reclassified `relayed`/`webrtc-turn`. The
|
|
130
|
-
* `transport === 'webrtc'` guard means a `webrtc-direct` connection is never
|
|
131
|
-
* promoted (it uses no ICE and so can never be TURN-relayed), and `undefined`
|
|
132
|
-
* (unknown) degrades safely to the multiaddr result — not relayed.
|
|
133
|
-
*/
|
|
134
|
-
export function classifyConnectionPath(conn: ConnectionLike): TransportClass {
|
|
135
|
-
const { kind, transport } = classifyTransport(addrString(conn));
|
|
136
|
-
if (transport === 'webrtc' && conn.turnRelayed === true) {
|
|
137
|
-
return { kind: 'relayed', transport: 'webrtc-turn' };
|
|
138
|
-
}
|
|
139
|
-
return { kind, transport };
|
|
140
|
-
}
|
|
141
|
-
|
|
142
116
|
/**
|
|
143
117
|
* Best-effort per-connection byte counter. The stock libp2p `Connection`
|
|
144
118
|
* interface carries no byte counter, so unless a metrics implementation is
|
|
@@ -200,9 +174,7 @@ export function summarizeConnectionPaths(
|
|
|
200
174
|
// least one direct connection.
|
|
201
175
|
const classified = list.map((conn) => {
|
|
202
176
|
const remoteAddr = addrString(conn);
|
|
203
|
-
|
|
204
|
-
// turnRelayed hint promotes webrtc → webrtc-turn (relayed).
|
|
205
|
-
const { kind, transport } = classifyConnectionPath(conn);
|
|
177
|
+
const { kind, transport } = classifyTransport(remoteAddr);
|
|
206
178
|
const openedAtMs = typeof conn.timeline?.open === 'number' ? conn.timeline.open : null;
|
|
207
179
|
const ageMs = openedAtMs != null ? Math.max(0, now - openedAtMs) : null;
|
|
208
180
|
const peerId = safePeerId(conn);
|