@minip2p/react-native 0.6.0 → 0.7.1

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.
@@ -99,13 +99,13 @@ const stringConverter = (() => {
99
99
  const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
100
100
 
101
101
  /**
102
- * Signed-discovery configuration.
102
+ * State snapshot of the transport connection selected for a peer.
103
103
  */
104
104
 
105
105
  /**
106
- * Generated factory for {@link DiscoveryOptions} record objects.
106
+ * Generated factory for {@link ConnectionInfo} record objects.
107
107
  */
108
- export const DiscoveryOptions = (() => {
108
+ export const ConnectionInfo = (() => {
109
109
  const defaults = () => ({});
110
110
  const create = (() => {
111
111
  return uniffiCreateRecord(defaults);
@@ -116,24 +116,20 @@ export const DiscoveryOptions = (() => {
116
116
  defaults: () => Object.freeze(defaults())
117
117
  });
118
118
  })();
119
- const FfiConverterTypeDiscoveryOptions = (() => {
119
+ const FfiConverterTypeConnectionInfo = (() => {
120
120
  class FFIConverter extends AbstractFfiConverterByteArray {
121
121
  readFromCursor(c) {
122
122
  return {
123
- topic: FfiConverterString.readFromCursor(c),
124
- beaconIntervalMs: FfiConverterUInt64.readFromCursor(c),
125
- peerTtlMs: FfiConverterUInt64.readFromCursor(c),
126
- autoDial: FfiConverterBool.readFromCursor(c)
123
+ connId: FfiConverterUInt64.readFromCursor(c),
124
+ remoteAddr: FfiConverterOptionalString.readFromCursor(c)
127
125
  };
128
126
  }
129
127
  writeIntoCursor(value, c) {
130
- FfiConverterString.writeIntoCursor(value.topic, c);
131
- FfiConverterUInt64.writeIntoCursor(value.beaconIntervalMs, c);
132
- FfiConverterUInt64.writeIntoCursor(value.peerTtlMs, c);
133
- FfiConverterBool.writeIntoCursor(value.autoDial, c);
128
+ FfiConverterUInt64.writeIntoCursor(value.connId, c);
129
+ FfiConverterOptionalString.writeIntoCursor(value.remoteAddr, c);
134
130
  }
135
131
  allocationSize(value) {
136
- return FfiConverterString.allocationSize(value.topic) + FfiConverterUInt64.allocationSize(value.beaconIntervalMs) + FfiConverterUInt64.allocationSize(value.peerTtlMs) + FfiConverterBool.allocationSize(value.autoDial);
132
+ return FfiConverterUInt64.allocationSize(value.connId) + FfiConverterOptionalString.allocationSize(value.remoteAddr);
137
133
  }
138
134
  }
139
135
  ;
@@ -141,13 +137,13 @@ const FfiConverterTypeDiscoveryOptions = (() => {
141
137
  })();
142
138
 
143
139
  /**
144
- * One enabled transport and the addresses it should listen on.
140
+ * Signed-discovery configuration.
145
141
  */
146
142
 
147
143
  /**
148
- * Generated factory for {@link TransportOptions} record objects.
144
+ * Generated factory for {@link DiscoveryOptions} record objects.
149
145
  */
150
- export const TransportOptions = (() => {
146
+ export const DiscoveryOptions = (() => {
151
147
  const defaults = () => ({});
152
148
  const create = (() => {
153
149
  return uniffiCreateRecord(defaults);
@@ -158,18 +154,24 @@ export const TransportOptions = (() => {
158
154
  defaults: () => Object.freeze(defaults())
159
155
  });
160
156
  })();
161
- const FfiConverterTypeTransportOptions = (() => {
157
+ const FfiConverterTypeDiscoveryOptions = (() => {
162
158
  class FFIConverter extends AbstractFfiConverterByteArray {
163
159
  readFromCursor(c) {
164
160
  return {
165
- listenAddrs: FfiConverterOptionalSequenceString.readFromCursor(c)
161
+ topic: FfiConverterString.readFromCursor(c),
162
+ beaconIntervalMs: FfiConverterUInt64.readFromCursor(c),
163
+ peerTtlMs: FfiConverterUInt64.readFromCursor(c),
164
+ autoDial: FfiConverterBool.readFromCursor(c)
166
165
  };
167
166
  }
168
167
  writeIntoCursor(value, c) {
169
- FfiConverterOptionalSequenceString.writeIntoCursor(value.listenAddrs, c);
168
+ FfiConverterString.writeIntoCursor(value.topic, c);
169
+ FfiConverterUInt64.writeIntoCursor(value.beaconIntervalMs, c);
170
+ FfiConverterUInt64.writeIntoCursor(value.peerTtlMs, c);
171
+ FfiConverterBool.writeIntoCursor(value.autoDial, c);
170
172
  }
171
173
  allocationSize(value) {
172
- return FfiConverterOptionalSequenceString.allocationSize(value.listenAddrs);
174
+ return FfiConverterString.allocationSize(value.topic) + FfiConverterUInt64.allocationSize(value.beaconIntervalMs) + FfiConverterUInt64.allocationSize(value.peerTtlMs) + FfiConverterBool.allocationSize(value.autoDial);
173
175
  }
174
176
  }
175
177
  ;
@@ -251,8 +253,7 @@ const FfiConverterTypeEndpointConfig = (() => {
251
253
  agentVersion: FfiConverterOptionalString.readFromCursor(c),
252
254
  relays: FfiConverterSequenceString.readFromCursor(c),
253
255
  autonatServers: FfiConverterSequenceString.readFromCursor(c),
254
- quic: FfiConverterOptionalTypeTransportOptions.readFromCursor(c),
255
- tcp: FfiConverterOptionalTypeTransportOptions.readFromCursor(c),
256
+ listen: FfiConverterOptionalSequenceString.readFromCursor(c),
256
257
  forceRelay: FfiConverterBool.readFromCursor(c),
257
258
  allowUnsigned: FfiConverterBool.readFromCursor(c),
258
259
  protocols: FfiConverterSequenceString.readFromCursor(c),
@@ -264,8 +265,7 @@ const FfiConverterTypeEndpointConfig = (() => {
264
265
  FfiConverterOptionalString.writeIntoCursor(value.agentVersion, c);
265
266
  FfiConverterSequenceString.writeIntoCursor(value.relays, c);
266
267
  FfiConverterSequenceString.writeIntoCursor(value.autonatServers, c);
267
- FfiConverterOptionalTypeTransportOptions.writeIntoCursor(value.quic, c);
268
- FfiConverterOptionalTypeTransportOptions.writeIntoCursor(value.tcp, c);
268
+ FfiConverterOptionalSequenceString.writeIntoCursor(value.listen, c);
269
269
  FfiConverterBool.writeIntoCursor(value.forceRelay, c);
270
270
  FfiConverterBool.writeIntoCursor(value.allowUnsigned, c);
271
271
  FfiConverterSequenceString.writeIntoCursor(value.protocols, c);
@@ -273,7 +273,7 @@ const FfiConverterTypeEndpointConfig = (() => {
273
273
  FfiConverterOptionalTypeMdnsOptions.writeIntoCursor(value.mdns, c);
274
274
  }
275
275
  allocationSize(value) {
276
- return FfiConverterOptionalString.allocationSize(value.agentVersion) + FfiConverterSequenceString.allocationSize(value.relays) + FfiConverterSequenceString.allocationSize(value.autonatServers) + FfiConverterOptionalTypeTransportOptions.allocationSize(value.quic) + FfiConverterOptionalTypeTransportOptions.allocationSize(value.tcp) + FfiConverterBool.allocationSize(value.forceRelay) + FfiConverterBool.allocationSize(value.allowUnsigned) + FfiConverterSequenceString.allocationSize(value.protocols) + FfiConverterOptionalTypeDiscoveryOptions.allocationSize(value.discovery) + FfiConverterOptionalTypeMdnsOptions.allocationSize(value.mdns);
276
+ return FfiConverterOptionalString.allocationSize(value.agentVersion) + FfiConverterSequenceString.allocationSize(value.relays) + FfiConverterSequenceString.allocationSize(value.autonatServers) + FfiConverterOptionalSequenceString.allocationSize(value.listen) + FfiConverterBool.allocationSize(value.forceRelay) + FfiConverterBool.allocationSize(value.allowUnsigned) + FfiConverterSequenceString.allocationSize(value.protocols) + FfiConverterOptionalTypeDiscoveryOptions.allocationSize(value.discovery) + FfiConverterOptionalTypeMdnsOptions.allocationSize(value.mdns);
277
277
  }
278
278
  }
279
279
  ;
@@ -450,6 +450,139 @@ const FfiConverterTypeRelayReservationInfo = (() => {
450
450
  return new FFIConverter();
451
451
  })();
452
452
 
453
+ // Enum: ConnectTarget
454
+ export let ConnectTarget_Tags = /*#__PURE__*/function (ConnectTarget_Tags) {
455
+ ConnectTarget_Tags["Peer"] = "Peer";
456
+ ConnectTarget_Tags["Addresses"] = "Addresses";
457
+ return ConnectTarget_Tags;
458
+ }({});
459
+ /**
460
+ * What a foreign runtime supplies to start one Connection attempt.
461
+ *
462
+ * Validation lives in `minip2p-ffi-core`; this mirror only declares the shape.
463
+ */
464
+ export const ConnectTarget = (() => {
465
+ /**
466
+ * Peer ID only: the endpoint applies its discovery-book and relay
467
+ * policy.
468
+ */
469
+ class Peer_ extends UniffiEnum {
470
+ /**
471
+ * @private
472
+ * This field is private and should not be used, use `tag` instead.
473
+ */
474
+ [uniffiTypeNameSymbol] = "ConnectTarget";
475
+ tag = ConnectTarget_Tags.Peer;
476
+ constructor(inner) {
477
+ super("ConnectTarget", "Peer");
478
+ this.inner = Object.freeze(inner);
479
+ }
480
+ static new(inner) {
481
+ return new Peer_(inner);
482
+ }
483
+ static instanceOf(obj) {
484
+ return obj.tag === ConnectTarget_Tags.Peer;
485
+ }
486
+ }
487
+ /**
488
+ * One or more complete direct peer addresses that all name the same
489
+ * peer. One address is the single-address form.
490
+ */
491
+ class Addresses_ extends UniffiEnum {
492
+ /**
493
+ * @private
494
+ * This field is private and should not be used, use `tag` instead.
495
+ */
496
+ [uniffiTypeNameSymbol] = "ConnectTarget";
497
+ tag = ConnectTarget_Tags.Addresses;
498
+ constructor(inner) {
499
+ super("ConnectTarget", "Addresses");
500
+ this.inner = Object.freeze(inner);
501
+ }
502
+ static new(inner) {
503
+ return new Addresses_(inner);
504
+ }
505
+ static instanceOf(obj) {
506
+ return obj.tag === ConnectTarget_Tags.Addresses;
507
+ }
508
+ }
509
+ function instanceOf(obj) {
510
+ return obj[uniffiTypeNameSymbol] === "ConnectTarget";
511
+ }
512
+ return Object.freeze({
513
+ instanceOf,
514
+ Peer: Peer_,
515
+ Addresses: Addresses_
516
+ });
517
+ })();
518
+ /**
519
+ * What a foreign runtime supplies to start one Connection attempt.
520
+ *
521
+ * Validation lives in `minip2p-ffi-core`; this mirror only declares the shape.
522
+ */
523
+
524
+ // FfiConverter for enum ConnectTarget
525
+ const FfiConverterTypeConnectTarget = (() => {
526
+ class FFIConverter extends AbstractFfiConverterByteArray {
527
+ readFromCursor(c) {
528
+ switch (c.readI32()) {
529
+ case 1:
530
+ return new ConnectTarget.Peer({
531
+ peerId: FfiConverterString.readFromCursor(c)
532
+ });
533
+ case 2:
534
+ return new ConnectTarget.Addresses({
535
+ addresses: FfiConverterSequenceString.readFromCursor(c)
536
+ });
537
+ default:
538
+ throw new UniffiInternalError.UnexpectedEnumCase();
539
+ }
540
+ }
541
+ writeIntoCursor(value, c) {
542
+ switch (value.tag) {
543
+ case ConnectTarget_Tags.Peer:
544
+ {
545
+ c.writeI32(1);
546
+ const inner = value.inner;
547
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
548
+ return;
549
+ }
550
+ case ConnectTarget_Tags.Addresses:
551
+ {
552
+ c.writeI32(2);
553
+ const inner = value.inner;
554
+ FfiConverterSequenceString.writeIntoCursor(inner.addresses, c);
555
+ return;
556
+ }
557
+ default:
558
+ // Throwing from here means that ConnectTarget_Tags hasn't matched an ordinal.
559
+ throw new UniffiInternalError.UnexpectedEnumCase();
560
+ }
561
+ }
562
+ allocationSize(value) {
563
+ switch (value.tag) {
564
+ case ConnectTarget_Tags.Peer:
565
+ {
566
+ const inner = value.inner;
567
+ let size = 4;
568
+ size += FfiConverterString.allocationSize(inner.peerId);
569
+ return size;
570
+ }
571
+ case ConnectTarget_Tags.Addresses:
572
+ {
573
+ const inner = value.inner;
574
+ let size = 4;
575
+ size += FfiConverterSequenceString.allocationSize(inner.addresses);
576
+ return size;
577
+ }
578
+ default:
579
+ throw new UniffiInternalError.UnexpectedEnumCase();
580
+ }
581
+ }
582
+ }
583
+ return new FFIConverter();
584
+ })();
585
+
453
586
  /**
454
587
  * Source that contributed a discovery observation.
455
588
  */
@@ -1538,8 +1671,8 @@ export let P2pEvent_Tags = /*#__PURE__*/function (P2pEvent_Tags) {
1538
1671
  P2pEvent_Tags["InboundPathEstablished"] = "InboundPathEstablished";
1539
1672
  P2pEvent_Tags["PathUpgraded"] = "PathUpgraded";
1540
1673
  P2pEvent_Tags["HolePunchFailed"] = "HolePunchFailed";
1541
- P2pEvent_Tags["FellBackToRelay"] = "FellBackToRelay";
1542
1674
  P2pEvent_Tags["ConnectFailed"] = "ConnectFailed";
1675
+ P2pEvent_Tags["ConnectCancelled"] = "ConnectCancelled";
1543
1676
  P2pEvent_Tags["InboundDirectUpgrade"] = "InboundDirectUpgrade";
1544
1677
  P2pEvent_Tags["Message"] = "Message";
1545
1678
  P2pEvent_Tags["PeerSubscribed"] = "PeerSubscribed";
@@ -1999,45 +2132,46 @@ export const P2pEvent = (() => {
1999
2132
  }
2000
2133
  }
2001
2134
  /**
2002
- * Direct upgrade attempts ended with the relay path retained.
2135
+ * A connection attempt ended without a usable path.
2003
2136
  */
2004
- class FellBackToRelay_ extends UniffiEnum {
2137
+ class ConnectFailed_ extends UniffiEnum {
2005
2138
  /**
2006
2139
  * @private
2007
2140
  * This field is private and should not be used, use `tag` instead.
2008
2141
  */
2009
2142
  [uniffiTypeNameSymbol] = "P2pEvent";
2010
- tag = P2pEvent_Tags.FellBackToRelay;
2143
+ tag = P2pEvent_Tags.ConnectFailed;
2011
2144
  constructor(inner) {
2012
- super("P2pEvent", "FellBackToRelay");
2145
+ super("P2pEvent", "ConnectFailed");
2013
2146
  this.inner = Object.freeze(inner);
2014
2147
  }
2015
2148
  static new(inner) {
2016
- return new FellBackToRelay_(inner);
2149
+ return new ConnectFailed_(inner);
2017
2150
  }
2018
2151
  static instanceOf(obj) {
2019
- return obj.tag === P2pEvent_Tags.FellBackToRelay;
2152
+ return obj.tag === P2pEvent_Tags.ConnectFailed;
2020
2153
  }
2021
2154
  }
2022
2155
  /**
2023
- * A connection attempt ended without a usable path.
2156
+ * A Connection attempt was cancelled by `cancel_connect` before it
2157
+ * settled. Terminal for that Connect ID.
2024
2158
  */
2025
- class ConnectFailed_ extends UniffiEnum {
2159
+ class ConnectCancelled_ extends UniffiEnum {
2026
2160
  /**
2027
2161
  * @private
2028
2162
  * This field is private and should not be used, use `tag` instead.
2029
2163
  */
2030
2164
  [uniffiTypeNameSymbol] = "P2pEvent";
2031
- tag = P2pEvent_Tags.ConnectFailed;
2165
+ tag = P2pEvent_Tags.ConnectCancelled;
2032
2166
  constructor(inner) {
2033
- super("P2pEvent", "ConnectFailed");
2167
+ super("P2pEvent", "ConnectCancelled");
2034
2168
  this.inner = Object.freeze(inner);
2035
2169
  }
2036
2170
  static new(inner) {
2037
- return new ConnectFailed_(inner);
2171
+ return new ConnectCancelled_(inner);
2038
2172
  }
2039
2173
  static instanceOf(obj) {
2040
- return obj.tag === P2pEvent_Tags.ConnectFailed;
2174
+ return obj.tag === P2pEvent_Tags.ConnectCancelled;
2041
2175
  }
2042
2176
  }
2043
2177
  /**
@@ -2301,8 +2435,8 @@ export const P2pEvent = (() => {
2301
2435
  InboundPathEstablished: InboundPathEstablished_,
2302
2436
  PathUpgraded: PathUpgraded_,
2303
2437
  HolePunchFailed: HolePunchFailed_,
2304
- FellBackToRelay: FellBackToRelay_,
2305
2438
  ConnectFailed: ConnectFailed_,
2439
+ ConnectCancelled: ConnectCancelled_,
2306
2440
  InboundDirectUpgrade: InboundDirectUpgrade_,
2307
2441
  Message: Message_,
2308
2442
  PeerSubscribed: PeerSubscribed_,
@@ -2328,7 +2462,8 @@ const FfiConverterTypeP2pEvent = (() => {
2328
2462
  case 1:
2329
2463
  return new P2pEvent.EventsDropped({
2330
2464
  dropped: FfiConverterUInt64.readFromCursor(c),
2331
- totalDropped: FfiConverterUInt64.readFromCursor(c)
2465
+ totalDropped: FfiConverterUInt64.readFromCursor(c),
2466
+ terminalConnectIds: FfiConverterSequenceUInt64.readFromCursor(c)
2332
2467
  });
2333
2468
  case 2:
2334
2469
  return new P2pEvent.DriverFailed({
@@ -2422,6 +2557,7 @@ const FfiConverterTypeP2pEvent = (() => {
2422
2557
  return new P2pEvent.PathEstablished({
2423
2558
  connectId: FfiConverterUInt64.readFromCursor(c),
2424
2559
  peerId: FfiConverterString.readFromCursor(c),
2560
+ connId: FfiConverterUInt64.readFromCursor(c),
2425
2561
  path: FfiConverterTypePathKind.readFromCursor(c)
2426
2562
  });
2427
2563
  case 19:
@@ -2443,17 +2579,17 @@ const FfiConverterTypeP2pEvent = (() => {
2443
2579
  reason: FfiConverterString.readFromCursor(c)
2444
2580
  });
2445
2581
  case 22:
2446
- return new P2pEvent.FellBackToRelay({
2447
- connectId: FfiConverterUInt64.readFromCursor(c),
2448
- peerId: FfiConverterString.readFromCursor(c)
2449
- });
2450
- case 23:
2451
2582
  return new P2pEvent.ConnectFailed({
2452
2583
  connectId: FfiConverterUInt64.readFromCursor(c),
2453
2584
  peerId: FfiConverterString.readFromCursor(c),
2454
2585
  kind: FfiConverterTypeNatErrorKind.readFromCursor(c),
2455
2586
  detail: FfiConverterString.readFromCursor(c)
2456
2587
  });
2588
+ case 23:
2589
+ return new P2pEvent.ConnectCancelled({
2590
+ connectId: FfiConverterUInt64.readFromCursor(c),
2591
+ peerId: FfiConverterString.readFromCursor(c)
2592
+ });
2457
2593
  case 24:
2458
2594
  return new P2pEvent.InboundDirectUpgrade({
2459
2595
  peerId: FfiConverterString.readFromCursor(c)
@@ -2526,6 +2662,7 @@ const FfiConverterTypeP2pEvent = (() => {
2526
2662
  const inner = value.inner;
2527
2663
  FfiConverterUInt64.writeIntoCursor(inner.dropped, c);
2528
2664
  FfiConverterUInt64.writeIntoCursor(inner.totalDropped, c);
2665
+ FfiConverterSequenceUInt64.writeIntoCursor(inner.terminalConnectIds, c);
2529
2666
  return;
2530
2667
  }
2531
2668
  case P2pEvent_Tags.DriverFailed:
@@ -2670,6 +2807,7 @@ const FfiConverterTypeP2pEvent = (() => {
2670
2807
  const inner = value.inner;
2671
2808
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
2672
2809
  FfiConverterString.writeIntoCursor(inner.peerId, c);
2810
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
2673
2811
  FfiConverterTypePathKind.writeIntoCursor(inner.path, c);
2674
2812
  return;
2675
2813
  }
@@ -2700,22 +2838,22 @@ const FfiConverterTypeP2pEvent = (() => {
2700
2838
  FfiConverterString.writeIntoCursor(inner.reason, c);
2701
2839
  return;
2702
2840
  }
2703
- case P2pEvent_Tags.FellBackToRelay:
2841
+ case P2pEvent_Tags.ConnectFailed:
2704
2842
  {
2705
2843
  c.writeI32(22);
2706
2844
  const inner = value.inner;
2707
2845
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
2708
2846
  FfiConverterString.writeIntoCursor(inner.peerId, c);
2847
+ FfiConverterTypeNatErrorKind.writeIntoCursor(inner.kind, c);
2848
+ FfiConverterString.writeIntoCursor(inner.detail, c);
2709
2849
  return;
2710
2850
  }
2711
- case P2pEvent_Tags.ConnectFailed:
2851
+ case P2pEvent_Tags.ConnectCancelled:
2712
2852
  {
2713
2853
  c.writeI32(23);
2714
2854
  const inner = value.inner;
2715
2855
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
2716
2856
  FfiConverterString.writeIntoCursor(inner.peerId, c);
2717
- FfiConverterTypeNatErrorKind.writeIntoCursor(inner.kind, c);
2718
- FfiConverterString.writeIntoCursor(inner.detail, c);
2719
2857
  return;
2720
2858
  }
2721
2859
  case P2pEvent_Tags.InboundDirectUpgrade:
@@ -2824,6 +2962,7 @@ const FfiConverterTypeP2pEvent = (() => {
2824
2962
  let size = 4;
2825
2963
  size += FfiConverterUInt64.allocationSize(inner.dropped);
2826
2964
  size += FfiConverterUInt64.allocationSize(inner.totalDropped);
2965
+ size += FfiConverterSequenceUInt64.allocationSize(inner.terminalConnectIds);
2827
2966
  return size;
2828
2967
  }
2829
2968
  case P2pEvent_Tags.DriverFailed:
@@ -2968,6 +3107,7 @@ const FfiConverterTypeP2pEvent = (() => {
2968
3107
  let size = 4;
2969
3108
  size += FfiConverterUInt64.allocationSize(inner.connectId);
2970
3109
  size += FfiConverterString.allocationSize(inner.peerId);
3110
+ size += FfiConverterUInt64.allocationSize(inner.connId);
2971
3111
  size += FfiConverterTypePathKind.allocationSize(inner.path);
2972
3112
  return size;
2973
3113
  }
@@ -2998,22 +3138,22 @@ const FfiConverterTypeP2pEvent = (() => {
2998
3138
  size += FfiConverterString.allocationSize(inner.reason);
2999
3139
  return size;
3000
3140
  }
3001
- case P2pEvent_Tags.FellBackToRelay:
3141
+ case P2pEvent_Tags.ConnectFailed:
3002
3142
  {
3003
3143
  const inner = value.inner;
3004
3144
  let size = 4;
3005
3145
  size += FfiConverterUInt64.allocationSize(inner.connectId);
3006
3146
  size += FfiConverterString.allocationSize(inner.peerId);
3147
+ size += FfiConverterTypeNatErrorKind.allocationSize(inner.kind);
3148
+ size += FfiConverterString.allocationSize(inner.detail);
3007
3149
  return size;
3008
3150
  }
3009
- case P2pEvent_Tags.ConnectFailed:
3151
+ case P2pEvent_Tags.ConnectCancelled:
3010
3152
  {
3011
3153
  const inner = value.inner;
3012
3154
  let size = 4;
3013
3155
  size += FfiConverterUInt64.allocationSize(inner.connectId);
3014
3156
  size += FfiConverterString.allocationSize(inner.peerId);
3015
- size += FfiConverterTypeNatErrorKind.allocationSize(inner.kind);
3016
- size += FfiConverterString.allocationSize(inner.detail);
3017
3157
  return size;
3018
3158
  }
3019
3159
  case P2pEvent_Tags.InboundDirectUpgrade:
@@ -3298,29 +3438,11 @@ export class P2pEndpoint extends UniffiAbstractObject {
3298
3438
  }
3299
3439
 
3300
3440
  /**
3301
- * Starts a connection attempt.
3302
- */
3303
- connect(peerId) /*throws*/{
3304
- return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError), /*caller:*/callStatus => {
3305
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connect(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc), callStatus);
3306
- }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
3307
- }
3308
-
3309
- /**
3310
- * Starts a direct-address connection attempt.
3441
+ * Starts one Connection attempt and returns its Connect ID.
3311
3442
  */
3312
- connectAddr(address) /*throws*/{
3443
+ connect(target) /*throws*/{
3313
3444
  return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError), /*caller:*/callStatus => {
3314
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connect_addr(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(address, nativeModule().rustbuffer_alloc), callStatus);
3315
- }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
3316
- }
3317
-
3318
- /**
3319
- * Starts a connection attempt with explicit addresses.
3320
- */
3321
- connectWithAddrs(peerId, addresses) /*throws*/{
3322
- return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError), /*caller:*/callStatus => {
3323
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connect_with_addrs(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc), FfiConverterSequenceString.lower(addresses, nativeModule().rustbuffer_alloc), callStatus);
3445
+ return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connect(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterTypeConnectTarget.lower(target, nativeModule().rustbuffer_alloc), callStatus);
3324
3446
  }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
3325
3447
  }
3326
3448
 
@@ -3339,37 +3461,19 @@ export class P2pEndpoint extends UniffiAbstractObject {
3339
3461
  }
3340
3462
 
3341
3463
  /**
3342
- * Dials on all applicable address families.
3464
+ * Returns the transport connection selected for a peer.
3343
3465
  */
3344
- dial(address) /*throws*/{
3466
+ connectionInfo(peerId) /*throws*/{
3345
3467
  const __rb = uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError), /*caller:*/callStatus => {
3346
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_dial(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(address, nativeModule().rustbuffer_alloc), callStatus);
3468
+ return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connection_info(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc), callStatus);
3347
3469
  }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString));
3348
3470
  try {
3349
- return FfiConverterSequenceUInt64.lift(__rb);
3471
+ return FfiConverterOptionalTypeConnectionInfo.lift(__rb);
3350
3472
  } finally {
3351
3473
  nativeModule().rustbuffer_free(__rb);
3352
3474
  }
3353
3475
  }
3354
3476
 
3355
- /**
3356
- * Dials using IPv4.
3357
- */
3358
- dialIp4(address) /*throws*/{
3359
- return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError), /*caller:*/callStatus => {
3360
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_dial_ip4(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(address, nativeModule().rustbuffer_alloc), callStatus);
3361
- }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
3362
- }
3363
-
3364
- /**
3365
- * Dials using IPv6.
3366
- */
3367
- dialIp6(address) /*throws*/{
3368
- return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError), /*caller:*/callStatus => {
3369
- return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_dial_ip6(uniffiTypeP2pEndpointObjectFactory.clonePointer(this), FfiConverterString.lower(address, nativeModule().rustbuffer_alloc), callStatus);
3370
- }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
3371
- }
3372
-
3373
3477
  /**
3374
3478
  * Disconnects a peer.
3375
3479
  */
@@ -3560,7 +3664,7 @@ export class P2pEndpoint extends UniffiAbstractObject {
3560
3664
  }
3561
3665
 
3562
3666
  /**
3563
- * Selects active or idle polling.
3667
+ * Accepted for compatibility; has no effect, since the driver sleeps until the endpoint's next deadline.
3564
3668
  */
3565
3669
  setActive(active) {
3566
3670
  uniffiCaller.rustCall(/*caller:*/callStatus => {
@@ -3669,9 +3773,6 @@ const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);
3669
3773
  // FfiConverter for Array<string> | undefined
3670
3774
  const FfiConverterOptionalSequenceString = new FfiConverterOptional(FfiConverterSequenceString);
3671
3775
 
3672
- // FfiConverter for TransportOptions | undefined
3673
- const FfiConverterOptionalTypeTransportOptions = new FfiConverterOptional(FfiConverterTypeTransportOptions);
3674
-
3675
3776
  // FfiConverter for DiscoveryOptions | undefined
3676
3777
  const FfiConverterOptionalTypeDiscoveryOptions = new FfiConverterOptional(FfiConverterTypeDiscoveryOptions);
3677
3778
 
@@ -3684,11 +3785,14 @@ const FfiConverterOptionalBytes = new FfiConverterOptional(FfiConverterArrayBuff
3684
3785
  // FfiConverter for bigint | undefined
3685
3786
  const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);
3686
3787
 
3788
+ // FfiConverter for Array<bigint>
3789
+ const FfiConverterSequenceUInt64 = new FfiConverterArray(FfiConverterUInt64);
3790
+
3687
3791
  // FfiConverter for RelayReservationInfo | undefined
3688
3792
  const FfiConverterOptionalTypeRelayReservationInfo = new FfiConverterOptional(FfiConverterTypeRelayReservationInfo);
3689
3793
 
3690
- // FfiConverter for Array<bigint>
3691
- const FfiConverterSequenceUInt64 = new FfiConverterArray(FfiConverterUInt64);
3794
+ // FfiConverter for ConnectionInfo | undefined
3795
+ const FfiConverterOptionalTypeConnectionInfo = new FfiConverterOptional(FfiConverterTypeConnectionInfo);
3692
3796
 
3693
3797
  // FfiConverter for Array<P2pEvent>
3694
3798
  const FfiConverterSequenceTypeP2pEvent = new FfiConverterArray(FfiConverterTypeP2pEvent);
@@ -3747,26 +3851,14 @@ function uniffiEnsureInitialized() {
3747
3851
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write() !== 17994) {
3748
3852
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write");
3749
3853
  }
3750
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect() !== 42064) {
3854
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect() !== 53603) {
3751
3855
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect");
3752
3856
  }
3753
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_addr() !== 56611) {
3754
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_addr");
3755
- }
3756
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_with_addrs() !== 2062) {
3757
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_with_addrs");
3758
- }
3759
3857
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers() !== 64148) {
3760
3858
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers");
3761
3859
  }
3762
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial() !== 35216) {
3763
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial");
3764
- }
3765
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip4() !== 54241) {
3766
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip4");
3767
- }
3768
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip6() !== 3676) {
3769
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip6");
3860
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connection_info() !== 24337) {
3861
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connection_info");
3770
3862
  }
3771
3863
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_disconnect() !== 23975) {
3772
3864
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_disconnect");
@@ -3816,7 +3908,7 @@ function uniffiEnsureInitialized() {
3816
3908
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_send_stream() !== 64427) {
3817
3909
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_send_stream");
3818
3910
  }
3819
- if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_set_active() !== 95) {
3911
+ if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_set_active() !== 10522) {
3820
3912
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_set_active");
3821
3913
  }
3822
3914
  if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_start() !== 31285) {
@@ -3842,6 +3934,8 @@ function uniffiEnsureInitialized() {
3842
3934
  export default Object.freeze({
3843
3935
  initialize: uniffiEnsureInitialized,
3844
3936
  converters: {
3937
+ FfiConverterTypeConnectTarget,
3938
+ FfiConverterTypeConnectionInfo,
3845
3939
  FfiConverterTypeDiscoveryOptions,
3846
3940
  FfiConverterTypeDiscoverySource,
3847
3941
  FfiConverterTypeDriverFailureKind,
@@ -3858,8 +3952,7 @@ export default Object.freeze({
3858
3952
  FfiConverterTypeP2pEventDoorbell,
3859
3953
  FfiConverterTypePathKind,
3860
3954
  FfiConverterTypeReachability,
3861
- FfiConverterTypeRelayReservationInfo,
3862
- FfiConverterTypeTransportOptions
3955
+ FfiConverterTypeRelayReservationInfo
3863
3956
  }
3864
3957
  });
3865
3958
  //# sourceMappingURL=minip2p_ffi.js.map