@minip2p/react-native 0.8.2 → 0.9.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.
@@ -662,6 +662,67 @@ const FfiConverterTypeRelayReservationInfo = (() => {
662
662
  return new FFIConverter();
663
663
  })();
664
664
 
665
+ /**
666
+ * The part of an endpoint's configuration an [`FfiError::InvalidConfig`]
667
+ * names.
668
+ *
669
+ * A configuration mistake is fixed by changing that part; an environment
670
+ * failure (a socket the platform refused) is [`FfiError::Transport`]
671
+ * instead.
672
+ */
673
+ export enum ConfigCapability {
674
+ /**
675
+ * Gossipsub settings.
676
+ */
677
+ Gossipsub,
678
+ /**
679
+ * mDNS settings.
680
+ */
681
+ Mdns,
682
+ /**
683
+ * Signed discovery or peer-book settings.
684
+ */
685
+ Discovery,
686
+ /**
687
+ * QUIC or TCP transport settings (limits, TLS, the TCP namespace).
688
+ */
689
+ Transport,
690
+ /**
691
+ * The endpoint's own options: listen addresses, protocols, NAT and
692
+ * relay policy, auto-dial.
693
+ */
694
+ Options
695
+ }
696
+
697
+ const FfiConverterTypeConfigCapability = (() => {
698
+ type TypeName = ConfigCapability;
699
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
700
+ readFromCursor(c: Cursor): TypeName {
701
+ switch (c.readI32()) {
702
+ case 1: return ConfigCapability.Gossipsub;
703
+ case 2: return ConfigCapability.Mdns;
704
+ case 3: return ConfigCapability.Discovery;
705
+ case 4: return ConfigCapability.Transport;
706
+ case 5: return ConfigCapability.Options;
707
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
708
+ }
709
+ }
710
+ writeIntoCursor(value: TypeName, c: Cursor): void {
711
+ switch (value) {
712
+ case ConfigCapability.Gossipsub: return c.writeI32(1);
713
+ case ConfigCapability.Mdns: return c.writeI32(2);
714
+ case ConfigCapability.Discovery: return c.writeI32(3);
715
+ case ConfigCapability.Transport: return c.writeI32(4);
716
+ case ConfigCapability.Options: return c.writeI32(5);
717
+ }
718
+ }
719
+ allocationSize(value: TypeName): number {
720
+ return 4;
721
+ }
722
+ }
723
+ return new FFIConverter();
724
+ })();
725
+
665
726
 
666
727
  // Enum: ConnectTarget
