@minip2p/react-native 0.8.3 → 0.10.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.
Files changed (27) hide show
  1. package/android/src/main/jniLibs/arm64-v8a/libminip2p_ffi.so +0 -0
  2. package/android/src/main/jniLibs/x86_64/libminip2p_ffi.so +0 -0
  3. package/build/Minip2pFfi.xcframework/Info.plist +4 -4
  4. package/build/Minip2pFfi.xcframework/ios-arm64/libminip2p_ffi.a +2 -2
  5. package/build/Minip2pFfi.xcframework/ios-arm64-simulator/libminip2p_ffi.a +2 -2
  6. package/cpp/generated/minip2p_ffi.cpp +3 -2
  7. package/lib/module/adapter.js +124 -25
  8. package/lib/module/adapter.js.map +1 -1
  9. package/lib/module/generated/minip2p_ffi.js +15 -10
  10. package/lib/module/generated/minip2p_ffi.js.map +1 -1
  11. package/lib/module/generated/minip2p_ffi_core.js +908 -293
  12. package/lib/module/generated/minip2p_ffi_core.js.map +1 -1
  13. package/lib/typescript/src/adapter.d.ts.map +1 -1
  14. package/lib/typescript/src/generated/minip2p_ffi-ffi.d.ts +1 -1
  15. package/lib/typescript/src/generated/minip2p_ffi-ffi.d.ts.map +1 -1
  16. package/lib/typescript/src/generated/minip2p_ffi.d.ts +20 -10
  17. package/lib/typescript/src/generated/minip2p_ffi.d.ts.map +1 -1
  18. package/lib/typescript/src/generated/minip2p_ffi_core.d.ts +572 -119
  19. package/lib/typescript/src/generated/minip2p_ffi_core.d.ts.map +1 -1
  20. package/lib/typescript/src/hook-lifecycle.d.ts +2 -2
  21. package/lib/typescript/src/hook-lifecycle.d.ts.map +1 -1
  22. package/package.json +2 -2
  23. package/src/adapter.ts +142 -40
  24. package/src/generated/minip2p_ffi-ffi.ts +1 -1
  25. package/src/generated/minip2p_ffi.ts +25 -14
  26. package/src/generated/minip2p_ffi_core.ts +1015 -355
  27. package/src/hook-lifecycle.ts +2 -2
@@ -1,21 +1,137 @@
1
1
  import { type UniffiByteArray, Cursor, uniffiTypeNameSymbol } from "@ubjs/core";
2
+ export declare enum PathKind_Tags {
3
+ Direct = "Direct",
4
+ Punched = "Punched",
5
+ Relayed = "Relayed"
6
+ }
7
+ /**
8
+ * How an established connection was made; see `minip2p::Path`.
9
+ */
10
+ export declare const PathKind: Readonly<{
11
+ instanceOf: (obj: any) => obj is PathKind;
12
+ Direct: {
13
+ new (): {
14
+ /**
15
+ * @private
16
+ * This field is private and should not be used, use `tag` instead.
17
+ */
18
+ readonly [uniffiTypeNameSymbol]: "PathKind";
19
+ readonly tag: PathKind_Tags.Direct;
20
+ };
21
+ "new"(): {
22
+ /**
23
+ * @private
24
+ * This field is private and should not be used, use `tag` instead.
25
+ */
26
+ readonly [uniffiTypeNameSymbol]: "PathKind";
27
+ readonly tag: PathKind_Tags.Direct;
28
+ };
29
+ instanceOf(obj: any): obj is {
30
+ /**
31
+ * @private
32
+ * This field is private and should not be used, use `tag` instead.
33
+ */
34
+ readonly [uniffiTypeNameSymbol]: "PathKind";
35
+ readonly tag: PathKind_Tags.Direct;
36
+ };
37
+ };
38
+ Punched: {
39
+ new (): {
40
+ /**
41
+ * @private
42
+ * This field is private and should not be used, use `tag` instead.
43
+ */
44
+ readonly [uniffiTypeNameSymbol]: "PathKind";
45
+ readonly tag: PathKind_Tags.Punched;
46
+ };
47
+ "new"(): {
48
+ /**
49
+ * @private
50
+ * This field is private and should not be used, use `tag` instead.
51
+ */
52
+ readonly [uniffiTypeNameSymbol]: "PathKind";
53
+ readonly tag: PathKind_Tags.Punched;
54
+ };
55
+ instanceOf(obj: any): obj is {
56
+ /**
57
+ * @private
58
+ * This field is private and should not be used, use `tag` instead.
59
+ */
60
+ readonly [uniffiTypeNameSymbol]: "PathKind";
61
+ readonly tag: PathKind_Tags.Punched;
62
+ };
63
+ };
64
+ Relayed: {
65
+ new (inner: {
66
+ relayPeerId: string;
67
+ }): {
68
+ /**
69
+ * @private
70
+ * This field is private and should not be used, use `tag` instead.
71
+ */
72
+ readonly [uniffiTypeNameSymbol]: "PathKind";
73
+ readonly tag: PathKind_Tags.Relayed;
74
+ readonly inner: Readonly<{
75
+ relayPeerId: string;
76
+ }>;
77
+ };
78
+ "new"(inner: {
79
+ relayPeerId: string;
80
+ }): {
81
+ /**
82
+ * @private
83
+ * This field is private and should not be used, use `tag` instead.
84
+ */
85
+ readonly [uniffiTypeNameSymbol]: "PathKind";
86
+ readonly tag: PathKind_Tags.Relayed;
87
+ readonly inner: Readonly<{
88
+ relayPeerId: string;
89
+ }>;
90
+ };
91
+ instanceOf(obj: any): obj is {
92
+ /**
93
+ * @private
94
+ * This field is private and should not be used, use `tag` instead.
95
+ */
96
+ readonly [uniffiTypeNameSymbol]: "PathKind";
97
+ readonly tag: PathKind_Tags.Relayed;
98
+ readonly inner: Readonly<{
99
+ relayPeerId: string;
100
+ }>;
101
+ };
102
+ };
103
+ }>;
2
104
  /**
3
- * State snapshot of the transport connection selected for a peer.
105
+ * How an established connection was made; see `minip2p::Path`.
106
+ */
107
+ export type PathKind = InstanceType<typeof PathKind['Direct' | 'Punched' | 'Relayed']>;
108
+ /**
109
+ * State snapshot of a peer's established connection; see
110
+ * `minip2p::ConnectionInfo`.
4
111
  */
