@serfab/cadre-core 0.11.0 → 0.12.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/announce-addrs.d.ts +49 -0
- package/dist/announce-addrs.js +78 -0
- package/dist/announce-addrs.js.map +1 -0
- package/dist/cadre-node.d.ts +281 -30
- package/dist/cadre-node.js +513 -103
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-database.d.ts +155 -23
- package/dist/control-database.js +272 -104
- package/dist/control-database.js.map +1 -1
- package/dist/control-read-retry.d.ts +103 -0
- package/dist/control-read-retry.js +145 -0
- package/dist/control-read-retry.js.map +1 -0
- package/dist/control-retry.d.ts +101 -0
- package/dist/control-retry.js +108 -0
- package/dist/control-retry.js.map +1 -0
- package/dist/control-schema.d.ts +1 -1
- package/dist/control-schema.js +20 -4
- package/dist/control-schema.js.map +1 -1
- package/dist/control-write-retry.d.ts +59 -35
- package/dist/control-write-retry.js +21 -92
- package/dist/control-write-retry.js.map +1 -1
- package/dist/delegate-admission.d.ts +17 -15
- package/dist/delegate-admission.js +17 -15
- package/dist/delegate-admission.js.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.js +17 -8
- package/dist/index.js.map +1 -1
- package/dist/membership-connection-gater.d.ts +211 -25
- package/dist/membership-connection-gater.js +309 -29
- package/dist/membership-connection-gater.js.map +1 -1
- package/dist/peer-record.d.ts +26 -0
- package/dist/peer-record.js +32 -0
- package/dist/peer-record.js.map +1 -1
- package/dist/relay-addrs.d.ts +76 -26
- package/dist/relay-addrs.js +115 -27
- package/dist/relay-addrs.js.map +1 -1
- package/dist/relay-reservation.d.ts +20 -15
- package/dist/relay-reservation.js +18 -14
- package/dist/relay-reservation.js.map +1 -1
- package/dist/strand-addr-protocol.js +16 -0
- package/dist/strand-addr-protocol.js.map +1 -1
- package/dist/strand-backfill.js +13 -4
- package/dist/strand-backfill.js.map +1 -1
- package/dist/strand-formation-manager.d.ts +10 -9
- package/dist/strand-formation-manager.js +10 -9
- package/dist/strand-formation-manager.js.map +1 -1
- package/dist/strand-formation-protocol.d.ts +7 -7
- package/dist/strand-formation-protocol.js +8 -8
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +4 -3
- package/dist/strand-instance-manager.js +31 -6
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-membership-writer.d.ts +106 -14
- package/dist/strand-membership-writer.js +180 -14
- package/dist/strand-membership-writer.js.map +1 -1
- package/dist/strand-solicitation.d.ts +3 -3
- package/dist/strand-solicitation.js +4 -5
- package/dist/strand-solicitation.js.map +1 -1
- package/dist/strand-wake-protocol.d.ts +47 -2
- package/dist/strand-wake-protocol.js +76 -6
- package/dist/strand-wake-protocol.js.map +1 -1
- package/dist/types.d.ts +74 -29
- package/dist/types.js.map +1 -1
- package/package.json +8 -8
- package/src/announce-addrs.ts +93 -0
- package/src/cadre-node.ts +5603 -5158
- package/src/control-database.ts +2584 -2406
- package/src/control-read-retry.ts +167 -0
- package/src/control-retry.ts +190 -0
- package/src/control-schema.ts +20 -4
- package/src/control-write-retry.ts +30 -130
- package/src/delegate-admission.ts +17 -15
- package/src/index.ts +435 -407
- package/src/membership-connection-gater.ts +533 -204
- package/src/peer-record.ts +33 -0
- package/src/relay-addrs.ts +218 -111
- package/src/relay-reservation.ts +828 -823
- package/src/strand-addr-protocol.ts +17 -0
- package/src/strand-backfill.ts +389 -366
- package/src/strand-formation-manager.ts +492 -491
- package/src/strand-formation-protocol.ts +8 -8
- package/src/strand-instance-manager.ts +636 -611
- package/src/strand-membership-writer.ts +209 -14
- package/src/strand-solicitation.ts +6 -7
- package/src/strand-wake-protocol.ts +94 -8
- package/src/types.ts +74 -29
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Control-network inbound
|
|
2
|
+
* Control-network inbound admission gates (defense-in-depth): the
|
|
3
|
+
* encrypted-connection checkpoint and the circuit-relay reservation checkpoint.
|
|
3
4
|
*
|
|
4
5
|
* Layer 2 of the membership enforcement chain: the PRIMARY gates are per-stream
|
|
5
6
|
* — every sensitive sereus control protocol rejects a peer that fails the
|
|
@@ -10,7 +11,9 @@
|
|
|
10
11
|
* time. This module adds the opportunistic connection-level layer on top: a
|
|
11
12
|
* peer this node can positively determine is NOT authorized is refused at the
|
|
12
13
|
* encrypted-connection checkpoint, before any protocol negotiation, so a
|
|
13
|
-
* known-nothing outsider is never even in the conversation
|
|
14
|
+
* known-nothing outsider is never even in the conversation — EXCEPT on a node
|
|
15
|
+
* that runs the circuit-relay server, where the refusal moves to the
|
|
16
|
+
* relay-reservation checkpoint instead (see "The relay-reservation seam").
|
|
14
17
|
*
|
|
15
18
|
* ## The stranger allowlist (the ONE place it is defined)
|
|
16
19
|
*
|
|
@@ -45,14 +48,54 @@
|
|
|
45
48
|
*
|
|
46
49
|
* - **Announced delegate peers** (`delegate-admission.ts`). A member's strand
|
|
47
50
|
* node runs as a separate libp2p identity whose peerId no sibling can
|
|
48
|
-
* recompute
|
|
49
|
-
* reservation. Before starting a strand node, a member's control node
|
|
51
|
+
* recompute. Before starting a strand node, a member's control node
|
|
50
52
|
* announces that peerId over the already-authenticated strand-addr RPC, and
|
|
51
53
|
* the receiver holds a short-lived grant for it
|
|
52
|
-
* (`CadreNode.grantDelegateAdmission`). The grant admits the CONNECTION
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* on every
|
|
54
|
+
* (`CadreNode.grantDelegateAdmission`). The grant admits the CONNECTION,
|
|
55
|
+
* admits the peer's RESERVATION at the seam below (without spending the
|
|
56
|
+
* unauthorized budget), and nothing else — it is deliberately invisible to
|
|
57
|
+
* the per-stream gate, so a delegate still gets refused on every
|
|
58
|
+
* members-only protocol.
|
|
59
|
+
*
|
|
60
|
+
* ## The relay-reservation seam
|
|
61
|
+
*
|
|
62
|
+
* A circuit-relay reservation is established by the reserving peer DIALING the
|
|
63
|
+
* relay, so at the relay it is an inbound connection — and killing that
|
|
64
|
+
* connection kills the reservation. For a genuine member whose `CadrePeer` row
|
|
65
|
+
* has not yet replicated to this node, a connection-level deny here is NOT
|
|
66
|
+
* self-healing the way a data connection's is: an outbound reconcile dial
|
|
67
|
+
* re-establishes a data link, but no outbound dial can grant the REMOTE peer a
|
|
68
|
+
* reservation, and a relay-only peer has no address of its own to dial back —
|
|
69
|
+
* the reservation IS its address. Boot ordering makes the window ordinary (a
|
|
70
|
+
* node's circuit listener runs inside `libp2p.start()`, before its own row
|
|
71
|
+
* could have replicated anywhere), and a stalled replication makes it
|
|
72
|
+
* unbounded. So the relay would be answering a RELAY question ("may this peer
|
|
73
|
+
* use my forwarding capacity?") with a MEMBERSHIP answer, at a checkpoint where
|
|
74
|
+
* a wrong answer is unrecoverable.
|
|
75
|
+
*
|
|
76
|
+
* On a node whose relay server is enabled the two questions are separated:
|
|
77
|
+
*
|
|
78
|
+
* - The policy returns `'admit-for-relay'` instead of `'deny'`, and the
|
|
79
|
+
* connection is ADMITTED. The fail-closed per-stream gates still refuse such
|
|
80
|
+
* a peer every members-only protocol, so it gains identify/ping and the
|
|
81
|
+
* relay hop protocol, nothing else.
|
|
82
|
+
* - The reservation itself is decided at libp2p's
|
|
83
|
+
* `denyInboundRelayReservation` hook (the circuit-relay server consults it
|
|
84
|
+
* per RESERVE request): the policy admits members, delegates and configured
|
|
85
|
+
* infra outright, and admits peers it cannot place only within a bounded
|
|
86
|
+
* budget ({@link UnauthorizedReservationBudget}) — a member whose row is in
|
|
87
|
+
* flight always finds a slot under any sane cap, while outsiders cannot
|
|
88
|
+
* annex the party's relay capacity.
|
|
89
|
+
* - An `'admit-for-relay'` connection that is NOT reserving is dropped: it has
|
|
90
|
+
* {@link RELAY_ADMISSION_RESERVE_DEADLINE_MS} to get a reservation ADMITTED
|
|
91
|
+
* at that hook, after which the underlying connection is aborted. The
|
|
92
|
+
* guarantee above thus weakens on relay-enabled nodes from "never in the
|
|
93
|
+
* conversation" to "in it briefly, and can speak nothing".
|
|
94
|
+
*
|
|
95
|
+
* The deadline clears on reservation ADMISSION, not on the reservation's own
|
|
96
|
+
* success: this gate cannot observe the server-side `reserve()` outcome, so a
|
|
97
|
+
* peer whose admitted reservation is then refused for server capacity keeps its
|
|
98
|
+
* connection until either side closes it — bounded and mute, so harmless.
|
|
56
99
|
*
|
|
57
100
|
* Everything else a control node handles — the Optimystic control-DB protocols
|
|
58
101
|
* (`/optimystic/control-<party>/{repo,cluster,sync,block-transfer}/…`), wake
|
|
@@ -70,12 +113,45 @@
|
|
|
70
113
|
* stranger carve-outs — an enrollment window admits a stranger's connection
|
|
71
114
|
* for seed delivery, yet its repo streams are still refused.
|
|
72
115
|
*
|
|
116
|
+
* ## The bring-up quiet period
|
|
117
|
+
*
|
|
118
|
+
* One state is decided BEFORE any of the above, and is not about the remote peer
|
|
119
|
+
* at all: while this node's control-database bring-up is in flight
|
|
120
|
+
* (`InboundAdmissionPolicy.bringUpInFlight`), the gate denies BOTH directions —
|
|
121
|
+
* `denyDialPeer` and `denyInboundEncryptedConnection` — and then opens.
|
|
122
|
+
*
|
|
123
|
+
* The invariant it protects is "`ControlDatabase.initialize()` runs while this
|
|
124
|
+
* node holds ZERO control connections". Building that database is a long chain
|
|
125
|
+
* of cohort-consulting block probes, and every connected same-party sibling is in
|
|
126
|
+
* the cohort those probes consult. A sibling that has not yet replicated this
|
|
127
|
+
* node's `CadrePeer` row correctly refuses them at its own fail-closed per-stream
|
|
128
|
+
* gate, so ONE connection in this window turns bring-up into
|
|
129
|
+
* `BlockUnavailableError` and `start()` rejects. Retrying cannot converge: the
|
|
130
|
+
* condition that would clear the refusal is this node's own row reaching the
|
|
131
|
+
* sibling, and writing that row needs the database the retry is building. So the
|
|
132
|
+
* only fix is to not be in the conversation yet — which is what this window is.
|
|
133
|
+
*
|
|
134
|
+
* The ordering is arranged so nothing SHOULD open a connection here anyway:
|
|
135
|
+
* `network.relayAddrs` resolves to a listener that dials nothing and reserves
|
|
136
|
+
* after bring-up (`relay-addrs.ts`), and the control-cohort reconcile pass is
|
|
137
|
+
* scheduled post-start. This window is what makes that a property rather than an
|
|
138
|
+
* accident of ordering — the live case it actually catches is
|
|
139
|
+
* `controlNetwork.bootstrapNodes`, where `@libp2p/bootstrap` emits its discovery
|
|
140
|
+
* events ~1 s after `libp2p.start()` and the connection manager auto-dials from
|
|
141
|
+
* there, which is a race bring-up wins only while raw-storage latency stays low.
|
|
142
|
+
*
|
|
143
|
+
* A denial here costs a retry, not a partition: libp2p's connection manager
|
|
144
|
+
* re-dials on its auto-dial cadence, the reservation supervisor re-drives, and a
|
|
145
|
+
* denied inbound peer reconnects. The window opens on bring-up FAILURE too (via
|
|
146
|
+
* `CadreNode.cleanup`), so teardown is never gated.
|
|
147
|
+
*
|
|
73
148
|
* ## Fail-open, deliberately
|
|
74
149
|
*
|
|
75
|
-
*
|
|
76
|
-
* outsider while no stranger path is open". Any error, missing
|
|
77
|
-
* ambiguous state admits the connection and
|
|
78
|
-
* gates — a DB hiccup must not partition a
|
|
150
|
+
* Outside that window this layer only ever denies on a POSITIVE determination of
|
|
151
|
+
* "unauthorized outsider while no stranger path is open". Any error, missing
|
|
152
|
+
* dependency, or ambiguous state admits the connection (and the reservation) and
|
|
153
|
+
* defers to the fail-closed stream gates — a DB hiccup must not partition a
|
|
154
|
+
* legitimate cadre.
|
|
79
155
|
*/
|
|
80
156
|
import type { ConnectionGater } from '@libp2p/interface';
|
|
81
157
|
/**
|
|
@@ -94,7 +170,8 @@ export declare const STRANGER_OPEN_PROTOCOLS: readonly string[];
|
|
|
94
170
|
*/
|
|
95
171
|
export declare const DEFAULT_ENROLLMENT_WINDOW_MS: number;
|
|
96
172
|
/**
|
|
97
|
-
* Deadline for one admission decision, after which the
|
|
173
|
+
* Deadline for one admission decision, after which the fail-open outcome is
|
|
174
|
+
* used (connection admitted / reservation admitted).
|
|
98
175
|
*
|
|
99
176
|
* libp2p awaits `denyInboundEncryptedConnection` inside the inbound upgrade
|
|
100
177
|
* WITHOUT racing its inbound-upgrade timeout signal (unlike the pre-encryption
|
|
@@ -108,25 +185,134 @@ export declare const DEFAULT_ENROLLMENT_WINDOW_MS: number;
|
|
|
108
185
|
*/
|
|
109
186
|
export declare const ADMISSION_DECISION_TIMEOUT_MS = 2000;
|
|
110
187
|
/**
|
|
111
|
-
*
|
|
112
|
-
* `
|
|
113
|
-
*
|
|
188
|
+
* How long an `'admit-for-relay'` connection may exist without a relay
|
|
189
|
+
* reservation being ADMITTED at the `denyInboundRelayReservation` hook, after
|
|
190
|
+
* which the gate aborts the underlying connection. A reserving client asks for
|
|
191
|
+
* its slot immediately after the connection upgrades (`relay-reservation.ts`
|
|
192
|
+
* dials and requests in one drive; a strand node's configured circuit listener
|
|
193
|
+
* does the same from inside its own `listen()`), so a connection idle past this
|
|
194
|
+
* deadline is not reserving.
|
|
195
|
+
*/
|
|
196
|
+
export declare const RELAY_ADMISSION_RESERVE_DEADLINE_MS = 5000;
|
|
197
|
+
/**
|
|
198
|
+
* Default cap on concurrent relay reservations held by peers the membership
|
|
199
|
+
* check could not place (see {@link UnauthorizedReservationBudget}). Small on
|
|
200
|
+
* purpose: it exists for the handful of genuine members whose rows are still
|
|
201
|
+
* in flight, not as public relay capacity. Overridable per node via
|
|
202
|
+
* `network.unauthorizedRelayReservationCap` (0 refuses every unauthorized
|
|
203
|
+
* reservation — the strict pre-seam posture).
|
|
204
|
+
*
|
|
205
|
+
* NOTE: this cap shares the relay server's own reservation store, whose default
|
|
206
|
+
* size is 15 (`@libp2p/circuit-relay-v2`'s `DEFAULT_MAX_RESERVATION_STORE_SIZE`);
|
|
207
|
+
* unplaced peers may therefore occupy up to this many of those slots, and the
|
|
208
|
+
* rest are what members and delegates compete for. This module cannot read the
|
|
209
|
+
* server's size, so the two are kept apart by hand — if either is raised, keep
|
|
210
|
+
* this one well under the store's, or a fleet of unplaceable peers can crowd
|
|
211
|
+
* genuine members out of the server's own store (which the gate cannot override).
|
|
212
|
+
*/
|
|
213
|
+
export declare const MAX_UNAUTHORIZED_RELAY_RESERVATIONS = 8;
|
|
214
|
+
/**
|
|
215
|
+
* How long one {@link UnauthorizedReservationBudget} entry occupies a slot
|
|
216
|
+
* without a refresh. Mirrors the relay server's own default reservation TTL
|
|
217
|
+
* (`@libp2p/circuit-relay-v2`'s `DEFAULT_MAX_RESERVATION_TTL`, 2 h): the server
|
|
218
|
+
* holds an unrefreshed reservation exactly that long, and a live reserver
|
|
219
|
+
* re-requests (re-hitting the admission hook, refreshing its entry) well before
|
|
220
|
+
* expiry — so the live entry count tracks the server's own occupancy without
|
|
221
|
+
* this module reaching into the server's reservation store.
|
|
222
|
+
*
|
|
223
|
+
* NOTE: a mirror, not a live coupling — if the relay server is ever configured
|
|
224
|
+
* with a non-default `reservationTtl` (db-p2p's `relayServerInit`), update this
|
|
225
|
+
* constant alongside it or the budget's occupancy drifts from the server's.
|
|
226
|
+
*/
|
|
227
|
+
export declare const UNAUTHORIZED_RESERVATION_TTL_MS: number;
|
|
228
|
+
/**
|
|
229
|
+
* The connection-level outcome of the admission policy:
|
|
230
|
+
* - `'admit'` — a peer with a legitimate claim on the connection (member,
|
|
231
|
+
* delegate, infra, open stranger window, or any fail-open state).
|
|
232
|
+
* - `'deny'` — positively an outsider, and this node runs no relay server, so
|
|
233
|
+
* the connection can carry nothing legitimate.
|
|
234
|
+
* - `'admit-for-relay'` — positively an outsider (or an unreplicated member —
|
|
235
|
+
* indistinguishable), but this node runs the relay server: admit the
|
|
236
|
+
* connection so a reservation can be asked for, decide at the reservation
|
|
237
|
+
* seam, and drop the connection if no reservation is admitted in time.
|
|
238
|
+
*/
|
|
239
|
+
export type InboundConnectionVerdict = 'admit' | 'deny' | 'admit-for-relay';
|
|
240
|
+
/**
|
|
241
|
+
* The admission decisions the gate defers to — implemented by
|
|
242
|
+
* `CadreNode.admitInboundControlConnection` /
|
|
243
|
+
* `CadreNode.admitControlRelayReservation` (enrollment windows, anchor state,
|
|
244
|
+
* bootstrap infra, delegate grants, the authorized-member set, the
|
|
245
|
+
* unauthorized-reservation budget). Kept injectable so the gater's
|
|
114
246
|
* composition/fail-open behavior is unit-testable without a full node.
|
|
115
247
|
*/
|
|
116
248
|
export interface InboundAdmissionPolicy {
|
|
117
|
-
/**
|
|
118
|
-
admitInbound(remotePeerId: string): Promise<
|
|
249
|
+
/** Verdict on an inbound encrypted connection from this peer. */
|
|
250
|
+
admitInbound(remotePeerId: string): Promise<InboundConnectionVerdict> | InboundConnectionVerdict;
|
|
251
|
+
/** Should this peer be granted a circuit-relay reservation slot? */
|
|
252
|
+
admitRelayReservation(remotePeerId: string): Promise<boolean> | boolean;
|
|
253
|
+
/**
|
|
254
|
+
* True while this node's control-database bring-up is in flight — the
|
|
255
|
+
* {@link createMembershipConnectionGater} quiet period (see the module doc).
|
|
256
|
+
* Peer-independent, unlike the two decisions above, and SYNCHRONOUS: it is
|
|
257
|
+
* read on the outbound-dial path, where an await would be a new stall.
|
|
258
|
+
*
|
|
259
|
+
* Optional — a policy that omits it is never quiet, which is the right default
|
|
260
|
+
* for every caller that is not a booting `CadreNode`.
|
|
261
|
+
*/
|
|
262
|
+
bringUpInFlight?(): boolean;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Bounded budget of concurrent relay reservations for peers the membership
|
|
266
|
+
* check could not place. `tryAdmit` is the whole surface: an already-admitted
|
|
267
|
+
* peer refreshes its entry (a reservation refresh never double-counts), a new
|
|
268
|
+
* peer takes a free slot or is refused. Entries expire after `ttlMs` (see
|
|
269
|
+
* {@link UNAUTHORIZED_RESERVATION_TTL_MS} for why that mirrors the relay
|
|
270
|
+
* server's own hold). Injectable `now` keeps expiry testable without fake
|
|
271
|
+
* timers. Authorized members and delegates are never run through this — the
|
|
272
|
+
* policy admits them before consulting the budget, and `release`s the slot such
|
|
273
|
+
* a peer took while it was still unplaceable, so the boot-ordering window a
|
|
274
|
+
* member passes through costs the budget nothing once its row lands.
|
|
275
|
+
*/
|
|
276
|
+
export declare class UnauthorizedReservationBudget {
|
|
277
|
+
private readonly cap;
|
|
278
|
+
private readonly ttlMs;
|
|
279
|
+
private readonly admitted;
|
|
280
|
+
constructor(cap?: number, ttlMs?: number);
|
|
281
|
+
/** Number of live (unexpired at last prune) entries — test/diagnostic surface. */
|
|
282
|
+
get size(): number;
|
|
283
|
+
/** Admit (or refresh) `remotePeerId` if a slot is free; false when the cap is spent. */
|
|
284
|
+
tryAdmit(remotePeerId: string, now?: number): boolean;
|
|
285
|
+
/**
|
|
286
|
+
* Give back the slot `remotePeerId` holds, if any — called when the peer has
|
|
287
|
+
* become admissible on its own merits (its membership row replicated, or a
|
|
288
|
+
* delegate grant landed), so the slot it took during the boot-ordering window
|
|
289
|
+
* does not stay spent for the remaining TTL on a peer that no longer needs it.
|
|
290
|
+
*/
|
|
291
|
+
release(remotePeerId: string): void;
|
|
292
|
+
private prune;
|
|
119
293
|
}
|
|
120
294
|
/**
|
|
121
295
|
* Build the control node's connection gater: the caller-supplied gater (if any)
|
|
122
296
|
* with membership admission composed onto `denyInboundEncryptedConnection` —
|
|
123
|
-
* the earliest checkpoint where the remote's authenticated PeerId is known
|
|
297
|
+
* the earliest checkpoint where the remote's authenticated PeerId is known —
|
|
298
|
+
* and reservation admission composed onto `denyInboundRelayReservation` — the
|
|
299
|
+
* hook the circuit-relay server consults per RESERVE request (inert on a node
|
|
300
|
+
* whose relay server is off; libp2p never calls it there).
|
|
301
|
+
*
|
|
302
|
+
* `denyDialPeer` is composed too, but ONLY for the bring-up quiet period (see
|
|
303
|
+
* the module doc): outside that window outbound dials are never gated by
|
|
304
|
+
* membership — this node decides for itself who to talk to.
|
|
305
|
+
*
|
|
306
|
+
* Composition semantics: every hook of `base` is preserved as-is; on the three
|
|
307
|
+
* composed hooks a deny from EITHER the base gater or the admission policy
|
|
308
|
+
* denies. A policy error — or a decision slower than `decisionTimeoutMs` —
|
|
309
|
+
* takes the fail-open outcome (connection admitted / reservation admitted, see
|
|
310
|
+
* module doc); the base gater's verdict is still honored first.
|
|
124
311
|
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* `
|
|
129
|
-
* verdict is still honored first.
|
|
312
|
+
* An `'admit-for-relay'` verdict admits the connection and arms a
|
|
313
|
+
* `reserveDeadlineMs` timer against it; the timer is disarmed when a
|
|
314
|
+
* reservation for that peer is ADMITTED at the reservation hook, and aborts the
|
|
315
|
+
* underlying `MultiaddrConnection` when it fires first.
|
|
130
316
|
*
|
|
131
317
|
* NOTE: `base` is spread, so a gater passed as a CLASS INSTANCE would lose its
|
|
132
318
|
* prototype methods; every caller in this repo (and libp2p's own default)
|
|
@@ -143,4 +329,4 @@ export interface InboundAdmissionPolicy {
|
|
|
143
329
|
* Control node only: strand cohort nodes legitimately connect cross-party
|
|
144
330
|
* peers, so `CadreNode` threads the raw configured gater to them unchanged.
|
|
145
331
|
*/
|
|
146
|
-
export declare function createMembershipConnectionGater(policy: InboundAdmissionPolicy, base?: ConnectionGater, decisionTimeoutMs?: number): ConnectionGater;
|
|
332
|
+
export declare function createMembershipConnectionGater(policy: InboundAdmissionPolicy, base?: ConnectionGater, decisionTimeoutMs?: number, reserveDeadlineMs?: number): ConnectionGater;
|