@minip2p/react-native 0.8.0 → 0.8.3

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/src/adapter.ts CHANGED
@@ -229,15 +229,9 @@ class ReactNativeBackend implements Minip2pBackend {
229
229
  };
230
230
  }
231
231
 
232
- sendStream(
233
- peerId: string,
234
- connId: number,
235
- streamId: number,
236
- data: Uint8Array
237
- ): boolean {
232
+ sendStream(connId: number, streamId: number, data: Uint8Array): boolean {
238
233
  return translateErrors(() =>
239
234
  this.#endpoint.sendStream(
240
- peerId,
241
235
  this.#connectionIds.toNative(connId),
242
236
  numberToU64(streamId, "streamId"),
243
237
  toArrayBuffer(data)
@@ -245,30 +239,27 @@ class ReactNativeBackend implements Minip2pBackend {
245
239
  );
246
240
  }
247
241
 
248
- closeStreamWrite(peerId: string, connId: number, streamId: number): void {
242
+ closeStreamWrite(connId: number, streamId: number): void {
249
243
  translateErrors(() => {
250
244
  this.#endpoint.closeStreamWrite(
251
- peerId,
252
245
  this.#connectionIds.toNative(connId),
253
246
  numberToU64(streamId, "streamId")
254
247
  );
255
248
  });
256
249
  }
257
250
 
258
- resetStream(peerId: string, connId: number, streamId: number): void {
251
+ resetStream(connId: number, streamId: number): void {
259
252
  translateErrors(() => {
260
253
  this.#endpoint.resetStream(
261
- peerId,
262
254
  this.#connectionIds.toNative(connId),
263
255
  numberToU64(streamId, "streamId")
264
256
  );
265
257
  });
266
258
  }
267
259
 
268
- abandonStream(peerId: string, connId: number, streamId: number): void {
260
+ abandonStream(connId: number, streamId: number): void {
269
261
  translateErrors(() => {
270
262
  this.#endpoint.abandonStream(
271
- peerId,
272
263
  this.#connectionIds.toNative(connId),
273
264
  numberToU64(streamId, "streamId")
274
265
  );
@@ -453,7 +444,10 @@ function normalizeGenericEvent(
453
444
  event: NativeP2pEvent,
454
445
  connectionIds: ConnectionIdMap
455
446
  ): P2pEvent {
456
- const inner = normalizeBigInts(event.inner, connectionIds);
447
+ const inner = normalizeBigInts(event.inner, {
448
+ connectionIds,
449
+ tag: event.tag,
450
+ });
457
451
  if (inner === null || typeof inner !== "object") {
458
452
  throw new TypeError("The native endpoint returned an invalid event");
459
453
  }
@@ -501,14 +495,20 @@ const CONNECTION_ID_KEYS: ReadonlySet<string> = new Set([
501
495
  "newConnId",
502
496
  ]);
503
497
 
498
+ /** The endpoint's connection map and the native event a value belongs to. */
499
+ interface EventIds {
500
+ readonly connectionIds: ConnectionIdMap;
501
+ readonly tag: string;
502
+ }
503
+
504
504
  /**
505
- * Converts native `bigint` fields to numbers. Connection ID fields go through
506
- * the endpoint's connection map when one is supplied; every other `u64` keeps
507
- * the checked conversion.
505
+ * Converts native `bigint` fields to numbers. Connection ID fields of an
506
+ * event go through the endpoint's connection map; every other `u64` keeps the
507
+ * checked conversion.
508
508
  */
509
509
  function normalizeBigInts(
510
510
  value: unknown,
511
- connectionIds?: ConnectionIdMap,
511
+ event?: EventIds,
512
512
  key?: string
513
513
  ): unknown {
514
514
  if (typeof value === "bigint") {
@@ -516,23 +516,22 @@ function normalizeBigInts(
516
516
  if (key === "errorCode") {
517
517
  return value;
518
518
  }
519
- return key !== undefined &&
520
- CONNECTION_ID_KEYS.has(key) &&
521
- connectionIds !== undefined
522
- ? connectionIds.toPublic(value)
523
- : u64ToNumber(value, "native u64");
519
+ if (key === undefined || !CONNECTION_ID_KEYS.has(key) || !event) {
520
+ return u64ToNumber(value, "native u64");
521
+ }
522
+ return event.connectionIds.toPublicInEvent(event.tag, key, value);
524
523
  }
525
524
  if (value instanceof ArrayBuffer) {
526
525
  return value;
527
526
  }
528
527
  if (Array.isArray(value)) {
529
- return value.map((item) => normalizeBigInts(item, connectionIds));
528
+ return value.map((item) => normalizeBigInts(item, event));
530
529
  }
531
530
  if (value !== null && typeof value === "object") {
532
531
  return Object.fromEntries(
533
532
  Object.entries(value).map(([itemKey, item]) => [
534
533
  itemKey,
535
- normalizeBigInts(item, connectionIds, itemKey),
534
+ normalizeBigInts(item, event, itemKey),
536
535
  ])
537
536
  );
538
537
  }
@@ -76,11 +76,11 @@ interface NativeModuleInterface {
76
76
  ubrn_uniffi_minip2p_ffi_fn_func_generate_secret_key(uniffi_out_err: UniffiRustCallStatus): Uint8Array;
77
77
  ubrn_uniffi_minip2p_ffi_fn_func_peer_id_from_secret_key(secretKey: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
78
78
  ubrn_uniffi_minip2p_ffi_fn_constructor_p2pendpoint_new(secretKey: Uint8Array, config: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
79
- ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_abandon_stream(uniffiSelf: bigint, peerId: Uint8Array, connId: bigint, streamId: bigint, uniffi_out_err: UniffiRustCallStatus): void;
79
+ ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_abandon_stream(uniffiSelf: bigint, connId: bigint, streamId: bigint, uniffi_out_err: UniffiRustCallStatus): void;
80
80
  ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_active_reservation(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
81
81
  ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_add_protocol(uniffiSelf: bigint, protocolId: Uint8Array, uniffi_out_err: UniffiRustCallStatus): void;
82
82
  ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_cancel_connect(uniffiSelf: bigint, id: bigint, uniffi_out_err: UniffiRustCallStatus): void;
83
- ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_close_stream_write(uniffiSelf: bigint, peerId: Uint8Array, connId: bigint, streamId: bigint, uniffi_out_err: UniffiRustCallStatus): void;
83
+ ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_close_stream_write(uniffiSelf: bigint, connId: bigint, streamId: bigint, uniffi_out_err: UniffiRustCallStatus): void;
84
84
  ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connect(uniffiSelf: bigint, target: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
85
85
  ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connected_peers(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
86
86
  ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connection_info(uniffiSelf: bigint, peerId: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
@@ -98,8 +98,8 @@ interface NativeModuleInterface {
98
98
  ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_ping(uniffiSelf: bigint, peerId: Uint8Array, uniffi_out_err: UniffiRustCallStatus): void;
99
99
  ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_publish(uniffiSelf: bigint, topic: Uint8Array, data: Uint8Array, uniffi_out_err: UniffiRustCallStatus): void;
100
100
  ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_reachability(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
101
- ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_reset_stream(uniffiSelf: bigint, peerId: Uint8Array, connId: bigint, streamId: bigint, uniffi_out_err: UniffiRustCallStatus): void;
102
- ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_send_stream(uniffiSelf: bigint, peerId: Uint8Array, connId: bigint, streamId: bigint, data: Uint8Array, uniffi_out_err: UniffiRustCallStatus): number;
101
+ ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_reset_stream(uniffiSelf: bigint, connId: bigint, streamId: bigint, uniffi_out_err: UniffiRustCallStatus): void;
102
+ ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_send_stream(uniffiSelf: bigint, connId: bigint, streamId: bigint, data: Uint8Array, uniffi_out_err: UniffiRustCallStatus): number;
103
103
  ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_set_active(uniffiSelf: bigint, active: number, uniffi_out_err: UniffiRustCallStatus): void;
104
104
  ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_start(uniffiSelf: bigint, doorbell: bigint, uniffi_out_err: UniffiRustCallStatus): void;
105
105
  ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_stop(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): void;
@@ -298,7 +298,7 @@ export interface P2pEndpointLike {
298
298
  /**
299
299
  * Forgets a stream.
300
300
  */
301
- abandonStream(peerId: string, connId: bigint, streamId: bigint) /*throws*/: void;
301
+ abandonStream(connId: bigint, streamId: bigint) /*throws*/: void;
302
302
  /**
303
303
  * Returns the active relay reservation.
304
304
  */
@@ -314,7 +314,7 @@ export interface P2pEndpointLike {
314
314
  /**
315
315
  * Half-closes a stream's write side.
316
316
  */
317
- closeStreamWrite(peerId: string, connId: bigint, streamId: bigint) /*throws*/: void;
317
+ closeStreamWrite(connId: bigint, streamId: bigint) /*throws*/: void;
318
318
  /**
319
319
  * Starts one Connection attempt and returns its Connect ID.
320
320
  */
@@ -386,7 +386,7 @@ export interface P2pEndpointLike {
386
386
  /**
387
387
  * Resets a stream.
388
388
  */
389
- resetStream(peerId: string, connId: bigint, streamId: bigint) /*throws*/: void;
389
+ resetStream(connId: bigint, streamId: bigint) /*throws*/: void;
390
390
  /**
391
391
  * Sends bytes on a stream, named by its connection and stream ids.
392
392
  *
@@ -395,7 +395,7 @@ export interface P2pEndpointLike {
395
395
  * write side ends first (`StreamWriteStopped`, `StreamClosed`, a reset,
396
396
  * or the connection closing or being replaced), which drops the tail.
397
397
  */
398
- sendStream(peerId: string, connId: bigint, streamId: bigint, data: ArrayBuffer) /*throws*/: boolean;
398
+ sendStream(connId: bigint, streamId: bigint, data: ArrayBuffer) /*throws*/: boolean;
399
399
  /**
400
400
  * Accepted for compatibility; has no effect, since the driver sleeps until the endpoint's next deadline.
401
401
  */
@@ -466,11 +466,10 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
466
466
  /**
467
467
  * Forgets a stream.
468
468
  */
469
- abandonStream(peerId: string, connId: bigint, streamId: bigint): void /*throws*/ {uniffiCaller.rustCallWithError(
469
+ abandonStream(connId: bigint, streamId: bigint): void /*throws*/ {uniffiCaller.rustCallWithError(
470
470
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
471
471
  /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_abandon_stream(
472
472
  uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
473
- FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc),
474
473
  FfiConverterUInt64.lower(connId, nativeModule().rustbuffer_alloc),
475
474
  FfiConverterUInt64.lower(streamId, nativeModule().rustbuffer_alloc),
476
475
  callStatus);
@@ -530,11 +529,10 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
530
529
  /**
531
530
  * Half-closes a stream's write side.
532
531
  */
533
- closeStreamWrite(peerId: string, connId: bigint, streamId: bigint): void /*throws*/ {uniffiCaller.rustCallWithError(
532
+ closeStreamWrite(connId: bigint, streamId: bigint): void /*throws*/ {uniffiCaller.rustCallWithError(
534
533
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
535
534
  /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_close_stream_write(
536
535
  uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
537
- FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc),
538
536
  FfiConverterUInt64.lower(connId, nativeModule().rustbuffer_alloc),
539
537
  FfiConverterUInt64.lower(streamId, nativeModule().rustbuffer_alloc),
540
538
  callStatus);
@@ -858,11 +856,10 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
858
856
  /**
859
857
  * Resets a stream.
860
858
  */
861
- resetStream(peerId: string, connId: bigint, streamId: bigint): void /*throws*/ {uniffiCaller.rustCallWithError(
859
+ resetStream(connId: bigint, streamId: bigint): void /*throws*/ {uniffiCaller.rustCallWithError(
862
860
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
863
861
  /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_reset_stream(
864
862
  uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
865
- FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc),
866
863
  FfiConverterUInt64.lower(connId, nativeModule().rustbuffer_alloc),
867
864
  FfiConverterUInt64.lower(streamId, nativeModule().rustbuffer_alloc),
868
865
  callStatus);
@@ -879,13 +876,12 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
879
876
  * write side ends first (`StreamWriteStopped`, `StreamClosed`, a reset,
880
877
  * or the connection closing or being replaced), which drops the tail.
881
878
  */
882
- sendStream(peerId: string, connId: bigint, streamId: bigint, data: ArrayBuffer): boolean /*throws*/ {
879
+ sendStream(connId: bigint, streamId: bigint, data: ArrayBuffer): boolean /*throws*/ {
883
880
  return FfiConverterBool.lift(uniffiCaller.rustCallWithError(
884
881
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
885
882
  /*caller:*/ (callStatus) => {
886
883
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_send_stream(
887
884
  uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
888
- FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc),
889
885
  FfiConverterUInt64.lower(connId, nativeModule().rustbuffer_alloc),
890
886
  FfiConverterUInt64.lower(streamId, nativeModule().rustbuffer_alloc),
891
887
  FfiConverterArrayBuffer.lower(data, nativeModule().rustbuffer_alloc),
@@ -1123,7 +1119,7 @@ function uniffiEnsureInitialized() {
1123
1119
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_constructor_p2pendpoint_new() !== 40346) {
1124
1120
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_constructor_p2pendpoint_new");
1125
1121
  }
1126
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_abandon_stream() !== 39078) {
1122
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_abandon_stream() !== 3134) {
1127
1123
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_abandon_stream");
1128
1124
  }
1129
1125
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_active_reservation() !== 7490) {
@@ -1135,7 +1131,7 @@ function uniffiEnsureInitialized() {
1135
1131
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_cancel_connect() !== 21146) {
1136
1132
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_cancel_connect");
1137
1133
  }
1138
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write() !== 32688) {
1134
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write() !== 63517) {
1139
1135
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write");
1140
1136
  }
1141
1137
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect() !== 21790) {
@@ -1189,10 +1185,10 @@ function uniffiEnsureInitialized() {
1189
1185
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_reachability() !== 4853) {
1190
1186
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_reachability");
1191
1187
  }
1192
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_reset_stream() !== 50205) {
1188
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_reset_stream() !== 8949) {
1193
1189
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_reset_stream");
1194
1190
  }
1195
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_send_stream() !== 41451) {
1191
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_send_stream() !== 31876) {
1196
1192
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_send_stream");
1197
1193
  }
1198
1194
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_set_active() !== 10522) {
@@ -227,10 +227,6 @@ export type MdnsOptions = {
227
227
  * Interface re-enumeration interval, in milliseconds.
228
228
  */
229
229
  interfaceRefreshMs: bigint,
230
- /**
231
- * Maximum blocking wait before polling mDNS sockets again.
232
- */
233
- socketPollIntervalMs: bigint,
234
230
  /**
235
231
  * Whether accepted mDNS observations may trigger automatic dials.
236
232
  */
@@ -264,7 +260,6 @@ const FfiConverterTypeMdnsOptions = (() => {
264
260
  maxPacketBytes: FfiConverterUInt32.readFromCursor(c),
265
261
  maxAnnouncedAddrs: FfiConverterUInt32.readFromCursor(c),
266
262
  interfaceRefreshMs: FfiConverterUInt64.readFromCursor(c),
267
- socketPollIntervalMs: FfiConverterUInt64.readFromCursor(c),
268
263
  autoDial: FfiConverterBool.readFromCursor(c)
269
264
  };
270
265
  }
@@ -275,7 +270,6 @@ const FfiConverterTypeMdnsOptions = (() => {
275
270
  FfiConverterUInt32.writeIntoCursor(value.maxPacketBytes, c);
276
271
  FfiConverterUInt32.writeIntoCursor(value.maxAnnouncedAddrs, c);
277
272
  FfiConverterUInt64.writeIntoCursor(value.interfaceRefreshMs, c);
278
- FfiConverterUInt64.writeIntoCursor(value.socketPollIntervalMs, c);
279
273
  FfiConverterBool.writeIntoCursor(value.autoDial, c);
280
274
  }
281
275
  allocationSize(value: TypeName): number {
@@ -285,7 +279,6 @@ const FfiConverterTypeMdnsOptions = (() => {
285
279
  FfiConverterUInt32.allocationSize(value.maxPacketBytes) +
286
280
  FfiConverterUInt32.allocationSize(value.maxAnnouncedAddrs) +
287
281
  FfiConverterUInt64.allocationSize(value.interfaceRefreshMs) +
288
- FfiConverterUInt64.allocationSize(value.socketPollIntervalMs) +
289
282
  FfiConverterBool.allocationSize(value.autoDial);
290
283
 
291
284
  }
@@ -2236,7 +2229,7 @@ inner: {peerId: string; connId: bigint; protocols: Array<string> }): PeerReady_
2236
2229
  type IdentifyReceived__interface = {
2237
2230
  tag: P2pEvent_Tags.IdentifyReceived;
2238
2231
  inner:
2239
- Readonly<{peerId: string; info: IdentifyInfo}>
2232
+ Readonly<{peerId: string; connId: bigint; info: IdentifyInfo}>
2240
2233
  };
2241
2234
  /**
2242
2235
  * A peer supplied a new Identify snapshot.
@@ -2249,15 +2242,15 @@ Readonly<{peerId: string; info: IdentifyInfo}>
2249
2242
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2250
2243
  readonly tag = P2pEvent_Tags.IdentifyReceived;
2251
2244
  readonly inner:
2252
- Readonly<{peerId: string; info: IdentifyInfo}>;
2245
+ Readonly<{peerId: string; connId: bigint; info: IdentifyInfo}>;
2253
2246
  constructor(
2254
- inner: {peerId: string; info: IdentifyInfo }) {
2247
+ inner: {peerId: string; connId: bigint; info: IdentifyInfo }) {
2255
2248
  super("P2pEvent", "IdentifyReceived");
2256
2249
 
2257
2250
  this.inner = Object.freeze(inner);
2258
2251
  }
2259
2252
  static new(
2260
- inner: {peerId: string; info: IdentifyInfo }): IdentifyReceived_ {
2253
+ inner: {peerId: string; connId: bigint; info: IdentifyInfo }): IdentifyReceived_ {
2261
2254
  return new IdentifyReceived_(inner);
2262
2255
  }
2263
2256
 
@@ -2270,7 +2263,7 @@ inner: {peerId: string; info: IdentifyInfo }): IdentifyReceived_ {
2270
2263
  type PingRttMeasured__interface = {
2271
2264
  tag: P2pEvent_Tags.PingRttMeasured;
2272
2265
  inner:
2273
- Readonly<{peerId: string; rttMs: bigint}>
2266
+ Readonly<{peerId: string; connId: bigint; rttMs: bigint}>
2274
2267
  };
2275
2268
  /**
2276
2269
  * A ping round-trip measurement completed.
@@ -2283,15 +2276,15 @@ Readonly<{peerId: string; rttMs: bigint}>
2283
2276
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2284
2277
  readonly tag = P2pEvent_Tags.PingRttMeasured;
2285
2278
  readonly inner:
2286
- Readonly<{peerId: string; rttMs: bigint}>;
2279
+ Readonly<{peerId: string; connId: bigint; rttMs: bigint}>;
2287
2280
  constructor(
2288
- inner: {peerId: string; rttMs: bigint }) {
2281
+ inner: {peerId: string; connId: bigint; rttMs: bigint }) {
2289
2282
  super("P2pEvent", "PingRttMeasured");
2290
2283
 
2291
2284
  this.inner = Object.freeze(inner);
2292
2285
  }
2293
2286
  static new(
2294
- inner: {peerId: string; rttMs: bigint }): PingRttMeasured_ {
2287
+ inner: {peerId: string; connId: bigint; rttMs: bigint }): PingRttMeasured_ {
2295
2288
  return new PingRttMeasured_(inner);
2296
2289
  }
2297
2290
 
@@ -2304,7 +2297,7 @@ inner: {peerId: string; rttMs: bigint }): PingRttMeasured_ {
2304
2297
  type PingTimeout__interface = {
2305
2298
  tag: P2pEvent_Tags.PingTimeout;
2306
2299
  inner:
2307
- Readonly<{peerId: string}>
2300
+ Readonly<{peerId: string; connId: bigint}>
2308
2301
  };
2309
2302
  /**
2310
2303
  * A ping timed out.
@@ -2317,15 +2310,15 @@ Readonly<{peerId: string}>
2317
2310
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2318
2311
  readonly tag = P2pEvent_Tags.PingTimeout;
2319
2312
  readonly inner:
2320
- Readonly<{peerId: string}>;
2313
+ Readonly<{peerId: string; connId: bigint}>;
2321
2314
  constructor(
2322
- inner: {peerId: string }) {
2315
+ inner: {peerId: string; connId: bigint }) {
2323
2316
  super("P2pEvent", "PingTimeout");
2324
2317
 
2325
2318
  this.inner = Object.freeze(inner);
2326
2319
  }
2327
2320
  static new(
2328
- inner: {peerId: string }): PingTimeout_ {
2321
+ inner: {peerId: string; connId: bigint }): PingTimeout_ {
2329
2322
  return new PingTimeout_(inner);
2330
2323
  }
2331
2324
 
@@ -2748,7 +2741,7 @@ inner: {connectId: bigint; peerId: string; connId: bigint; path: PathKind }): Pa
2748
2741
  type InboundPathEstablished__interface = {
2749
2742
  tag: P2pEvent_Tags.InboundPathEstablished;
2750
2743
  inner:
2751
- Readonly<{peerId: string; path: PathKind}>
2744
+ Readonly<{peerId: string; path: PathKind; connId: bigint}>
2752
2745
  };
2753
2746
  /**
2754
2747
  * An inbound relay circuit became a usable path.
@@ -2761,15 +2754,15 @@ Readonly<{peerId: string; path: PathKind}>
2761
2754
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2762
2755
  readonly tag = P2pEvent_Tags.InboundPathEstablished;
2763
2756
  readonly inner:
2764
- Readonly<{peerId: string; path: PathKind}>;
2757
+ Readonly<{peerId: string; path: PathKind; connId: bigint}>;
2765
2758
  constructor(
2766
- inner: {peerId: string; path: PathKind }) {
2759
+ inner: {peerId: string; path: PathKind; connId: bigint }) {
2767
2760
  super("P2pEvent", "InboundPathEstablished");
2768
2761
 
2769
2762
  this.inner = Object.freeze(inner);
2770
2763
  }
2771
2764
  static new(
2772
- inner: {peerId: string; path: PathKind }): InboundPathEstablished_ {
2765
+ inner: {peerId: string; path: PathKind; connId: bigint }): InboundPathEstablished_ {
2773
2766
  return new InboundPathEstablished_(inner);
2774
2767
  }
2775
2768
 
@@ -2782,7 +2775,7 @@ inner: {peerId: string; path: PathKind }): InboundPathEstablished_ {
2782
2775
  type PathUpgraded__interface = {
2783
2776
  tag: P2pEvent_Tags.PathUpgraded;
2784
2777
  inner:
2785
- Readonly<{connectId: bigint; peerId: string; from: PathKind; to: PathKind}>
2778
+ Readonly<{connectId: bigint; peerId: string; from: PathKind; to: PathKind; oldConnId: bigint; newConnId: bigint}>
2786
2779
  };
2787
2780
  /**
2788
2781
  * A better path replaced an earlier path.
@@ -2795,15 +2788,15 @@ Readonly<{connectId: bigint; peerId: string; from: PathKind; to: PathKind}>
2795
2788
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2796
2789
  readonly tag = P2pEvent_Tags.PathUpgraded;
2797
2790
  readonly inner:
2798
- Readonly<{connectId: bigint; peerId: string; from: PathKind; to: PathKind}>;
2791
+ Readonly<{connectId: bigint; peerId: string; from: PathKind; to: PathKind; oldConnId: bigint; newConnId: bigint}>;
2799
2792
  constructor(
2800
- inner: {connectId: bigint; peerId: string; from: PathKind; to: PathKind }) {
2793
+ inner: {connectId: bigint; peerId: string; from: PathKind; to: PathKind; oldConnId: bigint; newConnId: bigint }) {
2801
2794
  super("P2pEvent", "PathUpgraded");
2802
2795
 
2803
2796
  this.inner = Object.freeze(inner);
2804
2797
  }
2805
2798
  static new(
2806
- inner: {connectId: bigint; peerId: string; from: PathKind; to: PathKind }): PathUpgraded_ {
2799
+ inner: {connectId: bigint; peerId: string; from: PathKind; to: PathKind; oldConnId: bigint; newConnId: bigint }): PathUpgraded_ {
2807
2800
  return new PathUpgraded_(inner);
2808
2801
  }
2809
2802
 
@@ -2819,7 +2812,8 @@ inner: {connectId: bigint; peerId: string; from: PathKind; to: PathKind }): Path
2819
2812
  Readonly<{connectId: bigint; attempt: number; reason: string}>
2820
2813
  };
2821
2814
  /**
2822
- * One hole-punch window failed.
2815
+ * One DCUtR hole-punch round failed; the relay holder may start the
2816
+ * next one.
2823
2817
  */
2824
2818
  class HolePunchFailed_ extends UniffiEnum implements HolePunchFailed__interface {
2825
2819
  /**
@@ -2919,7 +2913,7 @@ inner: {connectId: bigint; peerId: string }): ConnectCancelled_ {
2919
2913
  type InboundDirectUpgrade__interface = {
2920
2914
  tag: P2pEvent_Tags.InboundDirectUpgrade;
2921
2915
  inner:
2922
- Readonly<{peerId: string}>
2916
+ Readonly<{peerId: string; oldConnId: bigint; newConnId: bigint}>
2923
2917
  };
2924
2918
  /**
2925
2919
  * An inbound circuit upgraded to a direct connection.
@@ -2932,15 +2926,15 @@ Readonly<{peerId: string}>
2932
2926
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2933
2927
  readonly tag = P2pEvent_Tags.InboundDirectUpgrade;
2934
2928
  readonly inner:
2935
- Readonly<{peerId: string}>;
2929
+ Readonly<{peerId: string; oldConnId: bigint; newConnId: bigint}>;
2936
2930
  constructor(
2937
- inner: {peerId: string }) {
2931
+ inner: {peerId: string; oldConnId: bigint; newConnId: bigint }) {
2938
2932
  super("P2pEvent", "InboundDirectUpgrade");
2939
2933
 
2940
2934
  this.inner = Object.freeze(inner);
2941
2935
  }
2942
2936
  static new(
2943
- inner: {peerId: string }): InboundDirectUpgrade_ {
2937
+ inner: {peerId: string; oldConnId: bigint; newConnId: bigint }): InboundDirectUpgrade_ {
2944
2938
  return new InboundDirectUpgrade_(inner);
2945
2939
  }
2946
2940
 
@@ -3359,9 +3353,9 @@ const FfiConverterTypeP2pEvent = (() => {
3359
3353
  case 4: return new P2pEvent.ConnectionClosed({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3360
3354
  case 5: return new P2pEvent.ConnectionReplaced({peerId: FfiConverterString.readFromCursor(c), oldConnId: FfiConverterUInt64.readFromCursor(c), newConnId: FfiConverterUInt64.readFromCursor(c) });
3361
3355
  case 6: return new P2pEvent.PeerReady({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), protocols: FfiConverterSequenceString.readFromCursor(c) });
3362
- case 7: return new P2pEvent.IdentifyReceived({peerId: FfiConverterString.readFromCursor(c), info: FfiConverterTypeIdentifyInfo.readFromCursor(c) });
3363
- case 8: return new P2pEvent.PingRttMeasured({peerId: FfiConverterString.readFromCursor(c), rttMs: FfiConverterUInt64.readFromCursor(c) });
3364
- case 9: return new P2pEvent.PingTimeout({peerId: FfiConverterString.readFromCursor(c) });
3356
+ case 7: return new P2pEvent.IdentifyReceived({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), info: FfiConverterTypeIdentifyInfo.readFromCursor(c) });
3357
+ case 8: return new P2pEvent.PingRttMeasured({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), rttMs: FfiConverterUInt64.readFromCursor(c) });
3358
+ case 9: return new P2pEvent.PingTimeout({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3365
3359
  case 10: return new P2pEvent.StreamReady({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c), protocolId: FfiConverterString.readFromCursor(c), initiatedLocally: FfiConverterBool.readFromCursor(c) });
3366
3360
  case 11: return new P2pEvent.StreamData({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c), data: FfiConverterArrayBuffer.readFromCursor(c) });
3367
3361
  case 12: return new P2pEvent.StreamWriteAccepted({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c) });
@@ -3374,12 +3368,12 @@ const FfiConverterTypeP2pEvent = (() => {
3374
3368
  case 19: return new P2pEvent.RelayReserved({relayPeerId: FfiConverterString.readFromCursor(c), expiresUnixSecs: FfiConverterOptionalUInt64.readFromCursor(c) });
3375
3369
  case 20: return new P2pEvent.RelayReservationLost({relayPeerId: FfiConverterString.readFromCursor(c) });
3376
3370
  case 21: return new P2pEvent.PathEstablished({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c) });
3377
- case 22: return new P2pEvent.InboundPathEstablished({peerId: FfiConverterString.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c) });
3378
- case 23: return new P2pEvent.PathUpgraded({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), from: FfiConverterTypePathKind.readFromCursor(c), to: FfiConverterTypePathKind.readFromCursor(c) });
3371
+ case 22: return new P2pEvent.InboundPathEstablished({peerId: FfiConverterString.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3372
+ case 23: return new P2pEvent.PathUpgraded({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), from: FfiConverterTypePathKind.readFromCursor(c), to: FfiConverterTypePathKind.readFromCursor(c), oldConnId: FfiConverterUInt64.readFromCursor(c), newConnId: FfiConverterUInt64.readFromCursor(c) });
3379
3373
  case 24: return new P2pEvent.HolePunchFailed({connectId: FfiConverterUInt64.readFromCursor(c), attempt: FfiConverterUInt32.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3380
3374
  case 25: return new P2pEvent.ConnectFailed({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), kind: FfiConverterTypeNatErrorKind.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
3381
3375
  case 26: return new P2pEvent.ConnectCancelled({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c) });
3382
- case 27: return new P2pEvent.InboundDirectUpgrade({peerId: FfiConverterString.readFromCursor(c) });
3376
+ case 27: return new P2pEvent.InboundDirectUpgrade({peerId: FfiConverterString.readFromCursor(c), oldConnId: FfiConverterUInt64.readFromCursor(c), newConnId: FfiConverterUInt64.readFromCursor(c) });
3383
3377
  case 28: return new P2pEvent.Message({fromPeerId: FfiConverterString.readFromCursor(c), topics: FfiConverterSequenceString.readFromCursor(c), data: FfiConverterArrayBuffer.readFromCursor(c), seqno: FfiConverterArrayBuffer.readFromCursor(c), signed: FfiConverterBool.readFromCursor(c) });
3384
3378
  case 29: return new P2pEvent.PeerSubscribed({peerId: FfiConverterString.readFromCursor(c), topic: FfiConverterString.readFromCursor(c) });
3385
3379
  case 30: return new P2pEvent.PeerUnsubscribed({peerId: FfiConverterString.readFromCursor(c), topic: FfiConverterString.readFromCursor(c) });
@@ -3444,6 +3438,7 @@ const FfiConverterTypeP2pEvent = (() => {
3444
3438
  c.writeI32(7);
3445
3439
  const inner = value.inner;
3446
3440
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3441
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3447
3442
  FfiConverterTypeIdentifyInfo.writeIntoCursor(inner.info, c);
3448
3443
  return;
3449
3444
  }
@@ -3451,6 +3446,7 @@ const FfiConverterTypeP2pEvent = (() => {
3451
3446
  c.writeI32(8);
3452
3447
  const inner = value.inner;
3453
3448
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3449
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3454
3450
  FfiConverterUInt64.writeIntoCursor(inner.rttMs, c);
3455
3451
  return;
3456
3452
  }
@@ -3458,6 +3454,7 @@ const FfiConverterTypeP2pEvent = (() => {
3458
3454
  c.writeI32(9);
3459
3455
  const inner = value.inner;
3460
3456
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3457
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3461
3458
  return;
3462
3459
  }
3463
3460
  case P2pEvent_Tags.StreamReady: {
@@ -3563,6 +3560,7 @@ const FfiConverterTypeP2pEvent = (() => {
3563
3560
  const inner = value.inner;
3564
3561
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3565
3562
  FfiConverterTypePathKind.writeIntoCursor(inner.path, c);
3563
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3566
3564
  return;
3567
3565
  }
3568
3566
  case P2pEvent_Tags.PathUpgraded: {
@@ -3572,6 +3570,8 @@ const FfiConverterTypeP2pEvent = (() => {
3572
3570
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3573
3571
  FfiConverterTypePathKind.writeIntoCursor(inner.from, c);
3574
3572
  FfiConverterTypePathKind.writeIntoCursor(inner.to, c);
3573
+ FfiConverterUInt64.writeIntoCursor(inner.oldConnId, c);
3574
+ FfiConverterUInt64.writeIntoCursor(inner.newConnId, c);
3575
3575
  return;
3576
3576
  }
3577
3577
  case P2pEvent_Tags.HolePunchFailed: {
@@ -3602,6 +3602,8 @@ const FfiConverterTypeP2pEvent = (() => {
3602
3602
  c.writeI32(27);
3603
3603
  const inner = value.inner;
3604
3604
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3605
+ FfiConverterUInt64.writeIntoCursor(inner.oldConnId, c);
3606
+ FfiConverterUInt64.writeIntoCursor(inner.newConnId, c);
3605
3607
  return;
3606
3608
  }
3607
3609
  case P2pEvent_Tags.Message: {
@@ -3736,6 +3738,7 @@ const FfiConverterTypeP2pEvent = (() => {
3736
3738
  const inner = value.inner;
3737
3739
  let size = 4;
3738
3740
  size += FfiConverterString.allocationSize(inner.peerId);
3741
+ size += FfiConverterUInt64.allocationSize(inner.connId);
3739
3742
  size += FfiConverterTypeIdentifyInfo.allocationSize(inner.info);
3740
3743
  return size;
3741
3744
  }
@@ -3743,6 +3746,7 @@ const FfiConverterTypeP2pEvent = (() => {
3743
3746
  const inner = value.inner;
3744
3747
  let size = 4;
3745
3748
  size += FfiConverterString.allocationSize(inner.peerId);
3749
+ size += FfiConverterUInt64.allocationSize(inner.connId);
3746
3750
  size += FfiConverterUInt64.allocationSize(inner.rttMs);
3747
3751
  return size;
3748
3752
  }
@@ -3750,6 +3754,7 @@ const FfiConverterTypeP2pEvent = (() => {
3750
3754
  const inner = value.inner;
3751
3755
  let size = 4;
3752
3756
  size += FfiConverterString.allocationSize(inner.peerId);
3757
+ size += FfiConverterUInt64.allocationSize(inner.connId);
3753
3758
  return size;
3754
3759
  }
3755
3760
  case P2pEvent_Tags.StreamReady: {
@@ -3855,6 +3860,7 @@ const FfiConverterTypeP2pEvent = (() => {
3855
3860
  let size = 4;
3856
3861
  size += FfiConverterString.allocationSize(inner.peerId);
3857
3862
  size += FfiConverterTypePathKind.allocationSize(inner.path);
3863
+ size += FfiConverterUInt64.allocationSize(inner.connId);
3858
3864
  return size;
3859
3865
  }
3860
3866
  case P2pEvent_Tags.PathUpgraded: {
@@ -3864,6 +3870,8 @@ const FfiConverterTypeP2pEvent = (() => {
3864
3870
  size += FfiConverterString.allocationSize(inner.peerId);
3865
3871
  size += FfiConverterTypePathKind.allocationSize(inner.from);
3866
3872
  size += FfiConverterTypePathKind.allocationSize(inner.to);
3873
+ size += FfiConverterUInt64.allocationSize(inner.oldConnId);
3874
+ size += FfiConverterUInt64.allocationSize(inner.newConnId);
3867
3875
  return size;
3868
3876
  }
3869
3877
  case P2pEvent_Tags.HolePunchFailed: {
@@ -3894,6 +3902,8 @@ const FfiConverterTypeP2pEvent = (() => {
3894
3902
  const inner = value.inner;
3895
3903
  let size = 4;
3896
3904
  size += FfiConverterString.allocationSize(inner.peerId);
3905
+ size += FfiConverterUInt64.allocationSize(inner.oldConnId);
3906
+ size += FfiConverterUInt64.allocationSize(inner.newConnId);
3897
3907
  return size;
3898
3908
  }
3899
3909
  case P2pEvent_Tags.Message: {