5
112
  export type ConnectionInfo = {
113
+ /**
114
+ * The peer on the other end.
115
+ */
116
+ peerId: string;
6
117
  /**
7
118
  * Endpoint-local transport connection id.
8
119
  */
9
120
  connId: bigint;
10
121
  /**
11
- * Remote transport address, when recorded.
122
+ * Remote transport address the transport reported; a circuit reports
123
+ * `/p2p/<relay>/p2p-circuit`.
124
+ */
125
+ remoteAddr: string;
126
+ /**
127
+ * How the connection was made.
12
128
  */
13
- remoteAddr?: string;
129
+ path: PathKind;
14
130
  /**
15
131
  * Protocols this connection advertised through Identify, once it is
16
- * ready (`PeerReady` for this `conn_id`); `None` until then. Readiness,
17
- * connection and protocols come from one snapshot, so a ready wait can
18
- * trust them together.
132
+ * ready (`PeerReady` for this `conn_id`); `None` until then, distinct
133
+ * from an empty list. Readiness, connection and protocols come from one
134
+ * snapshot, so a ready wait can trust them together.
19
135
  */
20
136
  readyProtocols?: Array<string>;
21
137
  };
@@ -23,8 +139,8 @@ export type ConnectionInfo = {
23
139
  * Generated factory for {@link ConnectionInfo} record objects.
24
140
  */
25
141
  export declare const ConnectionInfo: Readonly<{
26
- create: (partial: Partial<ConnectionInfo> & Required<Omit<ConnectionInfo, "readyProtocols" | "remoteAddr">>) => ConnectionInfo;
27
- new: (partial: Partial<ConnectionInfo> & Required<Omit<ConnectionInfo, "readyProtocols" | "remoteAddr">>) => ConnectionInfo;
142
+ create: (partial: Partial<ConnectionInfo> & Required<Omit<ConnectionInfo, "readyProtocols">>) => ConnectionInfo;
143
+ new: (partial: Partial<ConnectionInfo> & Required<Omit<ConnectionInfo, "readyProtocols">>) => ConnectionInfo;
28
144
  defaults: () => Partial<ConnectionInfo>;
29
145
  }>;
30
146
  /**
@@ -270,6 +386,77 @@ export declare const RelayReservationInfo: Readonly<{
270
386
  new: (partial: Partial<RelayReservationInfo> & Required<Omit<RelayReservationInfo, "expiresUnixSecs">>) => RelayReservationInfo;
271
387
  defaults: () => Partial<RelayReservationInfo>;
272
388
  }>;
389
+ /**
390
+ * A connection still tracked when the closing drain ended.
391
+ */
392
+ export type UnfinishedConnection = {
393
+ /**
394
+ * Endpoint-local transport connection id.
395
+ */
396
+ connId: bigint;
397
+ /**
398
+ * Remote peer; `None` for an inbound handshake that had not identified
399
+ * one yet.
400
+ */
401
+ peerId?: string;
402
+ };
403
+ /**
404
+ * Generated factory for {@link UnfinishedConnection} record objects.
405
+ */
406
+ export declare const UnfinishedConnection: Readonly<{
407
+ create: (partial: Partial<UnfinishedConnection> & Required<Omit<UnfinishedConnection, "peerId">>) => UnfinishedConnection;
408
+ new: (partial: Partial<UnfinishedConnection> & Required<Omit<UnfinishedConnection, "peerId">>) => UnfinishedConnection;
409
+ defaults: () => Partial<UnfinishedConnection>;
410
+ }>;
411
+ /**
412
+ * How the driver's closing drain ended; see [`P2pEvent::EndpointClosed`].
413
+ */
414
+ export declare enum CloseOutcome {
415
+ /**
416
+ * Every tracked connection finished its teardown in time.
417
+ */
418
+ Drained = 0,
419
+ /**
420
+ * The stop deadline passed with connections still tracked.
421
+ */
422
+ DeadlineExpired = 1,
423
+ /**
424
+ * Driving the transports failed and ended the drain early, or the
425
+ * driver panicked and dropped the endpoint without a drain.
426
+ */
427
+ Failed = 2
428
+ }
429
+ /**
430
+ * The part of an endpoint's configuration an [`FfiError::InvalidConfig`]
431
+ * names.
432
+ *
433
+ * A configuration mistake is fixed by changing that part; an environment
434
+ * failure (a socket the platform refused) is [`FfiError::Transport`]
435
+ * instead.
436
+ */
437
+ export declare enum ConfigCapability {
438
+ /**
439
+ * Gossipsub settings.
440
+ */
441
+ Gossipsub = 0,
442
+ /**
443
+ * mDNS settings.
444
+ */
445
+ Mdns = 1,
446
+ /**
447
+ * Signed discovery or peer-book settings.
448
+ */
449
+ Discovery = 2,
450
+ /**
451
+ * QUIC or TCP transport settings (limits, TLS, the TCP namespace).
452
+ */
453
+ Transport = 3,
454
+ /**
455
+ * The endpoint's own options: listen addresses, protocols, NAT and
456
+ * relay policy, auto-dial.
457
+ */
458
+ Options = 4
459
+ }
273
460
  export declare enum ConnectTarget_Tags {
274
461
  Peer = "Peer",
275
462
  Addresses = "Addresses"
@@ -368,6 +555,179 @@ export declare const ConnectTarget: Readonly<{
368
555
  * adapt the shape to their toolchain.
369
556
  */
370
557
  export type ConnectTarget = InstanceType<typeof ConnectTarget['Peer' | 'Addresses']>;
558
+ export declare enum ConnectionCloseReason_Tags {
559
+ Local = "Local",
560
+ Remote = "Remote",
561
+ TimedOut = "TimedOut",
562
+ Stalled = "Stalled",
563
+ Error = "Error"
564
+ }
565
+ /**
566
+ * Why one connection ended; see `minip2p::ConnectionCloseReason`.
567
+ */
568
+ export declare const ConnectionCloseReason: Readonly<{
569
+ instanceOf: (obj: any) => obj is ConnectionCloseReason;
570
+ Local: {
571
+ new (): {
572
+ /**
573
+ * @private
574
+ * This field is private and should not be used, use `tag` instead.
575
+ */
576
+ readonly [uniffiTypeNameSymbol]: "ConnectionCloseReason";
577
+ readonly tag: ConnectionCloseReason_Tags.Local;
578
+ };
579
+ "new"(): {
580
+ /**
581
+ * @private
582
+ * This field is private and should not be used, use `tag` instead.
583
+ */
584
+ readonly [uniffiTypeNameSymbol]: "ConnectionCloseReason";
585
+ readonly tag: ConnectionCloseReason_Tags.Local;
586
+ };
587
+ instanceOf(obj: any): obj is {
588
+ /**
589
+ * @private
590
+ * This field is private and should not be used, use `tag` instead.
591
+ */
592
+ readonly [uniffiTypeNameSymbol]: "ConnectionCloseReason";
593
+ readonly tag: ConnectionCloseReason_Tags.Local;
594
+ };
595
+ };
596
+ Remote: {
597
+ new (inner: {
598
+ code: bigint;
599
+ }): {
600
+ /**
601
+ * @private
602
+ * This field is private and should not be used, use `tag` instead.
603
+ */
604
+ readonly [uniffiTypeNameSymbol]: "ConnectionCloseReason";
605
+ readonly tag: ConnectionCloseReason_Tags.Remote;
606
+ readonly inner: Readonly<{
607
+ code: bigint;
608
+ }>;
609
+ };
610
+ "new"(inner: {
611
+ code: bigint;
612
+ }): {
613
+ /**
614
+ * @private
615
+ * This field is private and should not be used, use `tag` instead.
616
+ */
617
+ readonly [uniffiTypeNameSymbol]: "ConnectionCloseReason";
618
+ readonly tag: ConnectionCloseReason_Tags.Remote;
619
+ readonly inner: Readonly<{
620
+ code: bigint;
621
+ }>;
622
+ };
623
+ instanceOf(obj: any): obj is {
624
+ /**
625
+ * @private
626
+ * This field is private and should not be used, use `tag` instead.
627
+ */
628
+ readonly [uniffiTypeNameSymbol]: "ConnectionCloseReason";
629
+ readonly tag: ConnectionCloseReason_Tags.Remote;
630
+ readonly inner: Readonly<{
631
+ code: bigint;
632
+ }>;
633
+ };
634
+ };
635
+ TimedOut: {
636
+ new (): {
637
+ /**
638
+ * @private
639
+ * This field is private and should not be used, use `tag` instead.
640
+ */
641
+ readonly [uniffiTypeNameSymbol]: "ConnectionCloseReason";
642
+ readonly tag: ConnectionCloseReason_Tags.TimedOut;
643
+ };
644
+ "new"(): {
645
+ /**
646
+ * @private
647
+ * This field is private and should not be used, use `tag` instead.
648
+ */
649
+ readonly [uniffiTypeNameSymbol]: "ConnectionCloseReason";
650
+ readonly tag: ConnectionCloseReason_Tags.TimedOut;
651
+ };
652
+ instanceOf(obj: any): obj is {
653
+ /**
654
+ * @private
655
+ * This field is private and should not be used, use `tag` instead.
656
+ */
657
+ readonly [uniffiTypeNameSymbol]: "ConnectionCloseReason";
658
+ readonly tag: ConnectionCloseReason_Tags.TimedOut;
659
+ };
660
+ };
661
+ Stalled: {
662
+ new (): {
663
+ /**
664
+ * @private
665
+ * This field is private and should not be used, use `tag` instead.
666
+ */
667
+ readonly [uniffiTypeNameSymbol]: "ConnectionCloseReason";
668
+ readonly tag: ConnectionCloseReason_Tags.Stalled;
669
+ };
670
+ "new"(): {
671
+ /**
672
+ * @private
673
+ * This field is private and should not be used, use `tag` instead.
674
+ */
675
+ readonly [uniffiTypeNameSymbol]: "ConnectionCloseReason";
676
+ readonly tag: ConnectionCloseReason_Tags.Stalled;
677
+ };
678
+ instanceOf(obj: any): obj is {
679
+ /**
680
+ * @private
681
+ * This field is private and should not be used, use `tag` instead.
682
+ */
683
+ readonly [uniffiTypeNameSymbol]: "ConnectionCloseReason";
684
+ readonly tag: ConnectionCloseReason_Tags.Stalled;
685
+ };
686
+ };
687
+ Error: {
688
+ new (inner: {
689
+ message: string;
690
+ }): {
691
+ /**
692
+ * @private
693
+ * This field is private and should not be used, use `tag` instead.
694
+ */
695
+ readonly [uniffiTypeNameSymbol]: "ConnectionCloseReason";
696
+ readonly tag: ConnectionCloseReason_Tags.Error;
697
+ readonly inner: Readonly<{
698
+ message: string;
699
+ }>;
700
+ };
701
+ "new"(inner: {
702
+ message: string;
703
+ }): {
704
+ /**
705
+ * @private
706
+ * This field is private and should not be used, use `tag` instead.
707
+ */
708
+ readonly [uniffiTypeNameSymbol]: "ConnectionCloseReason";
709
+ readonly tag: ConnectionCloseReason_Tags.Error;
710
+ readonly inner: Readonly<{
711
+ message: string;
712
+ }>;
713
+ };
714
+ instanceOf(obj: any): obj is {
715
+ /**
716
+ * @private
717
+ * This field is private and should not be used, use `tag` instead.
718
+ */
719
+ readonly [uniffiTypeNameSymbol]: "ConnectionCloseReason";
720
+ readonly tag: ConnectionCloseReason_Tags.Error;
721
+ readonly inner: Readonly<{
722
+ message: string;
723
+ }>;
724
+ };
725
+ };
726
+ }>;
727
+ /**
728
+ * Why one connection ended; see `minip2p::ConnectionCloseReason`.
729
+ */
730
+ export type ConnectionCloseReason = InstanceType<typeof ConnectionCloseReason['Local' | 'Remote' | 'TimedOut' | 'Stalled' | 'Error']>;
371
731
  /**
372
732
  * Source that contributed a discovery observation.
373
733
  */
@@ -563,6 +923,7 @@ export declare const FfiError: Readonly<{
563
923
  };
564
924
  InvalidConfig: {
565
925
  new (inner: {
926
+ capability: ConfigCapability;
566
927
  detail: string;
567
928
  }): {
568
929
  /**
@@ -572,6 +933,7 @@ export declare const FfiError: Readonly<{
572
933
  readonly [uniffiTypeNameSymbol]: "FfiError";
573
934
  readonly tag: FfiError_Tags.InvalidConfig;
574
935
  readonly inner: Readonly<{
936
+ capability: ConfigCapability;
575
937
  detail: string;
576
938
  }>;
577
939
  name: string;
@@ -580,6 +942,7 @@ export declare const FfiError: Readonly<{
580
942
  cause?: unknown;
581
943
  };
582
944
  "new"(inner: {
945
+ capability: ConfigCapability;
583
946
  detail: string;
584
947
  }): {
585
948
  /**
@@ -589,6 +952,7 @@ export declare const FfiError: Readonly<{
589
952
  readonly [uniffiTypeNameSymbol]: "FfiError";
590
953
  readonly tag: FfiError_Tags.InvalidConfig;
591
954
  readonly inner: Readonly<{
955
+ capability: ConfigCapability;
592
956
  detail: string;
593
957
  }>;
594
958
  name: string;
@@ -604,6 +968,7 @@ export declare const FfiError: Readonly<{
604
968
  readonly [uniffiTypeNameSymbol]: "FfiError";
605
969
  readonly tag: FfiError_Tags.InvalidConfig;
606
970
  readonly inner: Readonly<{
971
+ capability: ConfigCapability;
607
972
  detail: string;
608
973
  }>;
609
974
  name: string;
@@ -619,6 +984,7 @@ export declare const FfiError: Readonly<{
619
984
  readonly [uniffiTypeNameSymbol]: "FfiError";
620
985
  readonly tag: FfiError_Tags.InvalidConfig;
621
986
  readonly inner: Readonly<{
987
+ capability: ConfigCapability;
622
988
  detail: string;
623
989
  }>;
624
990
  name: string;
@@ -634,6 +1000,7 @@ export declare const FfiError: Readonly<{
634
1000
  readonly [uniffiTypeNameSymbol]: "FfiError";
635
1001
  readonly tag: FfiError_Tags.InvalidConfig;
636
1002
  readonly inner: Readonly<{
1003
+ capability: ConfigCapability;
637
1004
  detail: string;
638
1005
  }>;
639
1006
  name: string;
@@ -641,6 +1008,7 @@ export declare const FfiError: Readonly<{
641
1008
  stack?: string;
642
1009
  cause?: unknown;
643
1010
  }): Readonly<{
1011
+ capability: ConfigCapability;
644
1012
  detail: string;
645
1013
  }>;
646
1014
  isError(error: unknown): error is Error;
@@ -1067,7 +1435,6 @@ export declare const FfiError: Readonly<{
1067
1435
  };
1068
1436
  Backpressure: {
1069
1437
  new (): {
1070
- stack?: string;
1071
1438
  /**
1072
1439
  * @private
1073
1440
  * This field is private and should not be used, use `tag` instead.
@@ -1076,10 +1443,10 @@ export declare const FfiError: Readonly<{
1076
1443
  readonly tag: FfiError_Tags.Backpressure;
1077
1444
  name: string;
1078
1445
  message: string;
1446
+ stack?: string;
1079
1447
  cause?: unknown;
1080
1448
  };
1081
1449
  "new"(): {
1082
- stack?: string;
1083
1450
  /**
1084
1451
  * @private
1085
1452
  * This field is private and should not be used, use `tag` instead.
@@ -1088,10 +1455,10 @@ export declare const FfiError: Readonly<{
1088
1455
  readonly tag: FfiError_Tags.Backpressure;
1089
1456
  name: string;
1090
1457
  message: string;
1458
+ stack?: string;
1091
1459
  cause?: unknown;
1092
1460
  };
1093
1461
  instanceOf(obj: any): obj is {
1094
- stack?: string;
1095
1462
  /**
1096
1463
  * @private
1097
1464
  * This field is private and should not be used, use `tag` instead.
@@ -1100,10 +1467,10 @@ export declare const FfiError: Readonly<{
1100
1467
  readonly tag: FfiError_Tags.Backpressure;
1101
1468
  name: string;
1102
1469
  message: string;
1470
+ stack?: string;
1103
1471
  cause?: unknown;
1104
1472
  };
1105
1473
  hasInner(obj: any): obj is {
1106
- stack?: string;
1107
1474
  /**
1108
1475
  * @private
1109
1476
  * This field is private and should not be used, use `tag` instead.
@@ -1112,6 +1479,7 @@ export declare const FfiError: Readonly<{
1112
1479
  readonly tag: FfiError_Tags.Backpressure;
1113
1480
  name: string;
1114
1481
  message: string;
1482
+ stack?: string;
1115
1483
  cause?: unknown;
1116
1484
  };
1117
1485
  isError(error: unknown): error is Error;
@@ -1424,6 +1792,40 @@ export declare const FfiError: Readonly<{
1424
1792
  * An error returned by a synchronous FFI operation.
1425
1793
  */
1426
1794
  export type FfiError = InstanceType<typeof FfiError['AlreadyStarted' | 'Stopped' | 'InvalidConfig' | 'InvalidKey' | 'InvalidPeerId' | 'InvalidAddress' | 'InvalidTopic' | 'NotPermitted' | 'Backpressure' | 'MessageTooLarge' | 'Transport' | 'InvalidState' | 'Internal']>;
1795
+ /**
1796
+ * Category of an mDNS failure.
1797
+ */
1798
+ export declare enum MdnsFailureKind {
1799
+ /**
1800
+ * The platform cannot provide mDNS sockets.
1801
+ */
1802
+ Unsupported = 0,
1803
+ /**
1804
+ * An interface has no usable address.
1805
+ */
1806
+ NoInterfaceAddress = 1,
1807
+ /**
1808
+ * A send named an interface that has gone away.
1809
+ */
1810
+ UnknownInterface = 2,
1811
+ /**
1812
+ * A goodbye could not be sent before shutdown gave up on a full send
1813
+ * buffer.
1814
+ */
1815
+ Congested = 3,
1816
+ /**
1817
+ * A datagram is larger than the carrier can ever send.
1818
+ */
1819
+ Oversized = 4,
1820
+ /**
1821
+ * The interface id space is exhausted.
1822
+ */
1823
+ InterfaceIdsExhausted = 5,
1824
+ /**
1825
+ * Platform I/O failed.
1826
+ */
1827
+ Io = 6
1828
+ }
1427
1829
  /**
1428
1830
  * Category of a failed NAT connection attempt.
1429
1831
  */
@@ -1466,115 +1868,10 @@ export declare enum Reachability {
1466
1868
  */
1467
1869
  Private = 2
1468
1870
  }
1469
- export declare enum PathKind_Tags {
1470
- DirectDialed = "DirectDialed",
1471
- DirectPunched = "DirectPunched",
1472
- Relayed = "Relayed"
1473
- }
1474
- /**
1475
- * Kind of usable connection path.
1476
- */
1477
- export declare const PathKind: Readonly<{
1478
- instanceOf: (obj: any) => obj is PathKind;
1479
- DirectDialed: {
1480
- new (): {
1481
- /**
1482
- * @private
1483
- * This field is private and should not be used, use `tag` instead.
1484
- */
1485
- readonly [uniffiTypeNameSymbol]: "PathKind";
1486
- readonly tag: PathKind_Tags.DirectDialed;
1487
- };
1488
- "new"(): {
1489
- /**
1490
- * @private
1491
- * This field is private and should not be used, use `tag` instead.
1492
- */
1493
- readonly [uniffiTypeNameSymbol]: "PathKind";
1494
- readonly tag: PathKind_Tags.DirectDialed;
1495
- };
1496
- instanceOf(obj: any): obj is {
1497
- /**
1498
- * @private
1499
- * This field is private and should not be used, use `tag` instead.
1500
- */
1501
- readonly [uniffiTypeNameSymbol]: "PathKind";
1502
- readonly tag: PathKind_Tags.DirectDialed;
1503
- };
1504
- };
1505
- DirectPunched: {
1506
- new (): {
1507
- /**
1508
- * @private
1509
- * This field is private and should not be used, use `tag` instead.
1510
- */
1511
- readonly [uniffiTypeNameSymbol]: "PathKind";
1512
- readonly tag: PathKind_Tags.DirectPunched;
1513
- };
1514
- "new"(): {
1515
- /**
1516
- * @private
1517
- * This field is private and should not be used, use `tag` instead.
1518
- */
1519
- readonly [uniffiTypeNameSymbol]: "PathKind";
1520
- readonly tag: PathKind_Tags.DirectPunched;
1521
- };
1522
- instanceOf(obj: any): obj is {
1523
- /**
1524
- * @private
1525
- * This field is private and should not be used, use `tag` instead.
1526
- */
1527
- readonly [uniffiTypeNameSymbol]: "PathKind";
1528
- readonly tag: PathKind_Tags.DirectPunched;
1529
- };
1530
- };
1531
- Relayed: {
1532
- new (inner: {
1533
- relayPeerId: string;
1534
- }): {
1535
- /**
1536
- * @private
1537
- * This field is private and should not be used, use `tag` instead.
1538
- */
1539
- readonly [uniffiTypeNameSymbol]: "PathKind";
1540
- readonly tag: PathKind_Tags.Relayed;
1541
- readonly inner: Readonly<{
1542
- relayPeerId: string;
1543
- }>;
1544
- };
1545
- "new"(inner: {
1546
- relayPeerId: string;
1547
- }): {
1548
- /**
1549
- * @private
1550
- * This field is private and should not be used, use `tag` instead.
1551
- */
1552
- readonly [uniffiTypeNameSymbol]: "PathKind";
1553
- readonly tag: PathKind_Tags.Relayed;
1554
- readonly inner: Readonly<{
1555
- relayPeerId: string;
1556
- }>;
1557
- };
1558
- instanceOf(obj: any): obj is {
1559
- /**
1560
- * @private
1561
- * This field is private and should not be used, use `tag` instead.
1562
- */
1563
- readonly [uniffiTypeNameSymbol]: "PathKind";
1564
- readonly tag: PathKind_Tags.Relayed;
1565
- readonly inner: Readonly<{
1566
- relayPeerId: string;
1567
- }>;
1568
- };
1569
- };
1570
- }>;
1571
- /**
1572
- * Kind of usable connection path.
1573
- */
1574
- export type PathKind = InstanceType<typeof PathKind['DirectDialed' | 'DirectPunched' | 'Relayed']>;
1575
1871
  export declare enum P2pEvent_Tags {
1576
1872
  EventsDropped = "EventsDropped",
1577
1873
  DriverFailed = "DriverFailed",
1874
+ EndpointClosed = "EndpointClosed",
1578
1875
  ConnectionEstablished = "ConnectionEstablished",
1579
1876
  ConnectionClosed = "ConnectionClosed",
1580
1877
  ConnectionReplaced = "ConnectionReplaced",
@@ -1609,6 +1906,8 @@ export declare enum P2pEvent_Tags {
1609
1906
  PeerUpdated = "PeerUpdated",
1610
1907
  PeerExpired = "PeerExpired",
1611
1908
  DiscoveryDialFailed = "DiscoveryDialFailed",
1909
+ MdnsFailed = "MdnsFailed",
1910
+ MdnsRecovered = "MdnsRecovered",
1612
1911
  DiscoveryProtocolViolation = "DiscoveryProtocolViolation"
1613
1912
  }
1614
1913
  /**
@@ -1709,6 +2008,50 @@ export declare const P2pEvent: Readonly<{
1709
2008
  }>;
1710
2009
  };
1711
2010
  };
2011
+ EndpointClosed: {
2012
+ new (inner: {
2013
+ outcome: CloseOutcome;
2014
+ unfinished: Array<UnfinishedConnection>;
2015
+ }): {
2016
+ /**
2017
+ * @private
2018
+ * This field is private and should not be used, use `tag` instead.
2019
+ */
2020
+ readonly [uniffiTypeNameSymbol]: "P2pEvent";
2021
+ readonly tag: P2pEvent_Tags.EndpointClosed;
2022
+ readonly inner: Readonly<{
2023
+ outcome: CloseOutcome;
2024
+ unfinished: Array<UnfinishedConnection>;
2025
+ }>;
2026
+ };
2027
+ "new"(inner: {
2028
+ outcome: CloseOutcome;
2029
+ unfinished: Array<UnfinishedConnection>;
2030
+ }): {
2031
+ /**
2032
+ * @private
2033
+ * This field is private and should not be used, use `tag` instead.
2034
+ */
2035
+ readonly [uniffiTypeNameSymbol]: "P2pEvent";
2036
+ readonly tag: P2pEvent_Tags.EndpointClosed;
2037
+ readonly inner: Readonly<{
2038
+ outcome: CloseOutcome;
2039
+ unfinished: Array<UnfinishedConnection>;
2040
+ }>;
2041
+ };
2042
+ instanceOf(obj: any): obj is {
2043
+ /**
2044
+ * @private
2045
+ * This field is private and should not be used, use `tag` instead.
2046
+ */
2047
+ readonly [uniffiTypeNameSymbol]: "P2pEvent";
2048
+ readonly tag: P2pEvent_Tags.EndpointClosed;
2049
+ readonly inner: Readonly<{
2050
+ outcome: CloseOutcome;
2051
+ unfinished: Array<UnfinishedConnection>;
2052
+ }>;
2053
+ };
2054
+ };
1712
2055
  ConnectionEstablished: {
1713
2056
  new (inner: {
1714
2057
  peerId: string;
@@ -1757,6 +2100,7 @@ export declare const P2pEvent: Readonly<{
1757
2100
  new (inner: {
1758
2101
  peerId: string;
1759
2102
  connId: bigint;
2103
+ reason: ConnectionCloseReason;
1760
2104
  }): {
1761
2105
  /**
1762
2106
  * @private
@@ -1767,11 +2111,13 @@ export declare const P2pEvent: Readonly<{
1767
2111
  readonly inner: Readonly<{
1768
2112
  peerId: string;
1769
2113
  connId: bigint;
2114
+ reason: ConnectionCloseReason;
1770
2115
  }>;
1771
2116
  };
1772
2117
  "new"(inner: {
1773
2118
  peerId: string;
1774
2119
  connId: bigint;
2120
+ reason: ConnectionCloseReason;
1775
2121
  }): {
1776
2122
  /**
1777
2123
  * @private
@@ -1782,6 +2128,7 @@ export declare const P2pEvent: Readonly<{
1782
2128
  readonly inner: Readonly<{
1783
2129
  peerId: string;
1784
2130
  connId: bigint;
2131
+ reason: ConnectionCloseReason;
1785
2132
  }>;
1786
2133
  };
1787
2134
  instanceOf(obj: any): obj is {
@@ -1794,6 +2141,7 @@ export declare const P2pEvent: Readonly<{
1794
2141
  readonly inner: Readonly<{
1795
2142
  peerId: string;
1796
2143
  connId: bigint;
2144
+ reason: ConnectionCloseReason;
1797
2145
  }>;
1798
2146
  };
1799
2147
  };
@@ -3360,6 +3708,76 @@ export declare const P2pEvent: Readonly<{
3360
3708
  }>;
3361
3709
  };
3362
3710
  };
3711
+ MdnsFailed: {
3712
+ new (inner: {
3713
+ kind: MdnsFailureKind;
3714
+ detail: string;
3715
+ }): {
3716
+ /**
3717
+ * @private
3718
+ * This field is private and should not be used, use `tag` instead.
3719
+ */
3720
+ readonly [uniffiTypeNameSymbol]: "P2pEvent";
3721
+ readonly tag: P2pEvent_Tags.MdnsFailed;
3722
+ readonly inner: Readonly<{
3723
+ kind: MdnsFailureKind;
3724
+ detail: string;
3725
+ }>;
3726
+ };
3727
+ "new"(inner: {
3728
+ kind: MdnsFailureKind;
3729
+ detail: string;
3730
+ }): {
3731
+ /**
3732
+ * @private
3733
+ * This field is private and should not be used, use `tag` instead.
3734
+ */
3735
+ readonly [uniffiTypeNameSymbol]: "P2pEvent";
3736
+ readonly tag: P2pEvent_Tags.MdnsFailed;
3737
+ readonly inner: Readonly<{
3738
+ kind: MdnsFailureKind;
3739
+ detail: string;
3740
+ }>;
3741
+ };
3742
+ instanceOf(obj: any): obj is {
3743
+ /**
3744
+ * @private
3745
+ * This field is private and should not be used, use `tag` instead.
3746
+ */
3747
+ readonly [uniffiTypeNameSymbol]: "P2pEvent";
3748
+ readonly tag: P2pEvent_Tags.MdnsFailed;
3749
+ readonly inner: Readonly<{
3750
+ kind: MdnsFailureKind;
3751
+ detail: string;
3752
+ }>;
3753
+ };
3754
+ };
3755
+ MdnsRecovered: {
3756
+ new (): {
3757
+ /**
3758
+ * @private
3759
+ * This field is private and should not be used, use `tag` instead.
3760
+ */
3761
+ readonly [uniffiTypeNameSymbol]: "P2pEvent";
3762
+ readonly tag: P2pEvent_Tags.MdnsRecovered;
3763
+ };
3764
+ "new"(): {
3765
+ /**
3766
+ * @private
3767
+ * This field is private and should not be used, use `tag` instead.
3768
+ */
3769
+ readonly [uniffiTypeNameSymbol]: "P2pEvent";
3770
+ readonly tag: P2pEvent_Tags.MdnsRecovered;
3771
+ };
3772
+ instanceOf(obj: any): obj is {
3773
+ /**
3774
+ * @private
3775
+ * This field is private and should not be used, use `tag` instead.
3776
+ */
3777
+ readonly [uniffiTypeNameSymbol]: "P2pEvent";
3778
+ readonly tag: P2pEvent_Tags.MdnsRecovered;
3779
+ };
3780
+ };
3363
3781
  DiscoveryProtocolViolation: {
3364
3782
  new (inner: {
3365
3783
  peerId?: string;
@@ -3418,7 +3836,7 @@ export declare const P2pEvent: Readonly<{
3418
3836
  /**
3419
3837
  * Event delivered by the native endpoint driver.
3420
3838
  */
3421
- export type P2pEvent = InstanceType<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']>;
3839
+ export type P2pEvent = InstanceType<typeof P2pEvent['EventsDropped' | 'DriverFailed' | 'EndpointClosed' | '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']>;
3422
3840
  /**
3423
3841
  * This should be called before anything else.
3424
3842
  *
@@ -3433,6 +3851,20 @@ declare function uniffiEnsureInitialized(): void;
3433
3851
  declare const _default: Readonly<{
3434
3852
  initialize: typeof uniffiEnsureInitialized;
3435
3853
  converters: {
3854
+ FfiConverterTypeCloseOutcome: {
3855
+ readFromCursor(c: Cursor): CloseOutcome;
3856
+ writeIntoCursor(value: CloseOutcome, c: Cursor): void;
3857
+ allocationSize(value: CloseOutcome): number;
3858
+ lift(value: UniffiByteArray): CloseOutcome;
3859
+ lower(value: CloseOutcome, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
3860
+ };
3861
+ FfiConverterTypeConfigCapability: {
3862
+ readFromCursor(c: Cursor): ConfigCapability;
3863
+ writeIntoCursor(value: ConfigCapability, c: Cursor): void;
3864
+ allocationSize(value: ConfigCapability): number;
3865
+ lift(value: UniffiByteArray): ConfigCapability;
3866
+ lower(value: ConfigCapability, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
3867
+ };
3436
3868
  FfiConverterTypeConnectTarget: {
3437
3869
  readFromCursor(c: Cursor): ConnectTarget;
3438
3870
  writeIntoCursor(value: ConnectTarget, c: Cursor): void;
@@ -3440,6 +3872,13 @@ declare const _default: Readonly<{
3440
3872
  lift(value: UniffiByteArray): ConnectTarget;
3441
3873
  lower(value: ConnectTarget, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
3442
3874
  };
3875
+ FfiConverterTypeConnectionCloseReason: {
3876
+ readFromCursor(c: Cursor): ConnectionCloseReason;
3877
+ writeIntoCursor(value: ConnectionCloseReason, c: Cursor): void;
3878
+ allocationSize(value: ConnectionCloseReason): number;
3879
+ lift(value: UniffiByteArray): ConnectionCloseReason;
3880
+ lower(value: ConnectionCloseReason, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
3881
+ };
3443
3882
  FfiConverterTypeConnectionInfo: {
3444
3883
  readFromCursor(c: Cursor): ConnectionInfo;
3445
3884
  writeIntoCursor(value: ConnectionInfo, c: Cursor): void;
@@ -3503,6 +3942,13 @@ declare const _default: Readonly<{
3503
3942
  lift(value: UniffiByteArray): KnownPeerInfo;
3504
3943
  lower(value: KnownPeerInfo, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
3505
3944
  };
3945
+ FfiConverterTypeMdnsFailureKind: {
3946
+ readFromCursor(c: Cursor): MdnsFailureKind;
3947
+ writeIntoCursor(value: MdnsFailureKind, c: Cursor): void;
3948
+ allocationSize(value: MdnsFailureKind): number;
3949
+ lift(value: UniffiByteArray): MdnsFailureKind;
3950
+ lower(value: MdnsFailureKind, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
3951
+ };
3506
3952
  FfiConverterTypeMdnsOptions: {
3507
3953
  readFromCursor(c: Cursor): MdnsOptions;
3508
3954
  writeIntoCursor(value: MdnsOptions, c: Cursor): void;
@@ -3552,6 +3998,13 @@ declare const _default: Readonly<{
3552
3998
  lift(value: UniffiByteArray): RelayReservationInfo;
3553
3999
  lower(value: RelayReservationInfo, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
3554
4000
  };
4001
+ FfiConverterTypeUnfinishedConnection: {
4002
+ readFromCursor(c: Cursor): UnfinishedConnection;
4003
+ writeIntoCursor(value: UnfinishedConnection, c: Cursor): void;
4004
+ allocationSize(value: UnfinishedConnection): number;
4005
+ lift(value: UniffiByteArray): UnfinishedConnection;
4006
+ lower(value: UnfinishedConnection, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
4007
+ };
3555
4008
  };
3556
4009
  }>;
3557
4010
  export default _default;