@minip2p/react-native 0.5.4 → 0.7.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.
@@ -131,65 +131,51 @@ const stringConverter = (() => {
131
131
  const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
132
132
 
133
133
  /**
134
- * Signed-discovery configuration.
134
+ * State snapshot of the transport connection selected for a peer.
135
135
  */
136
- export type DiscoveryOptions = {
137
- /**
138
- * Pubsub topic carrying signed discovery beacons.
139
- */
140
- topic: string,
141
- /**
142
- * Milliseconds between local beacon announcements.
143
- */
144
- beaconIntervalMs: bigint,
136
+ export type ConnectionInfo = {
145
137
  /**
146
- * Milliseconds before a signed peer observation expires.
138
+ * Endpoint-local transport connection id.
147
139
  */
148
- peerTtlMs: bigint,
140
+ connId: bigint,
149
141
  /**
150
- * Whether accepted observations may trigger automatic dials.
142
+ * Remote transport address, when recorded.
151
143
  */
152
- autoDial: boolean
144
+ remoteAddr?: string
153
145
  }
154
146
 
155
147
  /**
156
- * Generated factory for {@link DiscoveryOptions} record objects.
148
+ * Generated factory for {@link ConnectionInfo} record objects.
157
149
  */
158
- export const DiscoveryOptions = (() => {
150
+ export const ConnectionInfo = (() => {
159
151
  const defaults = () => ({
160
152
  });
161
153
  const create = (() => {
162
- return uniffiCreateRecord<DiscoveryOptions, ReturnType<typeof defaults>>(defaults);
154
+ return uniffiCreateRecord<ConnectionInfo, ReturnType<typeof defaults>>(defaults);
163
155
  })();
164
156
  return Object.freeze({
165
157
  create,
166
158
  new: create,
167
- defaults: () => Object.freeze(defaults()) as Partial<DiscoveryOptions>,
159
+ defaults: () => Object.freeze(defaults()) as Partial<ConnectionInfo>,
168
160
  });
169
161
  })();
170
162
 
171
- const FfiConverterTypeDiscoveryOptions = (() => {
172
- type TypeName = DiscoveryOptions;
163
+ const FfiConverterTypeConnectionInfo = (() => {
164
+ type TypeName = ConnectionInfo;
173
165
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
174
166
  readFromCursor(c: Cursor): TypeName {
175
167
  return {
176
- topic: FfiConverterString.readFromCursor(c),
177
- beaconIntervalMs: FfiConverterUInt64.readFromCursor(c),
178
- peerTtlMs: FfiConverterUInt64.readFromCursor(c),
179
- autoDial: FfiConverterBool.readFromCursor(c)
168
+ connId: FfiConverterUInt64.readFromCursor(c),
169
+ remoteAddr: FfiConverterOptionalString.readFromCursor(c)
180
170
  };
181
171
  }
182
172
  writeIntoCursor(value: TypeName, c: Cursor): void {
183
- FfiConverterString.writeIntoCursor(value.topic, c);
184
- FfiConverterUInt64.writeIntoCursor(value.beaconIntervalMs, c);
185
- FfiConverterUInt64.writeIntoCursor(value.peerTtlMs, c);
186
- FfiConverterBool.writeIntoCursor(value.autoDial, c);
173
+ FfiConverterUInt64.writeIntoCursor(value.connId, c);
174
+ FfiConverterOptionalString.writeIntoCursor(value.remoteAddr, c);
187
175
  }
188
176
  allocationSize(value: TypeName): number {
189
- return FfiConverterString.allocationSize(value.topic) +
190
- FfiConverterUInt64.allocationSize(value.beaconIntervalMs) +
191
- FfiConverterUInt64.allocationSize(value.peerTtlMs) +
192
- FfiConverterBool.allocationSize(value.autoDial);
177
+ return FfiConverterUInt64.allocationSize(value.connId) +
178
+ FfiConverterOptionalString.allocationSize(value.remoteAddr);
193
179
 
194
180
  }
195
181
  };
@@ -197,90 +183,71 @@ const FfiConverterTypeDiscoveryOptions = (() => {
197
183
  })();
198
184
 
199
185
  /**
200
- * One enabled transport and the addresses it should listen on.
186
+ * Signed-discovery configuration.
201
187
  */
202
- export type TransportOptions = {
188
+ export type DiscoveryOptions = {
203
189
  /**
204
- * Exact listen multiaddresses, or transport defaults when absent.
205
- *
206
- * An explicitly empty list is rejected: omit this field for defaults or
207
- * disable the transport by omitting it from [`EndpointConfig`].
190
+ * Pubsub topic carrying signed discovery beacons.
208
191
  */
209
- listenAddrs?: Array<string>
192
+ topic: string,
193
+ /**
194
+ * Milliseconds between local beacon announcements.
195
+ */
196
+ beaconIntervalMs: bigint,
197
+ /**
198
+ * Milliseconds before a signed peer observation expires.
199
+ */
200
+ peerTtlMs: bigint,
201
+ /**
202
+ * Whether accepted observations may trigger automatic dials.
203
+ */
204
+ autoDial: boolean
210
205
  }
211
206
 
212
207
  /**
213
- * Generated factory for {@link TransportOptions} record objects.
208
+ * Generated factory for {@link DiscoveryOptions} record objects.
214
209
  */
215
- export const TransportOptions = (() => {
210
+ export const DiscoveryOptions = (() => {
216
211
  const defaults = () => ({
217
212
  });
218
213
  const create = (() => {
219
- return uniffiCreateRecord<TransportOptions, ReturnType<typeof defaults>>(defaults);
214
+ return uniffiCreateRecord<DiscoveryOptions, ReturnType<typeof defaults>>(defaults);
220
215
  })();
221
216
  return Object.freeze({
222
217
  create,
223
218
  new: create,
224
- defaults: () => Object.freeze(defaults()) as Partial<TransportOptions>,
219
+ defaults: () => Object.freeze(defaults()) as Partial<DiscoveryOptions>,
225
220
  });
226
221
  })();
227
222
 
228
- const FfiConverterTypeTransportOptions = (() => {
229
- type TypeName = TransportOptions;
223
+ const FfiConverterTypeDiscoveryOptions = (() => {
224
+ type TypeName = DiscoveryOptions;
230
225
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
231
226
  readFromCursor(c: Cursor): TypeName {
232
227
  return {
233
- listenAddrs: FfiConverterOptionalSequenceString.readFromCursor(c)
228
+ topic: FfiConverterString.readFromCursor(c),
229
+ beaconIntervalMs: FfiConverterUInt64.readFromCursor(c),
230
+ peerTtlMs: FfiConverterUInt64.readFromCursor(c),
231
+ autoDial: FfiConverterBool.readFromCursor(c)
234
232
  };
235
233
  }
236
234
  writeIntoCursor(value: TypeName, c: Cursor): void {
237
- FfiConverterOptionalSequenceString.writeIntoCursor(value.listenAddrs, c);
235
+ FfiConverterString.writeIntoCursor(value.topic, c);
236
+ FfiConverterUInt64.writeIntoCursor(value.beaconIntervalMs, c);
237
+ FfiConverterUInt64.writeIntoCursor(value.peerTtlMs, c);
238
+ FfiConverterBool.writeIntoCursor(value.autoDial, c);
238
239
  }
239
240
  allocationSize(value: TypeName): number {
240
- return FfiConverterOptionalSequenceString.allocationSize(value.listenAddrs);
241
+ return FfiConverterString.allocationSize(value.topic) +
242
+ FfiConverterUInt64.allocationSize(value.beaconIntervalMs) +
243
+ FfiConverterUInt64.allocationSize(value.peerTtlMs) +
244
+ FfiConverterBool.allocationSize(value.autoDial);
241
245
 
242
246
  }
243
247
  };
244
248
  return new FFIConverter();
245
249
  })();
246
250
 
247
- /**
248
- * Pubsub routing engine selected at endpoint construction.
249
- */
250
- export enum PubsubRouter {
251
- /**
252
- * Mesh-based gossipsub routing.
253
- */
254
- Gossipsub,
255
- /**
256
- * Flood-to-all-subscribers floodsub routing.
257
- */
258
- Floodsub
259
- }
260
-
261
- const FfiConverterTypePubsubRouter = (() => {
262
- type TypeName = PubsubRouter;
263
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
264
- readFromCursor(c: Cursor): TypeName {
265
- switch (c.readI32()) {
266
- case 1: return PubsubRouter.Gossipsub;
267
- case 2: return PubsubRouter.Floodsub;
268
- default: throw new UniffiInternalError.UnexpectedEnumCase();
269
- }
270
- }
271
- writeIntoCursor(value: TypeName, c: Cursor): void {
272
- switch (value) {
273
- case PubsubRouter.Gossipsub: return c.writeI32(1);
274
- case PubsubRouter.Floodsub: return c.writeI32(2);
275
- }
276
- }
277
- allocationSize(value: TypeName): number {
278
- return 4;
279
- }
280
- }
281
- return new FFIConverter();
282
- })();
283
-
284
251
  /**
285
252
  * Local-link mDNS discovery configuration.
286
253
  */
@@ -392,13 +359,10 @@ export type EndpointConfig = {
392
359
  */
393
360
  autonatServers: Array<string>,
394
361
  /**
395
- * QUIC configuration, or no QUIC transport when absent.
362
+ * Listen multiaddresses; each address's shape selects its transport.
363
+ * Absent binds the QUIC dual-stack defaults; an empty list is rejected.
396
364
  */
397
- quic?: TransportOptions,
398
- /**
399
- * TCP configuration, or no TCP transport when absent.
400
- */
401
- tcp?: TransportOptions,
365
+ listen?: Array<string>,
402
366
  /**
403
367
  * Whether connection attempts must remain relayed.
404
368
  */
@@ -407,10 +371,6 @@ export type EndpointConfig = {
407
371
  * Whether unsigned pubsub messages are accepted.
408
372
  */
409
373
  allowUnsigned: boolean,
410
- /**
411
- * Pubsub routing engine.
412
- */
413
- pubsubRouter: PubsubRouter,
414
374
  /**
415
375
  * Application protocol ids registered before the endpoint starts.
416
376
  */
@@ -449,11 +409,9 @@ const FfiConverterTypeEndpointConfig = (() => {
449
409
  agentVersion: FfiConverterOptionalString.readFromCursor(c),
450
410
  relays: FfiConverterSequenceString.readFromCursor(c),
451
411
  autonatServers: FfiConverterSequenceString.readFromCursor(c),
452
- quic: FfiConverterOptionalTypeTransportOptions.readFromCursor(c),
453
- tcp: FfiConverterOptionalTypeTransportOptions.readFromCursor(c),
412
+ listen: FfiConverterOptionalSequenceString.readFromCursor(c),
454
413
  forceRelay: FfiConverterBool.readFromCursor(c),
455
414
  allowUnsigned: FfiConverterBool.readFromCursor(c),
456
- pubsubRouter: FfiConverterTypePubsubRouter.readFromCursor(c),
457
415
  protocols: FfiConverterSequenceString.readFromCursor(c),
458
416
  discovery: FfiConverterOptionalTypeDiscoveryOptions.readFromCursor(c),
459
417
  mdns: FfiConverterOptionalTypeMdnsOptions.readFromCursor(c)
@@ -463,11 +421,9 @@ const FfiConverterTypeEndpointConfig = (() => {
463
421
  FfiConverterOptionalString.writeIntoCursor(value.agentVersion, c);
464
422
  FfiConverterSequenceString.writeIntoCursor(value.relays, c);
465
423
  FfiConverterSequenceString.writeIntoCursor(value.autonatServers, c);
466
- FfiConverterOptionalTypeTransportOptions.writeIntoCursor(value.quic, c);
467
- FfiConverterOptionalTypeTransportOptions.writeIntoCursor(value.tcp, c);
424
+ FfiConverterOptionalSequenceString.writeIntoCursor(value.listen, c);
468
425
  FfiConverterBool.writeIntoCursor(value.forceRelay, c);
469
426
  FfiConverterBool.writeIntoCursor(value.allowUnsigned, c);
470
- FfiConverterTypePubsubRouter.writeIntoCursor(value.pubsubRouter, c);
471
427
  FfiConverterSequenceString.writeIntoCursor(value.protocols, c);
472
428
  FfiConverterOptionalTypeDiscoveryOptions.writeIntoCursor(value.discovery, c);
473
429
  FfiConverterOptionalTypeMdnsOptions.writeIntoCursor(value.mdns, c);
@@ -476,11 +432,9 @@ const FfiConverterTypeEndpointConfig = (() => {
476
432
  return FfiConverterOptionalString.allocationSize(value.agentVersion) +
477
433
  FfiConverterSequenceString.allocationSize(value.relays) +
478
434
  FfiConverterSequenceString.allocationSize(value.autonatServers) +
479
- FfiConverterOptionalTypeTransportOptions.allocationSize(value.quic) +
480
- FfiConverterOptionalTypeTransportOptions.allocationSize(value.tcp) +
435
+ FfiConverterOptionalSequenceString.allocationSize(value.listen) +
481
436
  FfiConverterBool.allocationSize(value.forceRelay) +
482
437
  FfiConverterBool.allocationSize(value.allowUnsigned) +
483
- FfiConverterTypePubsubRouter.allocationSize(value.pubsubRouter) +
484
438
  FfiConverterSequenceString.allocationSize(value.protocols) +
485
439
  FfiConverterOptionalTypeDiscoveryOptions.allocationSize(value.discovery) +
486
440
  FfiConverterOptionalTypeMdnsOptions.allocationSize(value.mdns);
@@ -761,6 +715,160 @@ const FfiConverterTypeRelayReservationInfo = (() => {
761
715
  return new FFIConverter();
762
716
  })();
763
717
 
718
+
719
+ // Enum: ConnectTarget
720
+ export enum ConnectTarget_Tags {
721
+ Peer = "Peer",
722
+ Addresses = "Addresses"
723
+ }
724
+ /**
725
+ * What a foreign runtime supplies to start one Connection attempt.
726
+ *
727
+ * Validation lives in `minip2p-ffi-core`; this mirror only declares the shape.
728
+ */
729
+ export const ConnectTarget = (() => {
730
+
731
+ type Peer__interface = {
732
+ tag: ConnectTarget_Tags.Peer;
733
+ inner:
734
+ Readonly<{peerId: string}>
735
+ };
736
+ /**
737
+ * Peer ID only: the endpoint applies its discovery-book and relay
738
+ * policy.
739
+ */
740
+ class Peer_ extends UniffiEnum implements Peer__interface {
741
+ /**
742
+ * @private
743
+ * This field is private and should not be used, use `tag` instead.
744
+ */
745
+ readonly [uniffiTypeNameSymbol] = "ConnectTarget";
746
+ readonly tag = ConnectTarget_Tags.Peer;
747
+ readonly inner:
748
+ Readonly<{peerId: string}>;
749
+ constructor(
750
+ inner: {peerId: string }) {
751
+ super("ConnectTarget", "Peer");
752
+
753
+ this.inner = Object.freeze(inner);
754
+ }
755
+ static new(
756
+ inner: {peerId: string }): Peer_ {
757
+ return new Peer_(inner);
758
+ }
759
+
760
+ static instanceOf(obj: any): obj is Peer_ {
761
+ return obj.tag === ConnectTarget_Tags.Peer;
762
+ }
763
+
764
+ }
765
+
766
+ type Addresses__interface = {
767
+ tag: ConnectTarget_Tags.Addresses;
768
+ inner:
769
+ Readonly<{addresses: Array<string>}>
770
+ };
771
+ /**
772
+ * One or more complete direct peer addresses that all name the same
773
+ * peer. One address is the single-address form.
774
+ */
775
+ class Addresses_ extends UniffiEnum implements Addresses__interface {
776
+ /**
777
+ * @private
778
+ * This field is private and should not be used, use `tag` instead.
779
+ */
780
+ readonly [uniffiTypeNameSymbol] = "ConnectTarget";
781
+ readonly tag = ConnectTarget_Tags.Addresses;
782
+ readonly inner:
783
+ Readonly<{addresses: Array<string>}>;
784
+ constructor(
785
+ inner: {addresses: Array<string> }) {
786
+ super("ConnectTarget", "Addresses");
787
+
788
+ this.inner = Object.freeze(inner);
789
+ }
790
+ static new(
791
+ inner: {addresses: Array<string> }): Addresses_ {
792
+ return new Addresses_(inner);
793
+ }
794
+
795
+ static instanceOf(obj: any): obj is Addresses_ {
796
+ return obj.tag === ConnectTarget_Tags.Addresses;
797
+ }
798
+
799
+ }
800
+
801
+ function instanceOf(obj: any): obj is ConnectTarget {
802
+ return obj[uniffiTypeNameSymbol] === "ConnectTarget";
803
+ }
804
+
805
+ return Object.freeze({
806
+ instanceOf,
807
+ Peer: Peer_,
808
+ Addresses: Addresses_
809
+ });
810
+
811
+ })();
812
+ /**
813
+ * What a foreign runtime supplies to start one Connection attempt.
814
+ *
815
+ * Validation lives in `minip2p-ffi-core`; this mirror only declares the shape.
816
+ */
817
+ export type ConnectTarget = InstanceType<
818
+ typeof ConnectTarget['Peer' | 'Addresses']
819
+ >;
820
+
821
+ // FfiConverter for enum ConnectTarget
822
+ const FfiConverterTypeConnectTarget = (() => {
823
+ type TypeName = ConnectTarget;
824
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
825
+ readFromCursor(c: Cursor): TypeName {
826
+ switch (c.readI32()) {
827
+ case 1: return new ConnectTarget.Peer({peerId: FfiConverterString.readFromCursor(c) });
828
+ case 2: return new ConnectTarget.Addresses({addresses: FfiConverterSequenceString.readFromCursor(c) });
829
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
830
+ }
831
+ }
832
+ writeIntoCursor(value: TypeName, c: Cursor): void {
833
+ switch (value.tag) {
834
+ case ConnectTarget_Tags.Peer: {
835
+ c.writeI32(1);
836
+ const inner = value.inner;
837
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
838
+ return;
839
+ }
840
+ case ConnectTarget_Tags.Addresses: {
841
+ c.writeI32(2);
842
+ const inner = value.inner;
843
+ FfiConverterSequenceString.writeIntoCursor(inner.addresses, c);
844
+ return;
845
+ }
846
+ default:
847
+ // Throwing from here means that ConnectTarget_Tags hasn't matched an ordinal.
848
+ throw new UniffiInternalError.UnexpectedEnumCase();
849
+ }
850
+ }
851
+ allocationSize(value: TypeName): number {
852
+ switch (value.tag) {
853
+ case ConnectTarget_Tags.Peer: {
854
+ const inner = value.inner;
855
+ let size = 4;
856
+ size += FfiConverterString.allocationSize(inner.peerId);
857
+ return size;
858
+ }
859
+ case ConnectTarget_Tags.Addresses: {
860
+ const inner = value.inner;
861
+ let size = 4;
862
+ size += FfiConverterSequenceString.allocationSize(inner.addresses);
863
+ return size;
864
+ }
865
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
866
+ }
867
+ }
868
+ }
869
+ return new FFIConverter();
870
+ })();
871
+
764
872
  /**
765
873
  * Source that contributed a discovery observation.
766
874
  */
@@ -1938,14 +2046,14 @@ export enum P2pEvent_Tags {
1938
2046
  InboundPathEstablished = "InboundPathEstablished",
1939
2047
  PathUpgraded = "PathUpgraded",
1940
2048
  HolePunchFailed = "HolePunchFailed",
1941
- FellBackToRelay = "FellBackToRelay",
1942
2049
  ConnectFailed = "ConnectFailed",
2050
+ ConnectCancelled = "ConnectCancelled",
1943
2051
  InboundDirectUpgrade = "InboundDirectUpgrade",
1944
2052
  Message = "Message",
1945
2053
  PeerSubscribed = "PeerSubscribed",
1946
2054
  PeerUnsubscribed = "PeerUnsubscribed",
1947
- PubsubOutboundFailure = "PubsubOutboundFailure",
1948
- PubsubProtocolViolation = "PubsubProtocolViolation",
2055
+ GossipsubOutboundFailure = "GossipsubOutboundFailure",
2056
+ GossipsubProtocolViolation = "GossipsubProtocolViolation",
1949
2057
  PeerDiscovered = "PeerDiscovered",
1950
2058
  PeerUpdated = "PeerUpdated",
1951
2059
  PeerExpired = "PeerExpired",
@@ -1960,7 +2068,7 @@ export const P2pEvent = (() => {
1960
2068
  type EventsDropped__interface = {
1961
2069
  tag: P2pEvent_Tags.EventsDropped;
1962
2070
  inner:
1963
- Readonly<{dropped: bigint; totalDropped: bigint}>
2071
+ Readonly<{dropped: bigint; totalDropped: bigint; terminalConnectIds: Array<bigint>}>
1964
2072
  };
1965
2073
  /**
1966
2074
  * Native event carry overflow discarded source events.
@@ -1973,15 +2081,15 @@ Readonly<{dropped: bigint; totalDropped: bigint}>
1973
2081
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
1974
2082
  readonly tag = P2pEvent_Tags.EventsDropped;
1975
2083
  readonly inner:
1976
- Readonly<{dropped: bigint; totalDropped: bigint}>;
2084
+ Readonly<{dropped: bigint; totalDropped: bigint; terminalConnectIds: Array<bigint>}>;
1977
2085
  constructor(
1978
- inner: {dropped: bigint; totalDropped: bigint }) {
2086
+ inner: {dropped: bigint; totalDropped: bigint; terminalConnectIds: Array<bigint> }) {
1979
2087
  super("P2pEvent", "EventsDropped");
1980
2088
 
1981
2089
  this.inner = Object.freeze(inner);
1982
2090
  }
1983
2091
  static new(
1984
- inner: {dropped: bigint; totalDropped: bigint }): EventsDropped_ {
2092
+ inner: {dropped: bigint; totalDropped: bigint; terminalConnectIds: Array<bigint> }): EventsDropped_ {
1985
2093
  return new EventsDropped_(inner);
1986
2094
  }
1987
2095
 
@@ -2538,7 +2646,7 @@ inner: {relayPeerId: string }): RelayReservationLost_ {
2538
2646
  type PathEstablished__interface = {
2539
2647
  tag: P2pEvent_Tags.PathEstablished;
2540
2648
  inner:
2541
- Readonly<{connectId: bigint; peerId: string; path: PathKind}>
2649
+ Readonly<{connectId: bigint; peerId: string; connId: bigint; path: PathKind}>
2542
2650
  };
2543
2651
  /**
2544
2652
  * The first usable path for an attempt became available.
@@ -2551,15 +2659,15 @@ Readonly<{connectId: bigint; peerId: string; path: PathKind}>
2551
2659
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2552
2660
  readonly tag = P2pEvent_Tags.PathEstablished;
2553
2661
  readonly inner:
2554
- Readonly<{connectId: bigint; peerId: string; path: PathKind}>;
2662
+ Readonly<{connectId: bigint; peerId: string; connId: bigint; path: PathKind}>;
2555
2663
  constructor(
2556
- inner: {connectId: bigint; peerId: string; path: PathKind }) {
2664
+ inner: {connectId: bigint; peerId: string; connId: bigint; path: PathKind }) {
2557
2665
  super("P2pEvent", "PathEstablished");
2558
2666
 
2559
2667
  this.inner = Object.freeze(inner);
2560
2668
  }
2561
2669
  static new(
2562
- inner: {connectId: bigint; peerId: string; path: PathKind }): PathEstablished_ {
2670
+ inner: {connectId: bigint; peerId: string; connId: bigint; path: PathKind }): PathEstablished_ {
2563
2671
  return new PathEstablished_(inner);
2564
2672
  }
2565
2673
 
@@ -2671,70 +2779,71 @@ inner: {connectId: bigint; attempt: number; reason: string }): HolePunchFailed_
2671
2779
 
2672
2780
  }
2673
2781
 
2674
- type FellBackToRelay__interface = {
2675
- tag: P2pEvent_Tags.FellBackToRelay;
2782
+ type ConnectFailed__interface = {
2783
+ tag: P2pEvent_Tags.ConnectFailed;
2676
2784
  inner:
2677
- Readonly<{connectId: bigint; peerId: string}>
2785
+ Readonly<{connectId: bigint; peerId: string; kind: NatErrorKind; detail: string}>
2678
2786
  };
2679
2787
  /**
2680
- * Direct upgrade attempts ended with the relay path retained.
2788
+ * A connection attempt ended without a usable path.
2681
2789
  */
2682
- class FellBackToRelay_ extends UniffiEnum implements FellBackToRelay__interface {
2790
+ class ConnectFailed_ extends UniffiEnum implements ConnectFailed__interface {
2683
2791
  /**
2684
2792
  * @private
2685
2793
  * This field is private and should not be used, use `tag` instead.
2686
2794
  */
2687
2795
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2688
- readonly tag = P2pEvent_Tags.FellBackToRelay;
2796
+ readonly tag = P2pEvent_Tags.ConnectFailed;
2689
2797
  readonly inner:
2690
- Readonly<{connectId: bigint; peerId: string}>;
2798
+ Readonly<{connectId: bigint; peerId: string; kind: NatErrorKind; detail: string}>;
2691
2799
  constructor(
2692
- inner: {connectId: bigint; peerId: string }) {
2693
- super("P2pEvent", "FellBackToRelay");
2800
+ inner: {connectId: bigint; peerId: string; kind: NatErrorKind; detail: string }) {
2801
+ super("P2pEvent", "ConnectFailed");
2694
2802
 
2695
2803
  this.inner = Object.freeze(inner);
2696
2804
  }
2697
2805
  static new(
2698
- inner: {connectId: bigint; peerId: string }): FellBackToRelay_ {
2699
- return new FellBackToRelay_(inner);
2806
+ inner: {connectId: bigint; peerId: string; kind: NatErrorKind; detail: string }): ConnectFailed_ {
2807
+ return new ConnectFailed_(inner);
2700
2808
  }
2701
2809
 
2702
- static instanceOf(obj: any): obj is FellBackToRelay_ {
2703
- return obj.tag === P2pEvent_Tags.FellBackToRelay;
2810
+ static instanceOf(obj: any): obj is ConnectFailed_ {
2811
+ return obj.tag === P2pEvent_Tags.ConnectFailed;
2704
2812
  }
2705
2813
 
2706
2814
  }
2707
2815
 
2708
- type ConnectFailed__interface = {
2709
- tag: P2pEvent_Tags.ConnectFailed;
2816
+ type ConnectCancelled__interface = {
2817
+ tag: P2pEvent_Tags.ConnectCancelled;
2710
2818
  inner:
2711
- Readonly<{connectId: bigint; peerId: string; kind: NatErrorKind; detail: string}>
2819
+ Readonly<{connectId: bigint; peerId: string}>
2712
2820
  };
2713
2821
  /**
2714
- * A connection attempt ended without a usable path.
2822
+ * A Connection attempt was cancelled by `cancel_connect` before it
2823
+ * settled. Terminal for that Connect ID.
2715
2824
  */
2716
- class ConnectFailed_ extends UniffiEnum implements ConnectFailed__interface {
2825
+ class ConnectCancelled_ extends UniffiEnum implements ConnectCancelled__interface {
2717
2826
  /**
2718
2827
  * @private
2719
2828
  * This field is private and should not be used, use `tag` instead.
2720
2829
  */
2721
2830
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2722
- readonly tag = P2pEvent_Tags.ConnectFailed;
2831
+ readonly tag = P2pEvent_Tags.ConnectCancelled;
2723
2832
  readonly inner:
2724
- Readonly<{connectId: bigint; peerId: string; kind: NatErrorKind; detail: string}>;
2833
+ Readonly<{connectId: bigint; peerId: string}>;
2725
2834
  constructor(
2726
- inner: {connectId: bigint; peerId: string; kind: NatErrorKind; detail: string }) {
2727
- super("P2pEvent", "ConnectFailed");
2835
+ inner: {connectId: bigint; peerId: string }) {
2836
+ super("P2pEvent", "ConnectCancelled");
2728
2837
 
2729
2838
  this.inner = Object.freeze(inner);
2730
2839
  }
2731
2840
  static new(
2732
- inner: {connectId: bigint; peerId: string; kind: NatErrorKind; detail: string }): ConnectFailed_ {
2733
- return new ConnectFailed_(inner);
2841
+ inner: {connectId: bigint; peerId: string }): ConnectCancelled_ {
2842
+ return new ConnectCancelled_(inner);
2734
2843
  }
2735
2844
 
2736
- static instanceOf(obj: any): obj is ConnectFailed_ {
2737
- return obj.tag === P2pEvent_Tags.ConnectFailed;
2845
+ static instanceOf(obj: any): obj is ConnectCancelled_ {
2846
+ return obj.tag === P2pEvent_Tags.ConnectCancelled;
2738
2847
  }
2739
2848
 
2740
2849
  }
@@ -2879,70 +2988,70 @@ inner: {peerId: string; topic: string }): PeerUnsubscribed_ {
2879
2988
 
2880
2989
  }
2881
2990
 
2882
- type PubsubOutboundFailure__interface = {
2883
- tag: P2pEvent_Tags.PubsubOutboundFailure;
2991
+ type GossipsubOutboundFailure__interface = {
2992
+ tag: P2pEvent_Tags.GossipsubOutboundFailure;
2884
2993
  inner:
2885
2994
  Readonly<{peerId: string; reason: string}>
2886
2995
  };
2887
2996
  /**
2888
- * Pubsub outbound work was discarded.
2997
+ * Gossipsub outbound work was discarded.
2889
2998
  */
2890
- class PubsubOutboundFailure_ extends UniffiEnum implements PubsubOutboundFailure__interface {
2999
+ class GossipsubOutboundFailure_ extends UniffiEnum implements GossipsubOutboundFailure__interface {
2891
3000
  /**
2892
3001
  * @private
2893
3002
  * This field is private and should not be used, use `tag` instead.
2894
3003
  */
2895
3004
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2896
- readonly tag = P2pEvent_Tags.PubsubOutboundFailure;
3005
+ readonly tag = P2pEvent_Tags.GossipsubOutboundFailure;
2897
3006
  readonly inner:
2898
3007
  Readonly<{peerId: string; reason: string}>;
2899
3008
  constructor(
2900
3009
  inner: {peerId: string; reason: string }) {
2901
- super("P2pEvent", "PubsubOutboundFailure");
3010
+ super("P2pEvent", "GossipsubOutboundFailure");
2902
3011
 
2903
3012
  this.inner = Object.freeze(inner);
2904
3013
  }
2905
3014
  static new(
2906
- inner: {peerId: string; reason: string }): PubsubOutboundFailure_ {
2907
- return new PubsubOutboundFailure_(inner);
3015
+ inner: {peerId: string; reason: string }): GossipsubOutboundFailure_ {
3016
+ return new GossipsubOutboundFailure_(inner);
2908
3017
  }
2909
3018
 
2910
- static instanceOf(obj: any): obj is PubsubOutboundFailure_ {
2911
- return obj.tag === P2pEvent_Tags.PubsubOutboundFailure;
3019
+ static instanceOf(obj: any): obj is GossipsubOutboundFailure_ {
3020
+ return obj.tag === P2pEvent_Tags.GossipsubOutboundFailure;
2912
3021
  }
2913
3022
 
2914
3023
  }
2915
3024
 
2916
- type PubsubProtocolViolation__interface = {
2917
- tag: P2pEvent_Tags.PubsubProtocolViolation;
3025
+ type GossipsubProtocolViolation__interface = {
3026
+ tag: P2pEvent_Tags.GossipsubProtocolViolation;
2918
3027
  inner:
2919
3028
  Readonly<{peerId: string; reason: string}>
2920
3029
  };
2921
3030
  /**
2922
- * A peer violated the pubsub protocol.
3031
+ * A peer violated the gossipsub protocol.
2923
3032
  */
2924
- class PubsubProtocolViolation_ extends UniffiEnum implements PubsubProtocolViolation__interface {
3033
+ class GossipsubProtocolViolation_ extends UniffiEnum implements GossipsubProtocolViolation__interface {
2925
3034
  /**
2926
3035
  * @private
2927
3036
  * This field is private and should not be used, use `tag` instead.
2928
3037
  */
2929
3038
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2930
- readonly tag = P2pEvent_Tags.PubsubProtocolViolation;
3039
+ readonly tag = P2pEvent_Tags.GossipsubProtocolViolation;
2931
3040
  readonly inner:
2932
3041
  Readonly<{peerId: string; reason: string}>;
2933
3042
  constructor(
2934
3043
  inner: {peerId: string; reason: string }) {
2935
- super("P2pEvent", "PubsubProtocolViolation");
3044
+ super("P2pEvent", "GossipsubProtocolViolation");
2936
3045
 
2937
3046
  this.inner = Object.freeze(inner);
2938
3047
  }
2939
3048
  static new(
2940
- inner: {peerId: string; reason: string }): PubsubProtocolViolation_ {
2941
- return new PubsubProtocolViolation_(inner);
3049
+ inner: {peerId: string; reason: string }): GossipsubProtocolViolation_ {
3050
+ return new GossipsubProtocolViolation_(inner);
2942
3051
  }
2943
3052
 
2944
- static instanceOf(obj: any): obj is PubsubProtocolViolation_ {
2945
- return obj.tag === P2pEvent_Tags.PubsubProtocolViolation;
3053
+ static instanceOf(obj: any): obj is GossipsubProtocolViolation_ {
3054
+ return obj.tag === P2pEvent_Tags.GossipsubProtocolViolation;
2946
3055
  }
2947
3056
 
2948
3057
  }
@@ -3144,14 +3253,14 @@ inner: {peerId?: string; source: DiscoverySource; reason: string; suppressed: nu
3144
3253
  InboundPathEstablished: InboundPathEstablished_,
3145
3254
  PathUpgraded: PathUpgraded_,
3146
3255
  HolePunchFailed: HolePunchFailed_,
3147
- FellBackToRelay: FellBackToRelay_,
3148
3256
  ConnectFailed: ConnectFailed_,
3257
+ ConnectCancelled: ConnectCancelled_,
3149
3258
  InboundDirectUpgrade: InboundDirectUpgrade_,
3150
3259
  Message: Message_,
3151
3260
  PeerSubscribed: PeerSubscribed_,
3152
3261
  PeerUnsubscribed: PeerUnsubscribed_,
3153
- PubsubOutboundFailure: PubsubOutboundFailure_,
3154
- PubsubProtocolViolation: PubsubProtocolViolation_,
3262
+ GossipsubOutboundFailure: GossipsubOutboundFailure_,
3263
+ GossipsubProtocolViolation: GossipsubProtocolViolation_,
3155
3264
  PeerDiscovered: PeerDiscovered_,
3156
3265
  PeerUpdated: PeerUpdated_,
3157
3266
  PeerExpired: PeerExpired_,
@@ -3164,7 +3273,7 @@ inner: {peerId?: string; source: DiscoverySource; reason: string; suppressed: nu
3164
3273
  * Event delivered by the native endpoint driver.
3165
3274
  */
3166
3275
  export type P2pEvent = InstanceType<
3167
- typeof P2pEvent['EventsDropped' | 'DriverFailed' | 'ConnectionEstablished' | 'ConnectionClosed' | 'PeerReady' | 'IdentifyReceived' | 'PingRttMeasured' | 'PingTimeout' | 'StreamReady' | 'StreamData' | 'StreamRemoteWriteClosed' | 'StreamClosed' | 'EndpointError' | 'ReachabilityChanged' | 'PublicAddressesChanged' | 'RelayReserved' | 'RelayReservationLost' | 'PathEstablished' | 'InboundPathEstablished' | 'PathUpgraded' | 'HolePunchFailed' | 'FellBackToRelay' | 'ConnectFailed' | 'InboundDirectUpgrade' | 'Message' | 'PeerSubscribed' | 'PeerUnsubscribed' | 'PubsubOutboundFailure' | 'PubsubProtocolViolation' | 'PeerDiscovered' | 'PeerUpdated' | 'PeerExpired' | 'DiscoveryDialFailed' | 'DiscoveryProtocolViolation']
3276
+ typeof P2pEvent['EventsDropped' | 'DriverFailed' | 'ConnectionEstablished' | 'ConnectionClosed' | 'PeerReady' | 'IdentifyReceived' | 'PingRttMeasured' | 'PingTimeout' | 'StreamReady' | 'StreamData' | 'StreamRemoteWriteClosed' | 'StreamClosed' | 'EndpointError' | 'ReachabilityChanged' | 'PublicAddressesChanged' | 'RelayReserved' | 'RelayReservationLost' | 'PathEstablished' | 'InboundPathEstablished' | 'PathUpgraded' | 'HolePunchFailed' | 'ConnectFailed' | 'ConnectCancelled' | 'InboundDirectUpgrade' | 'Message' | 'PeerSubscribed' | 'PeerUnsubscribed' | 'GossipsubOutboundFailure' | 'GossipsubProtocolViolation' | 'PeerDiscovered' | 'PeerUpdated' | 'PeerExpired' | 'DiscoveryDialFailed' | 'DiscoveryProtocolViolation']
3168
3277
  >;
3169
3278
 
3170
3279
  // FfiConverter for enum P2pEvent
@@ -3173,7 +3282,7 @@ const FfiConverterTypeP2pEvent = (() => {
3173
3282
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
3174
3283
  readFromCursor(c: Cursor): TypeName {
3175
3284
  switch (c.readI32()) {
3176
- case 1: return new P2pEvent.EventsDropped({dropped: FfiConverterUInt64.readFromCursor(c), totalDropped: FfiConverterUInt64.readFromCursor(c) });
3285
+ case 1: return new P2pEvent.EventsDropped({dropped: FfiConverterUInt64.readFromCursor(c), totalDropped: FfiConverterUInt64.readFromCursor(c), terminalConnectIds: FfiConverterSequenceUInt64.readFromCursor(c) });
3177
3286
  case 2: return new P2pEvent.DriverFailed({kind: FfiConverterTypeDriverFailureKind.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
3178
3287
  case 3: return new P2pEvent.ConnectionEstablished({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3179
3288
  case 4: return new P2pEvent.ConnectionClosed({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
@@ -3190,18 +3299,18 @@ const FfiConverterTypeP2pEvent = (() => {
3190
3299
  case 15: return new P2pEvent.PublicAddressesChanged({addrs: FfiConverterSequenceString.readFromCursor(c) });
3191
3300
  case 16: return new P2pEvent.RelayReserved({relayPeerId: FfiConverterString.readFromCursor(c), expiresUnixSecs: FfiConverterOptionalUInt64.readFromCursor(c) });
3192
3301
  case 17: return new P2pEvent.RelayReservationLost({relayPeerId: FfiConverterString.readFromCursor(c) });
3193
- case 18: return new P2pEvent.PathEstablished({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c) });
3302
+ case 18: return new P2pEvent.PathEstablished({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c) });
3194
3303
  case 19: return new P2pEvent.InboundPathEstablished({peerId: FfiConverterString.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c) });
3195
3304
  case 20: return new P2pEvent.PathUpgraded({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), from: FfiConverterTypePathKind.readFromCursor(c), to: FfiConverterTypePathKind.readFromCursor(c) });
3196
3305
  case 21: return new P2pEvent.HolePunchFailed({connectId: FfiConverterUInt64.readFromCursor(c), attempt: FfiConverterUInt32.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3197
- case 22: return new P2pEvent.FellBackToRelay({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c) });
3198
- case 23: return new P2pEvent.ConnectFailed({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), kind: FfiConverterTypeNatErrorKind.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
3306
+ case 22: return new P2pEvent.ConnectFailed({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), kind: FfiConverterTypeNatErrorKind.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
3307
+ case 23: return new P2pEvent.ConnectCancelled({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c) });
3199
3308
  case 24: return new P2pEvent.InboundDirectUpgrade({peerId: FfiConverterString.readFromCursor(c) });
3200
3309
  case 25: return new P2pEvent.Message({fromPeerId: FfiConverterString.readFromCursor(c), topics: FfiConverterSequenceString.readFromCursor(c), data: FfiConverterArrayBuffer.readFromCursor(c), seqno: FfiConverterArrayBuffer.readFromCursor(c), signed: FfiConverterBool.readFromCursor(c) });
3201
3310
  case 26: return new P2pEvent.PeerSubscribed({peerId: FfiConverterString.readFromCursor(c), topic: FfiConverterString.readFromCursor(c) });
3202
3311
  case 27: return new P2pEvent.PeerUnsubscribed({peerId: FfiConverterString.readFromCursor(c), topic: FfiConverterString.readFromCursor(c) });
3203
- case 28: return new P2pEvent.PubsubOutboundFailure({peerId: FfiConverterString.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3204
- case 29: return new P2pEvent.PubsubProtocolViolation({peerId: FfiConverterString.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3312
+ case 28: return new P2pEvent.GossipsubOutboundFailure({peerId: FfiConverterString.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3313
+ case 29: return new P2pEvent.GossipsubProtocolViolation({peerId: FfiConverterString.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3205
3314
  case 30: return new P2pEvent.PeerDiscovered({peerId: FfiConverterString.readFromCursor(c), addrs: FfiConverterSequenceString.readFromCursor(c), source: FfiConverterTypeDiscoverySource.readFromCursor(c) });
3206
3315
  case 31: return new P2pEvent.PeerUpdated({peerId: FfiConverterString.readFromCursor(c), addrs: FfiConverterSequenceString.readFromCursor(c), source: FfiConverterTypeDiscoverySource.readFromCursor(c) });
3207
3316
  case 32: return new P2pEvent.PeerExpired({peerId: FfiConverterString.readFromCursor(c) });
@@ -3217,6 +3326,7 @@ const FfiConverterTypeP2pEvent = (() => {
3217
3326
  const inner = value.inner;
3218
3327
  FfiConverterUInt64.writeIntoCursor(inner.dropped, c);
3219
3328
  FfiConverterUInt64.writeIntoCursor(inner.totalDropped, c);
3329
+ FfiConverterSequenceUInt64.writeIntoCursor(inner.terminalConnectIds, c);
3220
3330
  return;
3221
3331
  }
3222
3332
  case P2pEvent_Tags.DriverFailed: {
@@ -3344,6 +3454,7 @@ const FfiConverterTypeP2pEvent = (() => {
3344
3454
  const inner = value.inner;
3345
3455
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3346
3456
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3457
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3347
3458
  FfiConverterTypePathKind.writeIntoCursor(inner.path, c);
3348
3459
  return;
3349
3460
  }
@@ -3371,20 +3482,20 @@ const FfiConverterTypeP2pEvent = (() => {
3371
3482
  FfiConverterString.writeIntoCursor(inner.reason, c);
3372
3483
  return;
3373
3484
  }
3374
- case P2pEvent_Tags.FellBackToRelay: {
3485
+ case P2pEvent_Tags.ConnectFailed: {
3375
3486
  c.writeI32(22);
3376
3487
  const inner = value.inner;
3377
3488
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3378
3489
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3490
+ FfiConverterTypeNatErrorKind.writeIntoCursor(inner.kind, c);
3491
+ FfiConverterString.writeIntoCursor(inner.detail, c);
3379
3492
  return;
3380
3493
  }
3381
- case P2pEvent_Tags.ConnectFailed: {
3494
+ case P2pEvent_Tags.ConnectCancelled: {
3382
3495
  c.writeI32(23);
3383
3496
  const inner = value.inner;
3384
3497
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3385
3498
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3386
- FfiConverterTypeNatErrorKind.writeIntoCursor(inner.kind, c);
3387
- FfiConverterString.writeIntoCursor(inner.detail, c);
3388
3499
  return;
3389
3500
  }
3390
3501
  case P2pEvent_Tags.InboundDirectUpgrade: {
@@ -3417,14 +3528,14 @@ const FfiConverterTypeP2pEvent = (() => {
3417
3528
  FfiConverterString.writeIntoCursor(inner.topic, c);
3418
3529
  return;
3419
3530
  }
3420
- case P2pEvent_Tags.PubsubOutboundFailure: {
3531
+ case P2pEvent_Tags.GossipsubOutboundFailure: {
3421
3532
  c.writeI32(28);
3422
3533
  const inner = value.inner;
3423
3534
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3424
3535
  FfiConverterString.writeIntoCursor(inner.reason, c);
3425
3536
  return;
3426
3537
  }
3427
- case P2pEvent_Tags.PubsubProtocolViolation: {
3538
+ case P2pEvent_Tags.GossipsubProtocolViolation: {
3428
3539
  c.writeI32(29);
3429
3540
  const inner = value.inner;
3430
3541
  FfiConverterString.writeIntoCursor(inner.peerId, c);
@@ -3481,6 +3592,7 @@ const FfiConverterTypeP2pEvent = (() => {
3481
3592
  let size = 4;
3482
3593
  size += FfiConverterUInt64.allocationSize(inner.dropped);
3483
3594
  size += FfiConverterUInt64.allocationSize(inner.totalDropped);
3595
+ size += FfiConverterSequenceUInt64.allocationSize(inner.terminalConnectIds);
3484
3596
  return size;
3485
3597
  }
3486
3598
  case P2pEvent_Tags.DriverFailed: {
@@ -3608,6 +3720,7 @@ const FfiConverterTypeP2pEvent = (() => {
3608
3720
  let size = 4;
3609
3721
  size += FfiConverterUInt64.allocationSize(inner.connectId);
3610
3722
  size += FfiConverterString.allocationSize(inner.peerId);
3723
+ size += FfiConverterUInt64.allocationSize(inner.connId);
3611
3724
  size += FfiConverterTypePathKind.allocationSize(inner.path);
3612
3725
  return size;
3613
3726
  }
@@ -3635,20 +3748,20 @@ const FfiConverterTypeP2pEvent = (() => {
3635
3748
  size += FfiConverterString.allocationSize(inner.reason);
3636
3749
  return size;
3637
3750
  }
3638
- case P2pEvent_Tags.FellBackToRelay: {
3751
+ case P2pEvent_Tags.ConnectFailed: {
3639
3752
  const inner = value.inner;
3640
3753
  let size = 4;
3641
3754
  size += FfiConverterUInt64.allocationSize(inner.connectId);
3642
3755
  size += FfiConverterString.allocationSize(inner.peerId);
3756
+ size += FfiConverterTypeNatErrorKind.allocationSize(inner.kind);
3757
+ size += FfiConverterString.allocationSize(inner.detail);
3643
3758
  return size;
3644
3759
  }
3645
- case P2pEvent_Tags.ConnectFailed: {
3760
+ case P2pEvent_Tags.ConnectCancelled: {
3646
3761
  const inner = value.inner;
3647
3762
  let size = 4;
3648
3763
  size += FfiConverterUInt64.allocationSize(inner.connectId);
3649
3764
  size += FfiConverterString.allocationSize(inner.peerId);
3650
- size += FfiConverterTypeNatErrorKind.allocationSize(inner.kind);
3651
- size += FfiConverterString.allocationSize(inner.detail);
3652
3765
  return size;
3653
3766
  }
3654
3767
  case P2pEvent_Tags.InboundDirectUpgrade: {
@@ -3681,14 +3794,14 @@ const FfiConverterTypeP2pEvent = (() => {
3681
3794
  size += FfiConverterString.allocationSize(inner.topic);
3682
3795
  return size;
3683
3796
  }
3684
- case P2pEvent_Tags.PubsubOutboundFailure: {
3797
+ case P2pEvent_Tags.GossipsubOutboundFailure: {
3685
3798
  const inner = value.inner;
3686
3799
  let size = 4;
3687
3800
  size += FfiConverterString.allocationSize(inner.peerId);
3688
3801
  size += FfiConverterString.allocationSize(inner.reason);
3689
3802
  return size;
3690
3803
  }
3691
- case P2pEvent_Tags.PubsubProtocolViolation: {
3804
+ case P2pEvent_Tags.GossipsubProtocolViolation: {
3692
3805
  const inner = value.inner;
3693
3806
  let size = 4;
3694
3807
  size += FfiConverterString.allocationSize(inner.peerId);
@@ -3922,33 +4035,17 @@ export interface P2pEndpointLike {
3922
4035
  */
3923
4036
  closeStreamWrite(peerId: string, streamId: bigint) /*throws*/: void;
3924
4037
  /**
3925
- * Starts a connection attempt.
3926
- */
3927
- connect(peerId: string) /*throws*/: bigint;
3928
- /**
3929
- * Starts a direct-address connection attempt.
3930
- */
3931
- connectAddr(address: string) /*throws*/: bigint;
3932
- /**
3933
- * Starts a connection attempt with explicit addresses.
4038
+ * Starts one Connection attempt and returns its Connect ID.
3934
4039
  */
3935
- connectWithAddrs(peerId: string, addresses: Array<string>) /*throws*/: bigint;
4040
+ connect(target: ConnectTarget) /*throws*/: bigint;
3936
4041
  /**
3937
4042
  * Returns connected peers.
3938
4043
  */
3939
4044
  connectedPeers() /*throws*/: Array<string>;
3940
4045
  /**
3941
- * Dials on all applicable address families.
3942
- */
3943
- dial(address: string) /*throws*/: Array<bigint>;
3944
- /**
3945
- * Dials using IPv4.
4046
+ * Returns the transport connection selected for a peer.
3946
4047
  */
3947
- dialIp4(address: string) /*throws*/: bigint;
3948
- /**
3949
- * Dials using IPv6.
3950
- */
3951
- dialIp6(address: string) /*throws*/: bigint;
4048
+ connectionInfo(peerId: string) /*throws*/: ConnectionInfo | undefined;
3952
4049
  /**
3953
4050
  * Disconnects a peer.
3954
4051
  */
@@ -4154,48 +4251,15 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4154
4251
  }
4155
4252
 
4156
4253
  /**
4157
- * Starts a connection attempt.
4254
+ * Starts one Connection attempt and returns its Connect ID.
4158
4255
  */
4159
- connect(peerId: string): bigint /*throws*/ {
4256
+ connect(target: ConnectTarget): bigint /*throws*/ {
4160
4257
  return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(
4161
4258
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4162
4259
  /*caller:*/ (callStatus) => {
4163
4260
  return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connect(
4164
4261
  uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
4165
- FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc),
4166
- callStatus);
4167
- },
4168
- /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4169
- ));
4170
- }
4171
-
4172
- /**
4173
- * Starts a direct-address connection attempt.
4174
- */
4175
- connectAddr(address: string): bigint /*throws*/ {
4176
- return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(
4177
- /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4178
- /*caller:*/ (callStatus) => {
4179
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connect_addr(
4180
- uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
4181
- FfiConverterString.lower(address, nativeModule().rustbuffer_alloc),
4182
- callStatus);
4183
- },
4184
- /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4185
- ));
4186
- }
4187
-
4188
- /**
4189
- * Starts a connection attempt with explicit addresses.
4190
- */
4191
- connectWithAddrs(peerId: string, addresses: Array<string>): bigint /*throws*/ {
4192
- return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(
4193
- /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4194
- /*caller:*/ (callStatus) => {
4195
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connect_with_addrs(
4196
- uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
4197
- FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc),
4198
- FfiConverterSequenceString.lower(addresses, nativeModule().rustbuffer_alloc),
4262
+ FfiConverterTypeConnectTarget.lower(target, nativeModule().rustbuffer_alloc),
4199
4263
  callStatus);
4200
4264
  },
4201
4265
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
@@ -4223,58 +4287,26 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
4223
4287
  }
4224
4288
 
4225
4289
  /**
4226
- * Dials on all applicable address families.
4290
+ * Returns the transport connection selected for a peer.
4227
4291
  */
4228
- dial(address: string): Array<bigint> /*throws*/ {
4292
+ connectionInfo(peerId: string): ConnectionInfo | undefined /*throws*/ {
4229
4293
  const __rb: Uint8Array = uniffiCaller.rustCallWithError(
4230
4294
  /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4231
4295
  /*caller:*/ (callStatus) => {
4232
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_dial(
4296
+ return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connection_info(
4233
4297
  uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
4234
- FfiConverterString.lower(address, nativeModule().rustbuffer_alloc),
4298
+ FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc),
4235
4299
  callStatus);
4236
4300
  },
4237
4301
  /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4238
4302
  );
4239
4303
  try {
4240
- return FfiConverterSequenceUInt64.lift(__rb);
4304
+ return FfiConverterOptionalTypeConnectionInfo.lift(__rb);
4241
4305
  } finally {
4242
4306
  nativeModule().rustbuffer_free(__rb);
4243
4307
  }
4244
4308
  }
4245
4309
 
4246
- /**
4247
- * Dials using IPv4.
4248
- */
4249
- dialIp4(address: string): bigint /*throws*/ {
4250
- return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(
4251
- /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4252
- /*caller:*/ (callStatus) => {
4253
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_dial_ip4(
4254
- uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
4255
- FfiConverterString.lower(address, nativeModule().rustbuffer_alloc),
4256
- callStatus);
4257
- },
4258
- /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4259
- ));
4260
- }
4261
-
4262
- /**
4263
- * Dials using IPv6.
4264
- */
4265
- dialIp6(address: string): bigint /*throws*/ {
4266
- return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(
4267
- /*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
4268
- /*caller:*/ (callStatus) => {
4269
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_dial_ip6(
4270
- uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
4271
- FfiConverterString.lower(address, nativeModule().rustbuffer_alloc),
4272
- callStatus);
4273
- },
4274
- /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
4275
- ));
4276
- }
4277
-
4278
4310
  /**
4279
4311
  * Disconnects a peer.
4280
4312
  */
@@ -4726,9 +4758,6 @@ const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);
4726
4758
  // FfiConverter for Array<string> | undefined
4727
4759
  const FfiConverterOptionalSequenceString = new FfiConverterOptional(FfiConverterSequenceString);
4728
4760
 
4729
- // FfiConverter for TransportOptions | undefined
4730
- const FfiConverterOptionalTypeTransportOptions = new FfiConverterOptional(FfiConverterTypeTransportOptions);
4731
-
4732
4761
  // FfiConverter for DiscoveryOptions | undefined
4733
4762
  const FfiConverterOptionalTypeDiscoveryOptions = new FfiConverterOptional(FfiConverterTypeDiscoveryOptions);
4734
4763
 
@@ -4741,11 +4770,14 @@ const FfiConverterOptionalBytes = new FfiConverterOptional(FfiConverterArrayBuff
4741
4770
  // FfiConverter for bigint | undefined
4742
4771
  const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);
4743
4772
 
4773
+ // FfiConverter for Array<bigint>
4774
+ const FfiConverterSequenceUInt64 = new FfiConverterArray(FfiConverterUInt64);
4775
+
4744
4776
  // FfiConverter for RelayReservationInfo | undefined
4745
4777
  const FfiConverterOptionalTypeRelayReservationInfo = new FfiConverterOptional(FfiConverterTypeRelayReservationInfo);
4746
4778
 
4747
- // FfiConverter for Array<bigint>
4748
- const FfiConverterSequenceUInt64 = new FfiConverterArray(FfiConverterUInt64);
4779
+ // FfiConverter for ConnectionInfo | undefined
4780
+ const FfiConverterOptionalTypeConnectionInfo = new FfiConverterOptional(FfiConverterTypeConnectionInfo);
4749
4781
 
4750
4782
  // FfiConverter for Array<P2pEvent>
4751
4783
  const FfiConverterSequenceTypeP2pEvent = new FfiConverterArray(FfiConverterTypeP2pEvent);
@@ -4805,26 +4837,14 @@ function uniffiEnsureInitialized() {
4805
4837
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write() !== 17994) {
4806
4838
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write");
4807
4839
  }
4808
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect() !== 42064) {
4840
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect() !== 53603) {
4809
4841
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect");
4810
4842
  }
4811
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_addr() !== 56611) {
4812
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_addr");
4813
- }
4814
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_with_addrs() !== 2062) {
4815
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_with_addrs");
4816
- }
4817
4843
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers() !== 64148) {
4818
4844
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers");
4819
4845
  }
4820
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial() !== 35216) {
4821
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial");
4822
- }
4823
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip4() !== 54241) {
4824
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip4");
4825
- }
4826
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip6() !== 3676) {
4827
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip6");
4846
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connection_info() !== 24337) {
4847
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connection_info");
4828
4848
  }
4829
4849
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_disconnect() !== 23975) {
4830
4850
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_disconnect");
@@ -4902,6 +4922,8 @@ function uniffiEnsureInitialized() {
4902
4922
  export default Object.freeze({
4903
4923
  initialize: uniffiEnsureInitialized,
4904
4924
  converters: {
4925
+ FfiConverterTypeConnectTarget,
4926
+ FfiConverterTypeConnectionInfo,
4905
4927
  FfiConverterTypeDiscoveryOptions,
4906
4928
  FfiConverterTypeDiscoverySource,
4907
4929
  FfiConverterTypeDriverFailureKind,
@@ -4917,9 +4939,7 @@ export default Object.freeze({
4917
4939
  FfiConverterTypeP2pEvent,
4918
4940
  FfiConverterTypeP2pEventDoorbell,
4919
4941
  FfiConverterTypePathKind,
4920
- FfiConverterTypePubsubRouter,
4921
4942
  FfiConverterTypeReachability,
4922
4943
  FfiConverterTypeRelayReservationInfo,
4923
- FfiConverterTypeTransportOptions,
4924
4944
  }
4925
4945
  });