667
728
  export enum ConnectTarget_Tags {
@@ -1062,10 +1123,11 @@ export const FfiError = (() => {
1062
1123
  type InvalidConfig__interface = {
1063
1124
  tag: FfiError_Tags.InvalidConfig;
1064
1125
  inner:
1065
- Readonly<{detail: string}>
1126
+ Readonly<{capability: ConfigCapability; detail: string}>
1066
1127
  };
1067
1128
  /**
1068
- * Endpoint configuration was internally inconsistent.
1129
+ * Endpoint configuration was invalid; `capability` names the part of
1130
+ * it that was.
1069
1131
  */
1070
1132
  class InvalidConfig_ extends UniffiError implements InvalidConfig__interface {
1071
1133
  /**
@@ -1075,15 +1137,15 @@ Readonly<{detail: string}>
1075
1137
  readonly [uniffiTypeNameSymbol] = "FfiError";
1076
1138
  readonly tag = FfiError_Tags.InvalidConfig;
1077
1139
  readonly inner:
1078
- Readonly<{detail: string}>;
1140
+ Readonly<{capability: ConfigCapability; detail: string}>;
1079
1141
  constructor(
1080
- inner: {detail: string }) {
1142
+ inner: {capability: ConfigCapability; detail: string }) {
1081
1143
  super("FfiError", "InvalidConfig");
1082
1144
 
1083
1145
  this.inner = Object.freeze(inner);
1084
1146
  }
1085
1147
  static new(
1086
- inner: {detail: string }): InvalidConfig_ {
1148
+ inner: {capability: ConfigCapability; detail: string }): InvalidConfig_ {
1087
1149
  return new InvalidConfig_(inner);
1088
1150
  }
1089
1151
 
@@ -1095,7 +1157,7 @@ inner: {detail: string }): InvalidConfig_ {
1095
1157
  }
1096
1158
 
1097
1159
  static getInner(obj: InvalidConfig_):
1098
- Readonly<{detail: string}> {
1160
+ Readonly<{capability: ConfigCapability; detail: string}> {
1099
1161
  return obj.inner;
1100
1162
  }
1101
1163
 
@@ -1377,7 +1439,8 @@ Readonly<{detail: string}> {
1377
1439
  Readonly<{detail: string}>
1378
1440
  };
1379
1441
  /**
1380
- * A synchronous transport operation failed.
1442
+ * A synchronous transport operation failed, or the platform refused a
1443
+ * socket the endpoint needed (a port in use, say).
1381
1444
  */
1382
1445
  class Transport_ extends UniffiError implements Transport__interface {
1383
1446
  /**
@@ -1534,7 +1597,7 @@ const FfiConverterTypeFfiError = (() => {
1534
1597
  switch (c.readI32()) {
1535
1598
  case 1: return new FfiError.AlreadyStarted();
1536
1599
  case 2: return new FfiError.Stopped();
1537
- case 3: return new FfiError.InvalidConfig({detail: FfiConverterString.readFromCursor(c) });
1600
+ case 3: return new FfiError.InvalidConfig({capability: FfiConverterTypeConfigCapability.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
1538
1601
  case 4: return new FfiError.InvalidKey({detail: FfiConverterString.readFromCursor(c) });
1539
1602
  case 5: return new FfiError.InvalidPeerId({detail: FfiConverterString.readFromCursor(c) });
1540
1603
  case 6: return new FfiError.InvalidAddress({detail: FfiConverterString.readFromCursor(c) });
@@ -1561,6 +1624,7 @@ const FfiConverterTypeFfiError = (() => {
1561
1624
  case FfiError_Tags.InvalidConfig: {
1562
1625
  c.writeI32(3);
1563
1626
  const inner = value.inner;
1627
+ FfiConverterTypeConfigCapability.writeIntoCursor(inner.capability, c);
1564
1628
  FfiConverterString.writeIntoCursor(inner.detail, c);
1565
1629
  return;
1566
1630
  }
@@ -1636,6 +1700,7 @@ const FfiConverterTypeFfiError = (() => {
1636
1700
  case FfiError_Tags.InvalidConfig: {
1637
1701
  const inner = value.inner;
1638
1702
  let size = 4;
1703
+ size += FfiConverterTypeConfigCapability.allocationSize(inner.capability);
1639
1704
  size += FfiConverterString.allocationSize(inner.detail);
1640
1705
  return size;
1641
1706
  }
@@ -1700,6 +1765,74 @@ const FfiConverterTypeFfiError = (() => {
1700
1765
  return new FFIConverter();
1701
1766
  })();
1702
1767
 
1768
+ /**
1769
+ * Category of an mDNS failure.
1770
+ */
1771
+ export enum MdnsFailureKind {
1772
+ /**
1773
+ * The platform cannot provide mDNS sockets.
1774
+ */
1775
+ Unsupported,
1776
+ /**
1777
+ * An interface has no usable address.
1778
+ */
1779
+ NoInterfaceAddress,
1780
+ /**
1781
+ * A send named an interface that has gone away.
1782
+ */
1783
+ UnknownInterface,
1784
+ /**
1785
+ * A goodbye could not be sent before shutdown gave up on a full send
1786
+ * buffer.
1787
+ */
1788
+ Congested,
1789
+ /**
1790
+ * A datagram is larger than the carrier can ever send.
1791
+ */
1792
+ Oversized,
1793
+ /**
1794
+ * The interface id space is exhausted.
1795
+ */
1796
+ InterfaceIdsExhausted,
1797
+ /**
1798
+ * Platform I/O failed.
1799
+ */
1800
+ Io
1801
+ }
1802
+
1803
+ const FfiConverterTypeMdnsFailureKind = (() => {
1804
+ type TypeName = MdnsFailureKind;
1805
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1806
+ readFromCursor(c: Cursor): TypeName {
1807
+ switch (c.readI32()) {
1808
+ case 1: return MdnsFailureKind.Unsupported;
1809
+ case 2: return MdnsFailureKind.NoInterfaceAddress;
1810
+ case 3: return MdnsFailureKind.UnknownInterface;
1811
+ case 4: return MdnsFailureKind.Congested;
1812
+ case 5: return MdnsFailureKind.Oversized;
1813
+ case 6: return MdnsFailureKind.InterfaceIdsExhausted;
1814
+ case 7: return MdnsFailureKind.Io;
1815
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
1816
+ }
1817
+ }
1818
+ writeIntoCursor(value: TypeName, c: Cursor): void {
1819
+ switch (value) {
1820
+ case MdnsFailureKind.Unsupported: return c.writeI32(1);
1821
+ case MdnsFailureKind.NoInterfaceAddress: return c.writeI32(2);
1822
+ case MdnsFailureKind.UnknownInterface: return c.writeI32(3);
1823
+ case MdnsFailureKind.Congested: return c.writeI32(4);
1824
+ case MdnsFailureKind.Oversized: return c.writeI32(5);
1825
+ case MdnsFailureKind.InterfaceIdsExhausted: return c.writeI32(6);
1826
+ case MdnsFailureKind.Io: return c.writeI32(7);
1827
+ }
1828
+ }
1829
+ allocationSize(value: TypeName): number {
1830
+ return 4;
1831
+ }
1832
+ }
1833
+ return new FFIConverter();
1834
+ })();
1835
+
1703
1836
  /**
1704
1837
  * Category of a failed NAT connection attempt.
1705
1838
  */
@@ -2010,6 +2143,8 @@ export enum P2pEvent_Tags {
2010
2143
  PeerUpdated = "PeerUpdated",
2011
2144
  PeerExpired = "PeerExpired",
2012
2145
  DiscoveryDialFailed = "DiscoveryDialFailed",
2146
+ MdnsFailed = "MdnsFailed",
2147
+ MdnsRecovered = "MdnsRecovered",
2013
2148
  DiscoveryProtocolViolation = "DiscoveryProtocolViolation"
2014
2149
  }
2015
2150
  /**
@@ -2229,7 +2364,7 @@ inner: {peerId: string; connId: bigint; protocols: Array<string> }): PeerReady_
2229
2364
  type IdentifyReceived__interface = {
2230
2365
  tag: P2pEvent_Tags.IdentifyReceived;
2231
2366
  inner:
2232
- Readonly<{peerId: string; info: IdentifyInfo}>
2367
+ Readonly<{peerId: string; connId: bigint; info: IdentifyInfo}>
2233
2368
  };
2234
2369
  /**
2235
2370
  * A peer supplied a new Identify snapshot.
@@ -2242,15 +2377,15 @@ Readonly<{peerId: string; info: IdentifyInfo}>
2242
2377
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2243
2378
  readonly tag = P2pEvent_Tags.IdentifyReceived;
2244
2379
  readonly inner:
2245
- Readonly<{peerId: string; info: IdentifyInfo}>;
2380
+ Readonly<{peerId: string; connId: bigint; info: IdentifyInfo}>;
2246
2381
  constructor(
2247
- inner: {peerId: string; info: IdentifyInfo }) {
2382
+ inner: {peerId: string; connId: bigint; info: IdentifyInfo }) {
2248
2383
  super("P2pEvent", "IdentifyReceived");
2249
2384
 
2250
2385
  this.inner = Object.freeze(inner);
2251
2386
  }
2252
2387
  static new(
2253
- inner: {peerId: string; info: IdentifyInfo }): IdentifyReceived_ {
2388
+ inner: {peerId: string; connId: bigint; info: IdentifyInfo }): IdentifyReceived_ {
2254
2389
  return new IdentifyReceived_(inner);
2255
2390
  }
2256
2391
 
@@ -2263,7 +2398,7 @@ inner: {peerId: string; info: IdentifyInfo }): IdentifyReceived_ {
2263
2398
  type PingRttMeasured__interface = {
2264
2399
  tag: P2pEvent_Tags.PingRttMeasured;
2265
2400
  inner:
2266
- Readonly<{peerId: string; rttMs: bigint}>
2401
+ Readonly<{peerId: string; connId: bigint; rttMs: bigint}>
2267
2402
  };
2268
2403
  /**
2269
2404
  * A ping round-trip measurement completed.
@@ -2276,15 +2411,15 @@ Readonly<{peerId: string; rttMs: bigint}>
2276
2411
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2277
2412
  readonly tag = P2pEvent_Tags.PingRttMeasured;
2278
2413
  readonly inner:
2279
- Readonly<{peerId: string; rttMs: bigint}>;
2414
+ Readonly<{peerId: string; connId: bigint; rttMs: bigint}>;
2280
2415
  constructor(
2281
- inner: {peerId: string; rttMs: bigint }) {
2416
+ inner: {peerId: string; connId: bigint; rttMs: bigint }) {
2282
2417
  super("P2pEvent", "PingRttMeasured");
2283
2418
 
2284
2419
  this.inner = Object.freeze(inner);
2285
2420
  }
2286
2421
  static new(
2287
- inner: {peerId: string; rttMs: bigint }): PingRttMeasured_ {
2422
+ inner: {peerId: string; connId: bigint; rttMs: bigint }): PingRttMeasured_ {
2288
2423
  return new PingRttMeasured_(inner);
2289
2424
  }
2290
2425
 
@@ -2297,7 +2432,7 @@ inner: {peerId: string; rttMs: bigint }): PingRttMeasured_ {
2297
2432
  type PingTimeout__interface = {
2298
2433
  tag: P2pEvent_Tags.PingTimeout;
2299
2434
  inner:
2300
- Readonly<{peerId: string}>
2435
+ Readonly<{peerId: string; connId: bigint}>
2301
2436
  };
2302
2437
  /**
2303
2438
  * A ping timed out.
@@ -2310,15 +2445,15 @@ Readonly<{peerId: string}>
2310
2445
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2311
2446
  readonly tag = P2pEvent_Tags.PingTimeout;
2312
2447
  readonly inner:
2313
- Readonly<{peerId: string}>;
2448
+ Readonly<{peerId: string; connId: bigint}>;
2314
2449
  constructor(
2315
- inner: {peerId: string }) {
2450
+ inner: {peerId: string; connId: bigint }) {
2316
2451
  super("P2pEvent", "PingTimeout");
2317
2452
 
2318
2453
  this.inner = Object.freeze(inner);
2319
2454
  }
2320
2455
  static new(
2321
- inner: {peerId: string }): PingTimeout_ {
2456
+ inner: {peerId: string; connId: bigint }): PingTimeout_ {
2322
2457
  return new PingTimeout_(inner);
2323
2458
  }
2324
2459
 
@@ -2741,7 +2876,7 @@ inner: {connectId: bigint; peerId: string; connId: bigint; path: PathKind }): Pa
2741
2876
  type InboundPathEstablished__interface = {
2742
2877
  tag: P2pEvent_Tags.InboundPathEstablished;
2743
2878
  inner:
2744
- Readonly<{peerId: string; path: PathKind}>
2879
+ Readonly<{peerId: string; path: PathKind; connId: bigint}>
2745
2880
  };
2746
2881
  /**
2747
2882
  * An inbound relay circuit became a usable path.
@@ -2754,15 +2889,15 @@ Readonly<{peerId: string; path: PathKind}>
2754
2889
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2755
2890
  readonly tag = P2pEvent_Tags.InboundPathEstablished;
2756
2891
  readonly inner:
2757
- Readonly<{peerId: string; path: PathKind}>;
2892
+ Readonly<{peerId: string; path: PathKind; connId: bigint}>;
2758
2893
  constructor(
2759
- inner: {peerId: string; path: PathKind }) {
2894
+ inner: {peerId: string; path: PathKind; connId: bigint }) {
2760
2895
  super("P2pEvent", "InboundPathEstablished");
2761
2896
 
2762
2897
  this.inner = Object.freeze(inner);
2763
2898
  }
2764
2899
  static new(
2765
- inner: {peerId: string; path: PathKind }): InboundPathEstablished_ {
2900
+ inner: {peerId: string; path: PathKind; connId: bigint }): InboundPathEstablished_ {
2766
2901
  return new InboundPathEstablished_(inner);
2767
2902
  }
2768
2903
 
@@ -2775,7 +2910,7 @@ inner: {peerId: string; path: PathKind }): InboundPathEstablished_ {
2775
2910
  type PathUpgraded__interface = {
2776
2911
  tag: P2pEvent_Tags.PathUpgraded;
2777
2912
  inner:
2778
- Readonly<{connectId: bigint; peerId: string; from: PathKind; to: PathKind}>
2913
+ Readonly<{connectId: bigint; peerId: string; from: PathKind; to: PathKind; oldConnId: bigint; newConnId: bigint}>
2779
2914
  };
2780
2915
  /**
2781
2916
  * A better path replaced an earlier path.
@@ -2788,15 +2923,15 @@ Readonly<{connectId: bigint; peerId: string; from: PathKind; to: PathKind}>
2788
2923
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2789
2924
  readonly tag = P2pEvent_Tags.PathUpgraded;
2790
2925
  readonly inner:
2791
- Readonly<{connectId: bigint; peerId: string; from: PathKind; to: PathKind}>;
2926
+ Readonly<{connectId: bigint; peerId: string; from: PathKind; to: PathKind; oldConnId: bigint; newConnId: bigint}>;
2792
2927
  constructor(
2793
- inner: {connectId: bigint; peerId: string; from: PathKind; to: PathKind }) {
2928
+ inner: {connectId: bigint; peerId: string; from: PathKind; to: PathKind; oldConnId: bigint; newConnId: bigint }) {
2794
2929
  super("P2pEvent", "PathUpgraded");
2795
2930
 
2796
2931
  this.inner = Object.freeze(inner);
2797
2932
  }
2798
2933
  static new(
2799
- inner: {connectId: bigint; peerId: string; from: PathKind; to: PathKind }): PathUpgraded_ {
2934
+ inner: {connectId: bigint; peerId: string; from: PathKind; to: PathKind; oldConnId: bigint; newConnId: bigint }): PathUpgraded_ {
2800
2935
  return new PathUpgraded_(inner);
2801
2936
  }
2802
2937
 
@@ -2812,7 +2947,8 @@ inner: {connectId: bigint; peerId: string; from: PathKind; to: PathKind }): Path
2812
2947
  Readonly<{connectId: bigint; attempt: number; reason: string}>
2813
2948
  };
2814
2949
  /**
2815
- * One hole-punch window failed.
2950
+ * One DCUtR hole-punch round failed; the relay holder may start the
2951
+ * next one.
2816
2952
  */
2817
2953
  class HolePunchFailed_ extends UniffiEnum implements HolePunchFailed__interface {
2818
2954
  /**
@@ -2912,7 +3048,7 @@ inner: {connectId: bigint; peerId: string }): ConnectCancelled_ {
2912
3048
  type InboundDirectUpgrade__interface = {
2913
3049
  tag: P2pEvent_Tags.InboundDirectUpgrade;
2914
3050
  inner:
2915
- Readonly<{peerId: string}>
3051
+ Readonly<{peerId: string; oldConnId: bigint; newConnId: bigint}>
2916
3052
  };
2917
3053
  /**
2918
3054
  * An inbound circuit upgraded to a direct connection.
@@ -2925,15 +3061,15 @@ Readonly<{peerId: string}>
2925
3061
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2926
3062
  readonly tag = P2pEvent_Tags.InboundDirectUpgrade;
2927
3063
  readonly inner:
2928
- Readonly<{peerId: string}>;
3064
+ Readonly<{peerId: string; oldConnId: bigint; newConnId: bigint}>;
2929
3065
  constructor(
2930
- inner: {peerId: string }) {
3066
+ inner: {peerId: string; oldConnId: bigint; newConnId: bigint }) {
2931
3067
  super("P2pEvent", "InboundDirectUpgrade");
2932
3068
 
2933
3069
  this.inner = Object.freeze(inner);
2934
3070
  }
2935
3071
  static new(
2936
- inner: {peerId: string }): InboundDirectUpgrade_ {
3072
+ inner: {peerId: string; oldConnId: bigint; newConnId: bigint }): InboundDirectUpgrade_ {
2937
3073
  return new InboundDirectUpgrade_(inner);
2938
3074
  }
2939
3075
 
@@ -3253,6 +3389,70 @@ inner: {peerId: string; reason: string }): DiscoveryDialFailed_ {
3253
3389
 
3254
3390
  }
3255
3391
 
3392
+ type MdnsFailed__interface = {
3393
+ tag: P2pEvent_Tags.MdnsFailed;
3394
+ inner:
3395
+ Readonly<{kind: MdnsFailureKind; detail: string}>
3396
+ };
3397
+ /**
3398
+ * mDNS hit a hard failure. mDNS keeps running and retries; reported
3399
+ * once per change in failure state, and followed by `MdnsRecovered`
3400
+ * once a retry succeeds. A goodbye that failed during shutdown is
3401
+ * final.
3402
+ */
3403
+ class MdnsFailed_ extends UniffiEnum implements MdnsFailed__interface {
3404
+ /**
3405
+ * @private
3406
+ * This field is private and should not be used, use `tag` instead.
3407
+ */
3408
+ readonly [uniffiTypeNameSymbol] = "P2pEvent";
3409
+ readonly tag = P2pEvent_Tags.MdnsFailed;
3410
+ readonly inner:
3411
+ Readonly<{kind: MdnsFailureKind; detail: string}>;
3412
+ constructor(
3413
+ inner: {kind: MdnsFailureKind; detail: string }) {
3414
+ super("P2pEvent", "MdnsFailed");
3415
+
3416
+ this.inner = Object.freeze(inner);
3417
+ }
3418
+ static new(
3419
+ inner: {kind: MdnsFailureKind; detail: string }): MdnsFailed_ {
3420
+ return new MdnsFailed_(inner);
3421
+ }
3422
+
3423
+ static instanceOf(obj: any): obj is MdnsFailed_ {
3424
+ return obj.tag === P2pEvent_Tags.MdnsFailed;
3425
+ }
3426
+
3427
+ }
3428
+
3429
+ type MdnsRecovered__interface = {
3430
+ tag: P2pEvent_Tags.MdnsRecovered
3431
+ };
3432
+ /**
3433
+ * mDNS recovered from its last `MdnsFailed`.
3434
+ */
3435
+ class MdnsRecovered_ extends UniffiEnum implements MdnsRecovered__interface {
3436
+ /**
3437
+ * @private
3438
+ * This field is private and should not be used, use `tag` instead.
3439
+ */
3440
+ readonly [uniffiTypeNameSymbol] = "P2pEvent";
3441
+ readonly tag = P2pEvent_Tags.MdnsRecovered;
3442
+ constructor() {
3443
+ super("P2pEvent", "MdnsRecovered");
3444
+ }
3445
+
3446
+ static new(): MdnsRecovered_ {
3447
+ return new MdnsRecovered_();
3448
+ }
3449
+
3450
+ static instanceOf(obj: any): obj is MdnsRecovered_ {
3451
+ return obj.tag === P2pEvent_Tags.MdnsRecovered;
3452
+ }
3453
+
3454
+ }
3455
+
3256
3456
  type DiscoveryProtocolViolation__interface = {
3257
3457
  tag: P2pEvent_Tags.DiscoveryProtocolViolation;
3258
3458
  inner:
@@ -3329,6 +3529,8 @@ inner: {peerId?: string; source: DiscoverySource; reason: string; suppressed: nu
3329
3529
  PeerUpdated: PeerUpdated_,
3330
3530
  PeerExpired: PeerExpired_,
3331
3531
  DiscoveryDialFailed: DiscoveryDialFailed_,
3532
+ MdnsFailed: MdnsFailed_,
3533
+ MdnsRecovered: MdnsRecovered_,
3332
3534
  DiscoveryProtocolViolation: DiscoveryProtocolViolation_
3333
3535
  });
3334
3536
 
@@ -3337,7 +3539,7 @@ inner: {peerId?: string; source: DiscoverySource; reason: string; suppressed: nu
3337
3539
  * Event delivered by the native endpoint driver.
3338
3540
  */
3339
3541
  export type P2pEvent = InstanceType<
3340
- typeof P2pEvent['EventsDropped' | 'DriverFailed' | 'ConnectionEstablished' | 'ConnectionClosed' | 'ConnectionReplaced' | 'PeerReady' | 'IdentifyReceived' | 'PingRttMeasured' | 'PingTimeout' | 'StreamReady' | 'StreamData' | 'StreamWriteAccepted' | 'StreamWriteStopped' | 'StreamRemoteWriteClosed' | 'StreamClosed' | 'EndpointError' | 'ReachabilityChanged' | 'PublicAddressesChanged' | 'RelayReserved' | 'RelayReservationLost' | 'PathEstablished' | 'InboundPathEstablished' | 'PathUpgraded' | 'HolePunchFailed' | 'ConnectFailed' | 'ConnectCancelled' | 'InboundDirectUpgrade' | 'Message' | 'PeerSubscribed' | 'PeerUnsubscribed' | 'GossipsubOutboundFailure' | 'GossipsubProtocolViolation' | 'PeerDiscovered' | 'PeerUpdated' | 'PeerExpired' | 'DiscoveryDialFailed' | 'DiscoveryProtocolViolation']
3542
+ typeof P2pEvent['EventsDropped' | 'DriverFailed' | 'ConnectionEstablished' | 'ConnectionClosed' | 'ConnectionReplaced' | 'PeerReady' | 'IdentifyReceived' | 'PingRttMeasured' | 'PingTimeout' | 'StreamReady' | 'StreamData' | 'StreamWriteAccepted' | 'StreamWriteStopped' | 'StreamRemoteWriteClosed' | 'StreamClosed' | 'EndpointError' | 'ReachabilityChanged' | 'PublicAddressesChanged' | 'RelayReserved' | 'RelayReservationLost' | 'PathEstablished' | 'InboundPathEstablished' | 'PathUpgraded' | 'HolePunchFailed' | 'ConnectFailed' | 'ConnectCancelled' | 'InboundDirectUpgrade' | 'Message' | 'PeerSubscribed' | 'PeerUnsubscribed' | 'GossipsubOutboundFailure' | 'GossipsubProtocolViolation' | 'PeerDiscovered' | 'PeerUpdated' | 'PeerExpired' | 'DiscoveryDialFailed' | 'MdnsFailed' | 'MdnsRecovered' | 'DiscoveryProtocolViolation']
3341
3543
  >;
3342
3544
 
3343
3545
  // FfiConverter for enum P2pEvent
@@ -3352,9 +3554,9 @@ const FfiConverterTypeP2pEvent = (() => {
3352
3554
  case 4: return new P2pEvent.ConnectionClosed({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3353
3555
  case 5: return new P2pEvent.ConnectionReplaced({peerId: FfiConverterString.readFromCursor(c), oldConnId: FfiConverterUInt64.readFromCursor(c), newConnId: FfiConverterUInt64.readFromCursor(c) });
3354
3556
  case 6: return new P2pEvent.PeerReady({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), protocols: FfiConverterSequenceString.readFromCursor(c) });
3355
- case 7: return new P2pEvent.IdentifyReceived({peerId: FfiConverterString.readFromCursor(c), info: FfiConverterTypeIdentifyInfo.readFromCursor(c) });
3356
- case 8: return new P2pEvent.PingRttMeasured({peerId: FfiConverterString.readFromCursor(c), rttMs: FfiConverterUInt64.readFromCursor(c) });
3357
- case 9: return new P2pEvent.PingTimeout({peerId: FfiConverterString.readFromCursor(c) });
3557
+ case 7: return new P2pEvent.IdentifyReceived({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), info: FfiConverterTypeIdentifyInfo.readFromCursor(c) });
3558
+ case 8: return new P2pEvent.PingRttMeasured({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), rttMs: FfiConverterUInt64.readFromCursor(c) });
3559
+ case 9: return new P2pEvent.PingTimeout({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3358
3560
  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) });
3359
3561
  case 11: return new P2pEvent.StreamData({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c), data: FfiConverterArrayBuffer.readFromCursor(c) });
3360
3562
  case 12: return new P2pEvent.StreamWriteAccepted({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c) });
@@ -3367,12 +3569,12 @@ const FfiConverterTypeP2pEvent = (() => {
3367
3569
  case 19: return new P2pEvent.RelayReserved({relayPeerId: FfiConverterString.readFromCursor(c), expiresUnixSecs: FfiConverterOptionalUInt64.readFromCursor(c) });
3368
3570
  case 20: return new P2pEvent.RelayReservationLost({relayPeerId: FfiConverterString.readFromCursor(c) });
3369
3571
  case 21: return new P2pEvent.PathEstablished({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c) });
3370
- case 22: return new P2pEvent.InboundPathEstablished({peerId: FfiConverterString.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c) });
3371
- case 23: return new P2pEvent.PathUpgraded({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), from: FfiConverterTypePathKind.readFromCursor(c), to: FfiConverterTypePathKind.readFromCursor(c) });
3572
+ case 22: return new P2pEvent.InboundPathEstablished({peerId: FfiConverterString.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3573
+ 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) });
3372
3574
  case 24: return new P2pEvent.HolePunchFailed({connectId: FfiConverterUInt64.readFromCursor(c), attempt: FfiConverterUInt32.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3373
3575
  case 25: return new P2pEvent.ConnectFailed({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), kind: FfiConverterTypeNatErrorKind.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
3374
3576
  case 26: return new P2pEvent.ConnectCancelled({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c) });
3375
- case 27: return new P2pEvent.InboundDirectUpgrade({peerId: FfiConverterString.readFromCursor(c) });
3577
+ case 27: return new P2pEvent.InboundDirectUpgrade({peerId: FfiConverterString.readFromCursor(c), oldConnId: FfiConverterUInt64.readFromCursor(c), newConnId: FfiConverterUInt64.readFromCursor(c) });
3376
3578
  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) });
3377
3579
  case 29: return new P2pEvent.PeerSubscribed({peerId: FfiConverterString.readFromCursor(c), topic: FfiConverterString.readFromCursor(c) });
3378
3580
  case 30: return new P2pEvent.PeerUnsubscribed({peerId: FfiConverterString.readFromCursor(c), topic: FfiConverterString.readFromCursor(c) });
@@ -3382,7 +3584,9 @@ const FfiConverterTypeP2pEvent = (() => {
3382
3584
  case 34: return new P2pEvent.PeerUpdated({peerId: FfiConverterString.readFromCursor(c), addrs: FfiConverterSequenceString.readFromCursor(c), source: FfiConverterTypeDiscoverySource.readFromCursor(c) });
3383
3585
  case 35: return new P2pEvent.PeerExpired({peerId: FfiConverterString.readFromCursor(c) });
3384
3586
  case 36: return new P2pEvent.DiscoveryDialFailed({peerId: FfiConverterString.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3385
- case 37: return new P2pEvent.DiscoveryProtocolViolation({peerId: FfiConverterOptionalString.readFromCursor(c), source: FfiConverterTypeDiscoverySource.readFromCursor(c), reason: FfiConverterString.readFromCursor(c), suppressed: FfiConverterUInt32.readFromCursor(c) });
3587
+ case 37: return new P2pEvent.MdnsFailed({kind: FfiConverterTypeMdnsFailureKind.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
3588
+ case 38: return new P2pEvent.MdnsRecovered();
3589
+ case 39: return new P2pEvent.DiscoveryProtocolViolation({peerId: FfiConverterOptionalString.readFromCursor(c), source: FfiConverterTypeDiscoverySource.readFromCursor(c), reason: FfiConverterString.readFromCursor(c), suppressed: FfiConverterUInt32.readFromCursor(c) });
3386
3590
  default: throw new UniffiInternalError.UnexpectedEnumCase();
3387
3591
  }
3388
3592
  }
@@ -3437,6 +3641,7 @@ const FfiConverterTypeP2pEvent = (() => {
3437
3641
  c.writeI32(7);
3438
3642
  const inner = value.inner;
3439
3643
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3644
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3440
3645
  FfiConverterTypeIdentifyInfo.writeIntoCursor(inner.info, c);
3441
3646
  return;
3442
3647
  }
@@ -3444,6 +3649,7 @@ const FfiConverterTypeP2pEvent = (() => {
3444
3649
  c.writeI32(8);
3445
3650
  const inner = value.inner;
3446
3651
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3652
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3447
3653
  FfiConverterUInt64.writeIntoCursor(inner.rttMs, c);
3448
3654
  return;
3449
3655
  }
@@ -3451,6 +3657,7 @@ const FfiConverterTypeP2pEvent = (() => {
3451
3657
  c.writeI32(9);
3452
3658
  const inner = value.inner;
3453
3659
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3660
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3454
3661
  return;
3455
3662
  }
3456
3663
  case P2pEvent_Tags.StreamReady: {
@@ -3556,6 +3763,7 @@ const FfiConverterTypeP2pEvent = (() => {
3556
3763
  const inner = value.inner;
3557
3764
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3558
3765
  FfiConverterTypePathKind.writeIntoCursor(inner.path, c);
3766
+ FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3559
3767
  return;
3560
3768
  }
3561
3769
  case P2pEvent_Tags.PathUpgraded: {
@@ -3565,6 +3773,8 @@ const FfiConverterTypeP2pEvent = (() => {
3565
3773
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3566
3774
  FfiConverterTypePathKind.writeIntoCursor(inner.from, c);
3567
3775
  FfiConverterTypePathKind.writeIntoCursor(inner.to, c);
3776
+ FfiConverterUInt64.writeIntoCursor(inner.oldConnId, c);
3777
+ FfiConverterUInt64.writeIntoCursor(inner.newConnId, c);
3568
3778
  return;
3569
3779
  }
3570
3780
  case P2pEvent_Tags.HolePunchFailed: {
@@ -3595,6 +3805,8 @@ const FfiConverterTypeP2pEvent = (() => {
3595
3805
  c.writeI32(27);
3596
3806
  const inner = value.inner;
3597
3807
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3808
+ FfiConverterUInt64.writeIntoCursor(inner.oldConnId, c);
3809
+ FfiConverterUInt64.writeIntoCursor(inner.newConnId, c);
3598
3810
  return;
3599
3811
  }
3600
3812
  case P2pEvent_Tags.Message: {
@@ -3664,9 +3876,20 @@ const FfiConverterTypeP2pEvent = (() => {
3664
3876
  FfiConverterString.writeIntoCursor(inner.reason, c);
3665
3877
  return;
3666
3878
  }
3667
- case P2pEvent_Tags.DiscoveryProtocolViolation: {
3879
+ case P2pEvent_Tags.MdnsFailed: {
3668
3880
  c.writeI32(37);
3669
3881
  const inner = value.inner;
3882
+ FfiConverterTypeMdnsFailureKind.writeIntoCursor(inner.kind, c);
3883
+ FfiConverterString.writeIntoCursor(inner.detail, c);
3884
+ return;
3885
+ }
3886
+ case P2pEvent_Tags.MdnsRecovered: {
3887
+ c.writeI32(38);
3888
+ return;
3889
+ }
3890
+ case P2pEvent_Tags.DiscoveryProtocolViolation: {
3891
+ c.writeI32(39);
3892
+ const inner = value.inner;
3670
3893
  FfiConverterOptionalString.writeIntoCursor(inner.peerId, c);
3671
3894
  FfiConverterTypeDiscoverySource.writeIntoCursor(inner.source, c);
3672
3895
  FfiConverterString.writeIntoCursor(inner.reason, c);
@@ -3729,6 +3952,7 @@ const FfiConverterTypeP2pEvent = (() => {
3729
3952
  const inner = value.inner;
3730
3953
  let size = 4;
3731
3954
  size += FfiConverterString.allocationSize(inner.peerId);
3955
+ size += FfiConverterUInt64.allocationSize(inner.connId);
3732
3956
  size += FfiConverterTypeIdentifyInfo.allocationSize(inner.info);
3733
3957
  return size;
3734
3958
  }
@@ -3736,6 +3960,7 @@ const FfiConverterTypeP2pEvent = (() => {
3736
3960
  const inner = value.inner;
3737
3961
  let size = 4;
3738
3962
  size += FfiConverterString.allocationSize(inner.peerId);
3963
+ size += FfiConverterUInt64.allocationSize(inner.connId);
3739
3964
  size += FfiConverterUInt64.allocationSize(inner.rttMs);
3740
3965
  return size;
3741
3966
  }
@@ -3743,6 +3968,7 @@ const FfiConverterTypeP2pEvent = (() => {
3743
3968
  const inner = value.inner;
3744
3969
  let size = 4;
3745
3970
  size += FfiConverterString.allocationSize(inner.peerId);
3971
+ size += FfiConverterUInt64.allocationSize(inner.connId);
3746
3972
  return size;
3747
3973
  }
3748
3974
  case P2pEvent_Tags.StreamReady: {
@@ -3848,6 +4074,7 @@ const FfiConverterTypeP2pEvent = (() => {
3848
4074
  let size = 4;
3849
4075
  size += FfiConverterString.allocationSize(inner.peerId);
3850
4076
  size += FfiConverterTypePathKind.allocationSize(inner.path);
4077
+ size += FfiConverterUInt64.allocationSize(inner.connId);
3851
4078
  return size;
3852
4079
  }
3853
4080
  case P2pEvent_Tags.PathUpgraded: {
@@ -3857,6 +4084,8 @@ const FfiConverterTypeP2pEvent = (() => {
3857
4084
  size += FfiConverterString.allocationSize(inner.peerId);
3858
4085
  size += FfiConverterTypePathKind.allocationSize(inner.from);
3859
4086
  size += FfiConverterTypePathKind.allocationSize(inner.to);
4087
+ size += FfiConverterUInt64.allocationSize(inner.oldConnId);
4088
+ size += FfiConverterUInt64.allocationSize(inner.newConnId);
3860
4089
  return size;
3861
4090
  }
3862
4091
  case P2pEvent_Tags.HolePunchFailed: {
@@ -3887,6 +4116,8 @@ const FfiConverterTypeP2pEvent = (() => {
3887
4116
  const inner = value.inner;
3888
4117
  let size = 4;
3889
4118
  size += FfiConverterString.allocationSize(inner.peerId);
4119
+ size += FfiConverterUInt64.allocationSize(inner.oldConnId);
4120
+ size += FfiConverterUInt64.allocationSize(inner.newConnId);
3890
4121
  return size;
3891
4122
  }
3892
4123
  case P2pEvent_Tags.Message: {
@@ -3956,6 +4187,16 @@ const FfiConverterTypeP2pEvent = (() => {
3956
4187
  size += FfiConverterString.allocationSize(inner.reason);
3957
4188
  return size;
3958
4189
  }
4190
+ case P2pEvent_Tags.MdnsFailed: {
4191
+ const inner = value.inner;
4192
+ let size = 4;
4193
+ size += FfiConverterTypeMdnsFailureKind.allocationSize(inner.kind);
4194
+ size += FfiConverterString.allocationSize(inner.detail);
4195
+ return size;
4196
+ }
4197
+ case P2pEvent_Tags.MdnsRecovered: {
4198
+ return 4;
4199
+ }
3959
4200
  case P2pEvent_Tags.DiscoveryProtocolViolation: {
3960
4201
  const inner = value.inner;
3961
4202
  let size = 4;
@@ -4021,6 +4262,7 @@ function uniffiEnsureInitialized() {
4021
4262
  export default Object.freeze({
4022
4263
  initialize: uniffiEnsureInitialized,
4023
4264
  converters: {
4265
+ FfiConverterTypeConfigCapability,
4024
4266
  FfiConverterTypeConnectTarget,
4025
4267
  FfiConverterTypeConnectionInfo,
4026
4268
  FfiConverterTypeDiscoveryOptions,
@@ -4031,6 +4273,7 @@ export default Object.freeze({
4031
4273
  FfiConverterTypeFfiError,
4032
4274
  FfiConverterTypeIdentifyInfo,
4033
4275
  FfiConverterTypeKnownPeerInfo,
4276
+ FfiConverterTypeMdnsFailureKind,
4034
4277
  FfiConverterTypeMdnsOptions,
4035
4278
  FfiConverterTypeNatErrorKind,
4036
4279
  FfiConverterTypeOpenStreamResult,