@minip2p/react-native 0.9.1 → 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 +32 -10
  8. package/lib/module/adapter.js.map +1 -1
  9. package/lib/module/generated/minip2p_ffi.js +11 -8
  10. package/lib/module/generated/minip2p_ffi.js.map +1 -1
  11. package/lib/module/generated/minip2p_ffi_core.js +639 -264
  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 +14 -8
  17. package/lib/typescript/src/generated/minip2p_ffi.d.ts.map +1 -1
  18. package/lib/typescript/src/generated/minip2p_ffi_core.d.ts +424 -130
  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 +45 -7
  24. package/src/generated/minip2p_ffi-ffi.ts +1 -1
  25. package/src/generated/minip2p_ffi.ts +18 -11
  26. package/src/generated/minip2p_ffi_core.ts +701 -267
  27. package/src/hook-lifecycle.ts +2 -2
@@ -56,8 +56,161 @@ const stringConverter = (() => {
56
56
  })();
57
57
  const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
58
58
 
59
+ // Enum: PathKind
60
+ export let PathKind_Tags = /*#__PURE__*/function (PathKind_Tags) {
61
+ PathKind_Tags["Direct"] = "Direct";
62
+ PathKind_Tags["Punched"] = "Punched";
63
+ PathKind_Tags["Relayed"] = "Relayed";
64
+ return PathKind_Tags;
65
+ }({});
66
+ /**
67
+ * How an established connection was made; see `minip2p::Path`.
68
+ */
69
+ export const PathKind = (() => {
70
+ /**
71
+ * A direct connection we dialed or accepted.
72
+ */
73
+ class Direct_ extends UniffiEnum {
74
+ /**
75
+ * @private
76
+ * This field is private and should not be used, use `tag` instead.
77
+ */
78
+ [uniffiTypeNameSymbol] = "PathKind";
79
+ tag = PathKind_Tags.Direct;
80
+ constructor() {
81
+ super("PathKind", "Direct");
82
+ }
83
+ static new() {
84
+ return new Direct_();
85
+ }
86
+ static instanceOf(obj) {
87
+ return obj.tag === PathKind_Tags.Direct;
88
+ }
89
+ }
90
+ /**
91
+ * A direct connection made by a DCUtR hole punch.
92
+ */
93
+ class Punched_ extends UniffiEnum {
94
+ /**
95
+ * @private
96
+ * This field is private and should not be used, use `tag` instead.
97
+ */
98
+ [uniffiTypeNameSymbol] = "PathKind";
99
+ tag = PathKind_Tags.Punched;
100
+ constructor() {
101
+ super("PathKind", "Punched");
102
+ }
103
+ static new() {
104
+ return new Punched_();
105
+ }
106
+ static instanceOf(obj) {
107
+ return obj.tag === PathKind_Tags.Punched;
108
+ }
109
+ }
110
+ /**
111
+ * Traffic is carried through a relay.
112
+ */
113
+ class Relayed_ extends UniffiEnum {
114
+ /**
115
+ * @private
116
+ * This field is private and should not be used, use `tag` instead.
117
+ */
118
+ [uniffiTypeNameSymbol] = "PathKind";
119
+ tag = PathKind_Tags.Relayed;
120
+ constructor(inner) {
121
+ super("PathKind", "Relayed");
122
+ this.inner = Object.freeze(inner);
123
+ }
124
+ static new(inner) {
125
+ return new Relayed_(inner);
126
+ }
127
+ static instanceOf(obj) {
128
+ return obj.tag === PathKind_Tags.Relayed;
129
+ }
130
+ }
131
+ function instanceOf(obj) {
132
+ return obj[uniffiTypeNameSymbol] === "PathKind";
133
+ }
134
+ return Object.freeze({
135
+ instanceOf,
136
+ Direct: Direct_,
137
+ Punched: Punched_,
138
+ Relayed: Relayed_
139
+ });
140
+ })();
141
+ /**
142
+ * How an established connection was made; see `minip2p::Path`.
143
+ */
144
+
145
+ // FfiConverter for enum PathKind
146
+ const FfiConverterTypePathKind = (() => {
147
+ class FFIConverter extends AbstractFfiConverterByteArray {
148
+ readFromCursor(c) {
149
+ switch (c.readI32()) {
150
+ case 1:
151
+ return new PathKind.Direct();
152
+ case 2:
153
+ return new PathKind.Punched();
154
+ case 3:
155
+ return new PathKind.Relayed({
156
+ relayPeerId: FfiConverterString.readFromCursor(c)
157
+ });
158
+ default:
159
+ throw new UniffiInternalError.UnexpectedEnumCase();
160
+ }
161
+ }
162
+ writeIntoCursor(value, c) {
163
+ switch (value.tag) {
164
+ case PathKind_Tags.Direct:
165
+ {
166
+ c.writeI32(1);
167
+ return;
168
+ }
169
+ case PathKind_Tags.Punched:
170
+ {
171
+ c.writeI32(2);
172
+ return;
173
+ }
174
+ case PathKind_Tags.Relayed:
175
+ {
176
+ c.writeI32(3);
177
+ const inner = value.inner;
178
+ FfiConverterString.writeIntoCursor(inner.relayPeerId, c);
179
+ return;
180
+ }
181
+ default:
182
+ // Throwing from here means that PathKind_Tags hasn't matched an ordinal.
183
+ throw new UniffiInternalError.UnexpectedEnumCase();
184
+ }
185
+ }
186
+ allocationSize(value) {
187
+ switch (value.tag) {
188
+ case PathKind_Tags.Direct:
189
+ {
190
+ return 4;
191
+ }
192
+ case PathKind_Tags.Punched:
193
+ {
194
+ return 4;
195
+ }
196
+ case PathKind_Tags.Relayed:
197
+ {
198
+ const inner = value.inner;
199
+ let size = 4;
200
+ size += FfiConverterString.allocationSize(inner.relayPeerId);
201
+ return size;
202
+ }
203
+ default:
204
+ throw new UniffiInternalError.UnexpectedEnumCase();
205
+ }
206
+ }
207
+ }
208
+ return new FFIConverter();
209
+ })();
210
+
59
211
  /**
60
- * State snapshot of the transport connection selected for a peer.
212
+ * State snapshot of a peer's established connection; see
213
+ * `minip2p::ConnectionInfo`.
61
214
  */
62
215
 
63
216
  /**
@@ -78,18 +231,22 @@ const FfiConverterTypeConnectionInfo = (() => {
78
231
  class FFIConverter extends AbstractFfiConverterByteArray {
79
232
  readFromCursor(c) {
80
233
  return {
234
+ peerId: FfiConverterString.readFromCursor(c),
81
235
  connId: FfiConverterUInt64.readFromCursor(c),
82
- remoteAddr: FfiConverterOptionalString.readFromCursor(c),
236
+ remoteAddr: FfiConverterString.readFromCursor(c),
237
+ path: FfiConverterTypePathKind.readFromCursor(c),
83
238
  readyProtocols: FfiConverterOptionalSequenceString.readFromCursor(c)
84
239
  };
85
240
  }
86
241
  writeIntoCursor(value, c) {
242
+ FfiConverterString.writeIntoCursor(value.peerId, c);
87
243
  FfiConverterUInt64.writeIntoCursor(value.connId, c);
88
- FfiConverterOptionalString.writeIntoCursor(value.remoteAddr, c);
244
+ FfiConverterString.writeIntoCursor(value.remoteAddr, c);
245
+ FfiConverterTypePathKind.writeIntoCursor(value.path, c);
89
246
  FfiConverterOptionalSequenceString.writeIntoCursor(value.readyProtocols, c);
90
247
  }
91
248
  allocationSize(value) {
92
- return FfiConverterUInt64.allocationSize(value.connId) + FfiConverterOptionalString.allocationSize(value.remoteAddr) + FfiConverterOptionalSequenceString.allocationSize(value.readyProtocols);
249
+ return FfiConverterString.allocationSize(value.peerId) + FfiConverterUInt64.allocationSize(value.connId) + FfiConverterString.allocationSize(value.remoteAddr) + FfiConverterTypePathKind.allocationSize(value.path) + FfiConverterOptionalSequenceString.allocationSize(value.readyProtocols);
93
250
  }
94
251
  }
95
252
  ;
@@ -408,6 +565,94 @@ const FfiConverterTypeRelayReservationInfo = (() => {
408
565
  return new FFIConverter();
409
566
  })();
410
567
 
568
+ /**
569
+ * A connection still tracked when the closing drain ended.
570
+ */
571
+
572
+ /**
573
+ * Generated factory for {@link UnfinishedConnection} record objects.
574
+ */
575
+ export const UnfinishedConnection = (() => {
576
+ const defaults = () => ({});
577
+ const create = (() => {
578
+ return uniffiCreateRecord(defaults);
579
+ })();
580
+ return Object.freeze({
581
+ create,
582
+ new: create,
583
+ defaults: () => Object.freeze(defaults())
584
+ });
585
+ })();
586
+ const FfiConverterTypeUnfinishedConnection = (() => {
587
+ class FFIConverter extends AbstractFfiConverterByteArray {
588
+ readFromCursor(c) {
589
+ return {
590
+ connId: FfiConverterUInt64.readFromCursor(c),
591
+ peerId: FfiConverterOptionalString.readFromCursor(c)
592
+ };
593
+ }
594
+ writeIntoCursor(value, c) {
595
+ FfiConverterUInt64.writeIntoCursor(value.connId, c);
596
+ FfiConverterOptionalString.writeIntoCursor(value.peerId, c);
597
+ }
598
+ allocationSize(value) {
599
+ return FfiConverterUInt64.allocationSize(value.connId) + FfiConverterOptionalString.allocationSize(value.peerId);
600
+ }
601
+ }
602
+ ;
603
+ return new FFIConverter();
604
+ })();
605
+
606
+ /**
607
+ * How the driver's closing drain ended; see [`P2pEvent::EndpointClosed`].
608
+ */
609
+ export let CloseOutcome = /*#__PURE__*/function (CloseOutcome) {
610
+ /**
611
+ * Every tracked connection finished its teardown in time.
612
+ */
613
+ CloseOutcome[CloseOutcome["Drained"] = 0] = "Drained";
614
+ /**
615
+ * The stop deadline passed with connections still tracked.
616
+ */
617
+ CloseOutcome[CloseOutcome["DeadlineExpired"] = 1] = "DeadlineExpired";
618
+ /**
619
+ * Driving the transports failed and ended the drain early, or the
620
+ * driver panicked and dropped the endpoint without a drain.
621
+ */
622
+ CloseOutcome[CloseOutcome["Failed"] = 2] = "Failed";
623
+ return CloseOutcome;
624
+ }({});
625
+ const FfiConverterTypeCloseOutcome = (() => {
626
+ class FFIConverter extends AbstractFfiConverterByteArray {
627
+ readFromCursor(c) {
628
+ switch (c.readI32()) {
629
+ case 1:
630
+ return CloseOutcome.Drained;
631
+ case 2:
632
+ return CloseOutcome.DeadlineExpired;
633
+ case 3:
634
+ return CloseOutcome.Failed;
635
+ default:
636
+ throw new UniffiInternalError.UnexpectedEnumCase();
637
+ }
638
+ }
639
+ writeIntoCursor(value, c) {
640
+ switch (value) {
641
+ case CloseOutcome.Drained:
642
+ return c.writeI32(1);
643
+ case CloseOutcome.DeadlineExpired:
644
+ return c.writeI32(2);
645
+ case CloseOutcome.Failed:
646
+ return c.writeI32(3);
647
+ }
648
+ }
649
+ allocationSize(value) {
650
+ return 4;
651
+ }
652
+ }
653
+ return new FFIConverter();
654
+ })();
655
+
411
656
  /**
412
657
  * The part of an endpoint's configuration an [`FfiError::InvalidConfig`]
413
658
  * names.
@@ -614,6 +859,233 @@ const FfiConverterTypeConnectTarget = (() => {
614
859
  return new FFIConverter();
615
860
  })();
616
861
 
862
+ // Enum: ConnectionCloseReason
863
+ export let ConnectionCloseReason_Tags = /*#__PURE__*/function (ConnectionCloseReason_Tags) {
864
+ ConnectionCloseReason_Tags["Local"] = "Local";
865
+ ConnectionCloseReason_Tags["Remote"] = "Remote";
866
+ ConnectionCloseReason_Tags["TimedOut"] = "TimedOut";
867
+ ConnectionCloseReason_Tags["Stalled"] = "Stalled";
868
+ ConnectionCloseReason_Tags["Error"] = "Error";
869
+ return ConnectionCloseReason_Tags;
870
+ }({});
871
+ /**
872
+ * Why one connection ended; see `minip2p::ConnectionCloseReason`.
873
+ */
874
+ export const ConnectionCloseReason = (() => {
875
+ /**
876
+ * We closed it.
877
+ */
878
+ class Local_ extends UniffiEnum {
879
+ /**
880
+ * @private
881
+ * This field is private and should not be used, use `tag` instead.
882
+ */
883
+ [uniffiTypeNameSymbol] = "ConnectionCloseReason";
884
+ tag = ConnectionCloseReason_Tags.Local;
885
+ constructor() {
886
+ super("ConnectionCloseReason", "Local");
887
+ }
888
+ static new() {
889
+ return new Local_();
890
+ }
891
+ static instanceOf(obj) {
892
+ return obj.tag === ConnectionCloseReason_Tags.Local;
893
+ }
894
+ }
895
+ /**
896
+ * The peer closed it with `code`: its QUIC CONNECTION_CLOSE code, or
897
+ * its Yamux `GoAway` code on TCP and relay circuits.
898
+ */
899
+ class Remote_ extends UniffiEnum {
900
+ /**
901
+ * @private
902
+ * This field is private and should not be used, use `tag` instead.
903
+ */
904
+ [uniffiTypeNameSymbol] = "ConnectionCloseReason";
905
+ tag = ConnectionCloseReason_Tags.Remote;
906
+ constructor(inner) {
907
+ super("ConnectionCloseReason", "Remote");
908
+ this.inner = Object.freeze(inner);
909
+ }
910
+ static new(inner) {
911
+ return new Remote_(inner);
912
+ }
913
+ static instanceOf(obj) {
914
+ return obj.tag === ConnectionCloseReason_Tags.Remote;
915
+ }
916
+ }
917
+ /**
918
+ * The peer went silent (an idle, keepalive or handshake timeout).
919
+ */
920
+ class TimedOut_ extends UniffiEnum {
921
+ /**
922
+ * @private
923
+ * This field is private and should not be used, use `tag` instead.
924
+ */
925
+ [uniffiTypeNameSymbol] = "ConnectionCloseReason";
926
+ tag = ConnectionCloseReason_Tags.TimedOut;
927
+ constructor() {
928
+ super("ConnectionCloseReason", "TimedOut");
929
+ }
930
+ static new() {
931
+ return new TimedOut_();
932
+ }
933
+ static instanceOf(obj) {
934
+ return obj.tag === ConnectionCloseReason_Tags.TimedOut;
935
+ }
936
+ }
937
+ /**
938
+ * The peer stopped reading (a TCP send stall).
939
+ */
940
+ class Stalled_ extends UniffiEnum {
941
+ /**
942
+ * @private
943
+ * This field is private and should not be used, use `tag` instead.
944
+ */
945
+ [uniffiTypeNameSymbol] = "ConnectionCloseReason";
946
+ tag = ConnectionCloseReason_Tags.Stalled;
947
+ constructor() {
948
+ super("ConnectionCloseReason", "Stalled");
949
+ }
950
+ static new() {
951
+ return new Stalled_();
952
+ }
953
+ static instanceOf(obj) {
954
+ return obj.tag === ConnectionCloseReason_Tags.Stalled;
955
+ }
956
+ }
957
+ /**
958
+ * Anything else that ended it.
959
+ */
960
+ class Error_ extends UniffiEnum {
961
+ /**
962
+ * @private
963
+ * This field is private and should not be used, use `tag` instead.
964
+ */
965
+ [uniffiTypeNameSymbol] = "ConnectionCloseReason";
966
+ tag = ConnectionCloseReason_Tags.Error;
967
+ constructor(inner) {
968
+ super("ConnectionCloseReason", "Error");
969
+ this.inner = Object.freeze(inner);
970
+ }
971
+ static new(inner) {
972
+ return new Error_(inner);
973
+ }
974
+ static instanceOf(obj) {
975
+ return obj.tag === ConnectionCloseReason_Tags.Error;
976
+ }
977
+ }
978
+ function instanceOf(obj) {
979
+ return obj[uniffiTypeNameSymbol] === "ConnectionCloseReason";
980
+ }
981
+ return Object.freeze({
982
+ instanceOf,
983
+ Local: Local_,
984
+ Remote: Remote_,
985
+ TimedOut: TimedOut_,
986
+ Stalled: Stalled_,
987
+ Error: Error_
988
+ });
989
+ })();
990
+ /**
991
+ * Why one connection ended; see `minip2p::ConnectionCloseReason`.
992
+ */
993
+
994
+ // FfiConverter for enum ConnectionCloseReason
995
+ const FfiConverterTypeConnectionCloseReason = (() => {
996
+ class FFIConverter extends AbstractFfiConverterByteArray {
997
+ readFromCursor(c) {
998
+ switch (c.readI32()) {
999
+ case 1:
1000
+ return new ConnectionCloseReason.Local();
1001
+ case 2:
1002
+ return new ConnectionCloseReason.Remote({
1003
+ code: FfiConverterUInt64.readFromCursor(c)
1004
+ });
1005
+ case 3:
1006
+ return new ConnectionCloseReason.TimedOut();
1007
+ case 4:
1008
+ return new ConnectionCloseReason.Stalled();
1009
+ case 5:
1010
+ return new ConnectionCloseReason.Error({
1011
+ message: FfiConverterString.readFromCursor(c)
1012
+ });
1013
+ default:
1014
+ throw new UniffiInternalError.UnexpectedEnumCase();
1015
+ }
1016
+ }
1017
+ writeIntoCursor(value, c) {
1018
+ switch (value.tag) {
1019
+ case ConnectionCloseReason_Tags.Local:
1020
+ {
1021
+ c.writeI32(1);
1022
+ return;
1023
+ }
1024
+ case ConnectionCloseReason_Tags.Remote:
1025
+ {
1026
+ c.writeI32(2);
1027
+ const inner = value.inner;
1028
+ FfiConverterUInt64.writeIntoCursor(inner.code, c);
1029
+ return;
1030
+ }
1031
+ case ConnectionCloseReason_Tags.TimedOut:
1032
+ {
1033
+ c.writeI32(3);
1034
+ return;
1035
+ }
1036
+ case ConnectionCloseReason_Tags.Stalled:
1037
+ {
1038
+ c.writeI32(4);
1039
+ return;
1040
+ }
1041
+ case ConnectionCloseReason_Tags.Error:
1042
+ {
1043
+ c.writeI32(5);
1044
+ const inner = value.inner;
1045
+ FfiConverterString.writeIntoCursor(inner.message, c);
1046
+ return;
1047
+ }
1048
+ default:
1049
+ // Throwing from here means that ConnectionCloseReason_Tags hasn't matched an ordinal.
1050
+ throw new UniffiInternalError.UnexpectedEnumCase();
1051
+ }
1052
+ }
1053
+ allocationSize(value) {
1054
+ switch (value.tag) {
1055
+ case ConnectionCloseReason_Tags.Local:
1056
+ {
1057
+ return 4;
1058
+ }
1059
+ case ConnectionCloseReason_Tags.Remote:
1060
+ {
1061
+ const inner = value.inner;
1062
+ let size = 4;
1063
+ size += FfiConverterUInt64.allocationSize(inner.code);
1064
+ return size;
1065
+ }
1066
+ case ConnectionCloseReason_Tags.TimedOut:
1067
+ {
1068
+ return 4;
1069
+ }
1070
+ case ConnectionCloseReason_Tags.Stalled:
1071
+ {
1072
+ return 4;
1073
+ }
1074
+ case ConnectionCloseReason_Tags.Error:
1075
+ {
1076
+ const inner = value.inner;
1077
+ let size = 4;
1078
+ size += FfiConverterString.allocationSize(inner.message);
1079
+ return size;
1080
+ }
1081
+ default:
1082
+ throw new UniffiInternalError.UnexpectedEnumCase();
1083
+ }
1084
+ }
1085
+ }
1086
+ return new FFIConverter();
1087
+ })();
1088
+
617
1089
  /**
618
1090
  * Source that contributed a discovery observation.
619
1091
  */
@@ -1562,205 +2034,53 @@ const FfiConverterTypeNatErrorKind = (() => {
1562
2034
  return 4;
1563
2035
  }
1564
2036
  }
1565
- return new FFIConverter();
1566
- })();
1567
-
1568
- /**
1569
- * Coarse local reachability state.
1570
- */
1571
- export let Reachability = /*#__PURE__*/function (Reachability) {
1572
- /**
1573
- * Not enough evidence is available.
1574
- */
1575
- Reachability[Reachability["Unknown"] = 0] = "Unknown";
1576
- /**
1577
- * The endpoint is directly reachable.
1578
- */
1579
- Reachability[Reachability["Public"] = 1] = "Public";
1580
- /**
1581
- * The endpoint needs traversal or relay assistance.
1582
- */
1583
- Reachability[Reachability["Private"] = 2] = "Private";
1584
- return Reachability;
1585
- }({});
1586
- const FfiConverterTypeReachability = (() => {
1587
- class FFIConverter extends AbstractFfiConverterByteArray {
1588
- readFromCursor(c) {
1589
- switch (c.readI32()) {
1590
- case 1:
1591
- return Reachability.Unknown;
1592
- case 2:
1593
- return Reachability.Public;
1594
- case 3:
1595
- return Reachability.Private;
1596
- default:
1597
- throw new UniffiInternalError.UnexpectedEnumCase();
1598
- }
1599
- }
1600
- writeIntoCursor(value, c) {
1601
- switch (value) {
1602
- case Reachability.Unknown:
1603
- return c.writeI32(1);
1604
- case Reachability.Public:
1605
- return c.writeI32(2);
1606
- case Reachability.Private:
1607
- return c.writeI32(3);
1608
- }
1609
- }
1610
- allocationSize(value) {
1611
- return 4;
1612
- }
1613
- }
1614
- return new FFIConverter();
1615
- })();
1616
-
1617
- // Enum: PathKind
1618
- export let PathKind_Tags = /*#__PURE__*/function (PathKind_Tags) {
1619
- PathKind_Tags["DirectDialed"] = "DirectDialed";
1620
- PathKind_Tags["DirectPunched"] = "DirectPunched";
1621
- PathKind_Tags["Relayed"] = "Relayed";
1622
- return PathKind_Tags;
1623
- }({});
1624
- /**
1625
- * Kind of usable connection path.
1626
- */
1627
- export const PathKind = (() => {
1628
- /**
1629
- * A known address was dialed directly.
1630
- */
1631
- class DirectDialed_ extends UniffiEnum {
1632
- /**
1633
- * @private
1634
- * This field is private and should not be used, use `tag` instead.
1635
- */
1636
- [uniffiTypeNameSymbol] = "PathKind";
1637
- tag = PathKind_Tags.DirectDialed;
1638
- constructor() {
1639
- super("PathKind", "DirectDialed");
1640
- }
1641
- static new() {
1642
- return new DirectDialed_();
1643
- }
1644
- static instanceOf(obj) {
1645
- return obj.tag === PathKind_Tags.DirectDialed;
1646
- }
1647
- }
1648
- /**
1649
- * A direct path was established by hole punching.
1650
- */
1651
- class DirectPunched_ extends UniffiEnum {
1652
- /**
1653
- * @private
1654
- * This field is private and should not be used, use `tag` instead.
1655
- */
1656
- [uniffiTypeNameSymbol] = "PathKind";
1657
- tag = PathKind_Tags.DirectPunched;
1658
- constructor() {
1659
- super("PathKind", "DirectPunched");
1660
- }
1661
- static new() {
1662
- return new DirectPunched_();
1663
- }
1664
- static instanceOf(obj) {
1665
- return obj.tag === PathKind_Tags.DirectPunched;
1666
- }
1667
- }
1668
- /**
1669
- * Traffic is carried through a relay.
1670
- */
1671
- class Relayed_ extends UniffiEnum {
1672
- /**
1673
- * @private
1674
- * This field is private and should not be used, use `tag` instead.
1675
- */
1676
- [uniffiTypeNameSymbol] = "PathKind";
1677
- tag = PathKind_Tags.Relayed;
1678
- constructor(inner) {
1679
- super("PathKind", "Relayed");
1680
- this.inner = Object.freeze(inner);
1681
- }
1682
- static new(inner) {
1683
- return new Relayed_(inner);
1684
- }
1685
- static instanceOf(obj) {
1686
- return obj.tag === PathKind_Tags.Relayed;
1687
- }
1688
- }
1689
- function instanceOf(obj) {
1690
- return obj[uniffiTypeNameSymbol] === "PathKind";
1691
- }
1692
- return Object.freeze({
1693
- instanceOf,
1694
- DirectDialed: DirectDialed_,
1695
- DirectPunched: DirectPunched_,
1696
- Relayed: Relayed_
1697
- });
2037
+ return new FFIConverter();
1698
2038
  })();
2039
+
1699
2040
  /**
1700
- * Kind of usable connection path.
2041
+ * Coarse local reachability state.
1701
2042
  */
1702
-
1703
- // FfiConverter for enum PathKind
1704
- const FfiConverterTypePathKind = (() => {
2043
+ export let Reachability = /*#__PURE__*/function (Reachability) {
2044
+ /**
2045
+ * Not enough evidence is available.
2046
+ */
2047
+ Reachability[Reachability["Unknown"] = 0] = "Unknown";
2048
+ /**
2049
+ * The endpoint is directly reachable.
2050
+ */
2051
+ Reachability[Reachability["Public"] = 1] = "Public";
2052
+ /**
2053
+ * The endpoint needs traversal or relay assistance.
2054
+ */
2055
+ Reachability[Reachability["Private"] = 2] = "Private";
2056
+ return Reachability;
2057
+ }({});
2058
+ const FfiConverterTypeReachability = (() => {
1705
2059
  class FFIConverter extends AbstractFfiConverterByteArray {
1706
2060
  readFromCursor(c) {
1707
2061
  switch (c.readI32()) {
1708
2062
  case 1:
1709
- return new PathKind.DirectDialed();
2063
+ return Reachability.Unknown;
1710
2064
  case 2:
1711
- return new PathKind.DirectPunched();
2065
+ return Reachability.Public;
1712
2066
  case 3:
1713
- return new PathKind.Relayed({
1714
- relayPeerId: FfiConverterString.readFromCursor(c)
1715
- });
2067
+ return Reachability.Private;
1716
2068
  default:
1717
2069
  throw new UniffiInternalError.UnexpectedEnumCase();
1718
2070
  }
1719
2071
  }
1720
2072
  writeIntoCursor(value, c) {
1721
- switch (value.tag) {
1722
- case PathKind_Tags.DirectDialed:
1723
- {
1724
- c.writeI32(1);
1725
- return;
1726
- }
1727
- case PathKind_Tags.DirectPunched:
1728
- {
1729
- c.writeI32(2);
1730
- return;
1731
- }
1732
- case PathKind_Tags.Relayed:
1733
- {
1734
- c.writeI32(3);
1735
- const inner = value.inner;
1736
- FfiConverterString.writeIntoCursor(inner.relayPeerId, c);
1737
- return;
1738
- }
1739
- default:
1740
- // Throwing from here means that PathKind_Tags hasn't matched an ordinal.
1741
- throw new UniffiInternalError.UnexpectedEnumCase();
2073
+ switch (value) {
2074
+ case Reachability.Unknown:
2075
+ return c.writeI32(1);
2076
+ case Reachability.Public:
2077
+ return c.writeI32(2);
2078
+ case Reachability.Private:
2079
+ return c.writeI32(3);
1742
2080
  }
1743
2081
  }
1744
2082
  allocationSize(value) {
1745
- switch (value.tag) {
1746
- case PathKind_Tags.DirectDialed:
1747
- {
1748
- return 4;
1749
- }
1750
- case PathKind_Tags.DirectPunched:
1751
- {
1752
- return 4;
1753
- }
1754
- case PathKind_Tags.Relayed:
1755
- {
1756
- const inner = value.inner;
1757
- let size = 4;
1758
- size += FfiConverterString.allocationSize(inner.relayPeerId);
1759
- return size;
1760
- }
1761
- default:
1762
- throw new UniffiInternalError.UnexpectedEnumCase();
1763
- }
2083
+ return 4;
1764
2084
  }
1765
2085
  }
1766
2086
  return new FFIConverter();
@@ -1770,6 +2090,7 @@ const FfiConverterTypePathKind = (() => {
1770
2090
  export let P2pEvent_Tags = /*#__PURE__*/function (P2pEvent_Tags) {
1771
2091
  P2pEvent_Tags["EventsDropped"] = "EventsDropped";
1772
2092
  P2pEvent_Tags["DriverFailed"] = "DriverFailed";
2093
+ P2pEvent_Tags["EndpointClosed"] = "EndpointClosed";
1773
2094
  P2pEvent_Tags["ConnectionEstablished"] = "ConnectionEstablished";
1774
2095
  P2pEvent_Tags["ConnectionClosed"] = "ConnectionClosed";
1775
2096
  P2pEvent_Tags["ConnectionReplaced"] = "ConnectionReplaced";
@@ -1855,6 +2176,29 @@ export const P2pEvent = (() => {
1855
2176
  return obj.tag === P2pEvent_Tags.DriverFailed;
1856
2177
  }
1857
2178
  }
2179
+ /**
2180
+ * The driver finished shutting down: its last event, after
2181
+ * [`P2pEndpoint::stop`](crate::P2pEndpoint::stop) or a
2182
+ * [`P2pEvent::DriverFailed`], when a failed driver tears down at once.
2183
+ */
2184
+ class EndpointClosed_ extends UniffiEnum {
2185
+ /**
2186
+ * @private
2187
+ * This field is private and should not be used, use `tag` instead.
2188
+ */
2189
+ [uniffiTypeNameSymbol] = "P2pEvent";
2190
+ tag = P2pEvent_Tags.EndpointClosed;
2191
+ constructor(inner) {
2192
+ super("P2pEvent", "EndpointClosed");
2193
+ this.inner = Object.freeze(inner);
2194
+ }
2195
+ static new(inner) {
2196
+ return new EndpointClosed_(inner);
2197
+ }
2198
+ static instanceOf(obj) {
2199
+ return obj.tag === P2pEvent_Tags.EndpointClosed;
2200
+ }
2201
+ }
1858
2202
  /**
1859
2203
  * A peer went from disconnected to connected over a verified connection.
1860
2204
  */
@@ -2654,6 +2998,7 @@ export const P2pEvent = (() => {
2654
2998
  instanceOf,
2655
2999
  EventsDropped: EventsDropped_,
2656
3000
  DriverFailed: DriverFailed_,
3001
+ EndpointClosed: EndpointClosed_,
2657
3002
  ConnectionEstablished: ConnectionEstablished_,
2658
3003
  ConnectionClosed: ConnectionClosed_,
2659
3004
  ConnectionReplaced: ConnectionReplaced_,
@@ -2714,45 +3059,51 @@ const FfiConverterTypeP2pEvent = (() => {
2714
3059
  detail: FfiConverterString.readFromCursor(c)
2715
3060
  });
2716
3061
  case 3:
3062
+ return new P2pEvent.EndpointClosed({
3063
+ outcome: FfiConverterTypeCloseOutcome.readFromCursor(c),
3064
+ unfinished: FfiConverterSequenceTypeUnfinishedConnection.readFromCursor(c)
3065
+ });
3066
+ case 4:
2717
3067
  return new P2pEvent.ConnectionEstablished({
2718
3068
  peerId: FfiConverterString.readFromCursor(c),
2719
3069
  connId: FfiConverterUInt64.readFromCursor(c)
2720
3070
  });
2721
- case 4:
3071
+ case 5:
2722
3072
  return new P2pEvent.ConnectionClosed({
2723
3073
  peerId: FfiConverterString.readFromCursor(c),
2724
- connId: FfiConverterUInt64.readFromCursor(c)
3074
+ connId: FfiConverterUInt64.readFromCursor(c),
3075
+ reason: FfiConverterTypeConnectionCloseReason.readFromCursor(c)
2725
3076
  });
2726
- case 5:
3077
+ case 6:
2727
3078
  return new P2pEvent.ConnectionReplaced({
2728
3079
  peerId: FfiConverterString.readFromCursor(c),
2729
3080
  oldConnId: FfiConverterUInt64.readFromCursor(c),
2730
3081
  newConnId: FfiConverterUInt64.readFromCursor(c)
2731
3082
  });
2732
- case 6:
3083
+ case 7:
2733
3084
  return new P2pEvent.PeerReady({
2734
3085
  peerId: FfiConverterString.readFromCursor(c),
2735
3086
  connId: FfiConverterUInt64.readFromCursor(c),
2736
3087
  protocols: FfiConverterSequenceString.readFromCursor(c)
2737
3088
  });
2738
- case 7:
3089
+ case 8:
2739
3090
  return new P2pEvent.IdentifyReceived({
2740
3091
  peerId: FfiConverterString.readFromCursor(c),
2741
3092
  connId: FfiConverterUInt64.readFromCursor(c),
2742
3093
  info: FfiConverterTypeIdentifyInfo.readFromCursor(c)
2743
3094
  });
2744
- case 8:
3095
+ case 9:
2745
3096
  return new P2pEvent.PingRttMeasured({
2746
3097
  peerId: FfiConverterString.readFromCursor(c),
2747
3098
  connId: FfiConverterUInt64.readFromCursor(c),
2748
3099
  rttMs: FfiConverterUInt64.readFromCursor(c)
2749
3100
  });
2750
- case 9:
3101
+ case 10:
2751
3102
  return new P2pEvent.PingTimeout({
2752
3103
  peerId: FfiConverterString.readFromCursor(c),
2753
3104
  connId: FfiConverterUInt64.readFromCursor(c)
2754
3105
  });
2755
- case 10:
3106
+ case 11:
2756
3107
  return new P2pEvent.StreamReady({
2757
3108
  peerId: FfiConverterString.readFromCursor(c),
2758
3109
  connId: FfiConverterUInt64.readFromCursor(c),
@@ -2760,39 +3111,39 @@ const FfiConverterTypeP2pEvent = (() => {
2760
3111
  protocolId: FfiConverterString.readFromCursor(c),
2761
3112
  initiatedLocally: FfiConverterBool.readFromCursor(c)
2762
3113
  });
2763
- case 11:
3114
+ case 12:
2764
3115
  return new P2pEvent.StreamData({
2765
3116
  peerId: FfiConverterString.readFromCursor(c),
2766
3117
  connId: FfiConverterUInt64.readFromCursor(c),
2767
3118
  streamId: FfiConverterUInt64.readFromCursor(c),
2768
3119
  data: FfiConverterArrayBuffer.readFromCursor(c)
2769
3120
  });
2770
- case 12:
3121
+ case 13:
2771
3122
  return new P2pEvent.StreamWriteAccepted({
2772
3123
  peerId: FfiConverterString.readFromCursor(c),
2773
3124
  connId: FfiConverterUInt64.readFromCursor(c),
2774
3125
  streamId: FfiConverterUInt64.readFromCursor(c)
2775
3126
  });
2776
- case 13:
3127
+ case 14:
2777
3128
  return new P2pEvent.StreamWriteStopped({
2778
3129
  peerId: FfiConverterString.readFromCursor(c),
2779
3130
  connId: FfiConverterUInt64.readFromCursor(c),
2780
3131
  streamId: FfiConverterUInt64.readFromCursor(c),
2781
3132
  errorCode: FfiConverterUInt64.readFromCursor(c)
2782
3133
  });
2783
- case 14:
3134
+ case 15:
2784
3135
  return new P2pEvent.StreamRemoteWriteClosed({
2785
3136
  peerId: FfiConverterString.readFromCursor(c),
2786
3137
  connId: FfiConverterUInt64.readFromCursor(c),
2787
3138
  streamId: FfiConverterUInt64.readFromCursor(c)
2788
3139
  });
2789
- case 15:
3140
+ case 16:
2790
3141
  return new P2pEvent.StreamClosed({
2791
3142
  peerId: FfiConverterString.readFromCursor(c),
2792
3143
  connId: FfiConverterUInt64.readFromCursor(c),
2793
3144
  streamId: FfiConverterUInt64.readFromCursor(c)
2794
3145
  });
2795
- case 16:
3146
+ case 17:
2796
3147
  return new P2pEvent.EndpointError({
2797
3148
  kind: FfiConverterTypeEndpointErrorKind.readFromCursor(c),
2798
3149
  peerId: FfiConverterOptionalString.readFromCursor(c),
@@ -2800,39 +3151,39 @@ const FfiConverterTypeP2pEvent = (() => {
2800
3151
  streamId: FfiConverterOptionalUInt64.readFromCursor(c),
2801
3152
  detail: FfiConverterString.readFromCursor(c)
2802
3153
  });
2803
- case 17:
3154
+ case 18:
2804
3155
  return new P2pEvent.ReachabilityChanged({
2805
3156
  previous: FfiConverterTypeReachability.readFromCursor(c),
2806
3157
  current: FfiConverterTypeReachability.readFromCursor(c),
2807
3158
  confirmedAddrs: FfiConverterSequenceString.readFromCursor(c)
2808
3159
  });
2809
- case 18:
3160
+ case 19:
2810
3161
  return new P2pEvent.PublicAddressesChanged({
2811
3162
  addrs: FfiConverterSequenceString.readFromCursor(c)
2812
3163
  });
2813
- case 19:
3164
+ case 20:
2814
3165
  return new P2pEvent.RelayReserved({
2815
3166
  relayPeerId: FfiConverterString.readFromCursor(c),
2816
3167
  expiresUnixSecs: FfiConverterOptionalUInt64.readFromCursor(c)
2817
3168
  });
2818
- case 20:
3169
+ case 21:
2819
3170
  return new P2pEvent.RelayReservationLost({
2820
3171
  relayPeerId: FfiConverterString.readFromCursor(c)
2821
3172
  });
2822
- case 21:
3173
+ case 22:
2823
3174
  return new P2pEvent.PathEstablished({
2824
3175
  connectId: FfiConverterUInt64.readFromCursor(c),
2825
3176
  peerId: FfiConverterString.readFromCursor(c),
2826
3177
  connId: FfiConverterUInt64.readFromCursor(c),
2827
3178
  path: FfiConverterTypePathKind.readFromCursor(c)
2828
3179
  });
2829
- case 22:
3180
+ case 23:
2830
3181
  return new P2pEvent.InboundPathEstablished({
2831
3182
  peerId: FfiConverterString.readFromCursor(c),
2832
3183
  path: FfiConverterTypePathKind.readFromCursor(c),
2833
3184
  connId: FfiConverterUInt64.readFromCursor(c)
2834
3185
  });
2835
- case 23:
3186
+ case 24:
2836
3187
  return new P2pEvent.PathUpgraded({
2837
3188
  connectId: FfiConverterUInt64.readFromCursor(c),
2838
3189
  peerId: FfiConverterString.readFromCursor(c),
@@ -2841,31 +3192,31 @@ const FfiConverterTypeP2pEvent = (() => {
2841
3192
  oldConnId: FfiConverterUInt64.readFromCursor(c),
2842
3193
  newConnId: FfiConverterUInt64.readFromCursor(c)
2843
3194
  });
2844
- case 24:
3195
+ case 25:
2845
3196
  return new P2pEvent.HolePunchFailed({
2846
3197
  connectId: FfiConverterUInt64.readFromCursor(c),
2847
3198
  attempt: FfiConverterUInt32.readFromCursor(c),
2848
3199
  reason: FfiConverterString.readFromCursor(c)
2849
3200
  });
2850
- case 25:
3201
+ case 26:
2851
3202
  return new P2pEvent.ConnectFailed({
2852
3203
  connectId: FfiConverterUInt64.readFromCursor(c),
2853
3204
  peerId: FfiConverterString.readFromCursor(c),
2854
3205
  kind: FfiConverterTypeNatErrorKind.readFromCursor(c),
2855
3206
  detail: FfiConverterString.readFromCursor(c)
2856
3207
  });
2857
- case 26:
3208
+ case 27:
2858
3209
  return new P2pEvent.ConnectCancelled({
2859
3210
  connectId: FfiConverterUInt64.readFromCursor(c),
2860
3211
  peerId: FfiConverterString.readFromCursor(c)
2861
3212
  });
2862
- case 27:
3213
+ case 28:
2863
3214
  return new P2pEvent.InboundDirectUpgrade({
2864
3215
  peerId: FfiConverterString.readFromCursor(c),
2865
3216
  oldConnId: FfiConverterUInt64.readFromCursor(c),
2866
3217
  newConnId: FfiConverterUInt64.readFromCursor(c)
2867
3218
  });
2868
- case 28:
3219
+ case 29:
2869
3220
  return new P2pEvent.Message({
2870
3221
  fromPeerId: FfiConverterString.readFromCursor(c),
2871
3222
  topics: FfiConverterSequenceString.readFromCursor(c),
@@ -2873,55 +3224,55 @@ const FfiConverterTypeP2pEvent = (() => {
2873
3224
  seqno: FfiConverterArrayBuffer.readFromCursor(c),
2874
3225
  signed: FfiConverterBool.readFromCursor(c)
2875
3226
  });
2876
- case 29:
3227
+ case 30:
2877
3228
  return new P2pEvent.PeerSubscribed({
2878
3229
  peerId: FfiConverterString.readFromCursor(c),
2879
3230
  topic: FfiConverterString.readFromCursor(c)
2880
3231
  });
2881
- case 30:
3232
+ case 31:
2882
3233
  return new P2pEvent.PeerUnsubscribed({
2883
3234
  peerId: FfiConverterString.readFromCursor(c),
2884
3235
  topic: FfiConverterString.readFromCursor(c)
2885
3236
  });
2886
- case 31:
3237
+ case 32:
2887
3238
  return new P2pEvent.GossipsubOutboundFailure({
2888
3239
  peerId: FfiConverterString.readFromCursor(c),
2889
3240
  reason: FfiConverterString.readFromCursor(c)
2890
3241
  });
2891
- case 32:
3242
+ case 33:
2892
3243
  return new P2pEvent.GossipsubProtocolViolation({
2893
3244
  peerId: FfiConverterString.readFromCursor(c),
2894
3245
  reason: FfiConverterString.readFromCursor(c)
2895
3246
  });
2896
- case 33:
3247
+ case 34:
2897
3248
  return new P2pEvent.PeerDiscovered({
2898
3249
  peerId: FfiConverterString.readFromCursor(c),
2899
3250
  addrs: FfiConverterSequenceString.readFromCursor(c),
2900
3251
  source: FfiConverterTypeDiscoverySource.readFromCursor(c)
2901
3252
  });
2902
- case 34:
3253
+ case 35:
2903
3254
  return new P2pEvent.PeerUpdated({
2904
3255
  peerId: FfiConverterString.readFromCursor(c),
2905
3256
  addrs: FfiConverterSequenceString.readFromCursor(c),
2906
3257
  source: FfiConverterTypeDiscoverySource.readFromCursor(c)
2907
3258
  });
2908
- case 35:
3259
+ case 36:
2909
3260
  return new P2pEvent.PeerExpired({
2910
3261
  peerId: FfiConverterString.readFromCursor(c)
2911
3262
  });
2912
- case 36:
3263
+ case 37:
2913
3264
  return new P2pEvent.DiscoveryDialFailed({
2914
3265
  peerId: FfiConverterString.readFromCursor(c),
2915
3266
  reason: FfiConverterString.readFromCursor(c)
2916
3267
  });
2917
- case 37:
3268
+ case 38:
2918
3269
  return new P2pEvent.MdnsFailed({
2919
3270
  kind: FfiConverterTypeMdnsFailureKind.readFromCursor(c),
2920
3271
  detail: FfiConverterString.readFromCursor(c)
2921
3272
  });
2922
- case 38:
2923
- return new P2pEvent.MdnsRecovered();
2924
3273
  case 39:
3274
+ return new P2pEvent.MdnsRecovered();
3275
+ case 40:
2925
3276
  return new P2pEvent.DiscoveryProtocolViolation({
2926
3277
  peerId: FfiConverterOptionalString.readFromCursor(c),
2927
3278
  source: FfiConverterTypeDiscoverySource.readFromCursor(c),
@@ -2951,25 +3302,34 @@ const FfiConverterTypeP2pEvent = (() => {
2951
3302
  FfiConverterString.writeIntoCursor(inner.detail, c);
2952
3303
  return;
2953
3304
  }
2954
- case P2pEvent_Tags.ConnectionEstablished:
3305
+ case P2pEvent_Tags.EndpointClosed:
2955
3306
  {
2956
3307
  c.writeI32(3);
2957
3308
  const inner = value.inner;
3309
+ FfiConverterTypeCloseOutcome.writeIntoCursor(inner.outcome, c);
3310
+ FfiConverterSequenceTypeUnfinishedConnection.writeIntoCursor(inner.unfinished, c);
3311
+ return;
3312
+ }
3313
+ case P2pEvent_Tags.ConnectionEstablished:
3314
+ {
3315
+ c.writeI32(4);
3316
+ const inner = value.inner;
2958
3317
  FfiConverterString.writeIntoCursor(inner.peerId, c);
2959
3318
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
2960
3319
  return;
2961
3320
  }
2962
3321
  case P2pEvent_Tags.ConnectionClosed:
2963
3322
  {
2964
- c.writeI32(4);
3323
+ c.writeI32(5);
2965
3324
  const inner = value.inner;
2966
3325
  FfiConverterString.writeIntoCursor(inner.peerId, c);
2967
3326
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3327
+ FfiConverterTypeConnectionCloseReason.writeIntoCursor(inner.reason, c);
2968
3328
  return;
2969
3329
  }
2970
3330
  case P2pEvent_Tags.ConnectionReplaced:
2971
3331
  {
2972
- c.writeI32(5);
3332
+ c.writeI32(6);
2973
3333
  const inner = value.inner;
2974
3334
  FfiConverterString.writeIntoCursor(inner.peerId, c);
2975
3335
  FfiConverterUInt64.writeIntoCursor(inner.oldConnId, c);
@@ -2978,7 +3338,7 @@ const FfiConverterTypeP2pEvent = (() => {
2978
3338
  }
2979
3339
  case P2pEvent_Tags.PeerReady:
2980
3340
  {
2981
- c.writeI32(6);
3341
+ c.writeI32(7);
2982
3342
  const inner = value.inner;
2983
3343
  FfiConverterString.writeIntoCursor(inner.peerId, c);
2984
3344
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -2987,7 +3347,7 @@ const FfiConverterTypeP2pEvent = (() => {
2987
3347
  }
2988
3348
  case P2pEvent_Tags.IdentifyReceived:
2989
3349
  {
2990
- c.writeI32(7);
3350
+ c.writeI32(8);
2991
3351
  const inner = value.inner;
2992
3352
  FfiConverterString.writeIntoCursor(inner.peerId, c);
2993
3353
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -2996,7 +3356,7 @@ const FfiConverterTypeP2pEvent = (() => {
2996
3356
  }
2997
3357
  case P2pEvent_Tags.PingRttMeasured:
2998
3358
  {
2999
- c.writeI32(8);
3359
+ c.writeI32(9);
3000
3360
  const inner = value.inner;
3001
3361
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3002
3362
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3005,7 +3365,7 @@ const FfiConverterTypeP2pEvent = (() => {
3005
3365
  }
3006
3366
  case P2pEvent_Tags.PingTimeout:
3007
3367
  {
3008
- c.writeI32(9);
3368
+ c.writeI32(10);
3009
3369
  const inner = value.inner;
3010
3370
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3011
3371
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3013,7 +3373,7 @@ const FfiConverterTypeP2pEvent = (() => {
3013
3373
  }
3014
3374
  case P2pEvent_Tags.StreamReady:
3015
3375
  {
3016
- c.writeI32(10);
3376
+ c.writeI32(11);
3017
3377
  const inner = value.inner;
3018
3378
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3019
3379
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3024,7 +3384,7 @@ const FfiConverterTypeP2pEvent = (() => {
3024
3384
  }
3025
3385
  case P2pEvent_Tags.StreamData:
3026
3386
  {
3027
- c.writeI32(11);
3387
+ c.writeI32(12);
3028
3388
  const inner = value.inner;
3029
3389
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3030
3390
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3034,7 +3394,7 @@ const FfiConverterTypeP2pEvent = (() => {
3034
3394
  }
3035
3395
  case P2pEvent_Tags.StreamWriteAccepted:
3036
3396
  {
3037
- c.writeI32(12);
3397
+ c.writeI32(13);
3038
3398
  const inner = value.inner;
3039
3399
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3040
3400
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3043,7 +3403,7 @@ const FfiConverterTypeP2pEvent = (() => {
3043
3403
  }
3044
3404
  case P2pEvent_Tags.StreamWriteStopped:
3045
3405
  {
3046
- c.writeI32(13);
3406
+ c.writeI32(14);
3047
3407
  const inner = value.inner;
3048
3408
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3049
3409
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3053,7 +3413,7 @@ const FfiConverterTypeP2pEvent = (() => {
3053
3413
  }
3054
3414
  case P2pEvent_Tags.StreamRemoteWriteClosed:
3055
3415
  {
3056
- c.writeI32(14);
3416
+ c.writeI32(15);
3057
3417
  const inner = value.inner;
3058
3418
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3059
3419
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3062,7 +3422,7 @@ const FfiConverterTypeP2pEvent = (() => {
3062
3422
  }
3063
3423
  case P2pEvent_Tags.StreamClosed:
3064
3424
  {
3065
- c.writeI32(15);
3425
+ c.writeI32(16);
3066
3426
  const inner = value.inner;
3067
3427
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3068
3428
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3071,7 +3431,7 @@ const FfiConverterTypeP2pEvent = (() => {
3071
3431
  }
3072
3432
  case P2pEvent_Tags.EndpointError:
3073
3433
  {
3074
- c.writeI32(16);
3434
+ c.writeI32(17);
3075
3435
  const inner = value.inner;
3076
3436
  FfiConverterTypeEndpointErrorKind.writeIntoCursor(inner.kind, c);
3077
3437
  FfiConverterOptionalString.writeIntoCursor(inner.peerId, c);
@@ -3082,7 +3442,7 @@ const FfiConverterTypeP2pEvent = (() => {
3082
3442
  }
3083
3443
  case P2pEvent_Tags.ReachabilityChanged:
3084
3444
  {
3085
- c.writeI32(17);
3445
+ c.writeI32(18);
3086
3446
  const inner = value.inner;
3087
3447
  FfiConverterTypeReachability.writeIntoCursor(inner.previous, c);
3088
3448
  FfiConverterTypeReachability.writeIntoCursor(inner.current, c);
@@ -3091,14 +3451,14 @@ const FfiConverterTypeP2pEvent = (() => {
3091
3451
  }
3092
3452
  case P2pEvent_Tags.PublicAddressesChanged:
3093
3453
  {
3094
- c.writeI32(18);
3454
+ c.writeI32(19);
3095
3455
  const inner = value.inner;
3096
3456
  FfiConverterSequenceString.writeIntoCursor(inner.addrs, c);
3097
3457
  return;
3098
3458
  }
3099
3459
  case P2pEvent_Tags.RelayReserved:
3100
3460
  {
3101
- c.writeI32(19);
3461
+ c.writeI32(20);
3102
3462
  const inner = value.inner;
3103
3463
  FfiConverterString.writeIntoCursor(inner.relayPeerId, c);
3104
3464
  FfiConverterOptionalUInt64.writeIntoCursor(inner.expiresUnixSecs, c);
@@ -3106,14 +3466,14 @@ const FfiConverterTypeP2pEvent = (() => {
3106
3466
  }
3107
3467
  case P2pEvent_Tags.RelayReservationLost:
3108
3468
  {
3109
- c.writeI32(20);
3469
+ c.writeI32(21);
3110
3470
  const inner = value.inner;
3111
3471
  FfiConverterString.writeIntoCursor(inner.relayPeerId, c);
3112
3472
  return;
3113
3473
  }
3114
3474
  case P2pEvent_Tags.PathEstablished:
3115
3475
  {
3116
- c.writeI32(21);
3476
+ c.writeI32(22);
3117
3477
  const inner = value.inner;
3118
3478
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3119
3479
  FfiConverterString.writeIntoCursor(inner.peerId, c);
@@ -3123,7 +3483,7 @@ const FfiConverterTypeP2pEvent = (() => {
3123
3483
  }
3124
3484
  case P2pEvent_Tags.InboundPathEstablished:
3125
3485
  {
3126
- c.writeI32(22);
3486
+ c.writeI32(23);
3127
3487
  const inner = value.inner;
3128
3488
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3129
3489
  FfiConverterTypePathKind.writeIntoCursor(inner.path, c);
@@ -3132,7 +3492,7 @@ const FfiConverterTypeP2pEvent = (() => {
3132
3492
  }
3133
3493
  case P2pEvent_Tags.PathUpgraded:
3134
3494
  {
3135
- c.writeI32(23);
3495
+ c.writeI32(24);
3136
3496
  const inner = value.inner;
3137
3497
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3138
3498
  FfiConverterString.writeIntoCursor(inner.peerId, c);
@@ -3144,7 +3504,7 @@ const FfiConverterTypeP2pEvent = (() => {
3144
3504
  }
3145
3505
  case P2pEvent_Tags.HolePunchFailed:
3146
3506
  {
3147
- c.writeI32(24);
3507
+ c.writeI32(25);
3148
3508
  const inner = value.inner;
3149
3509
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3150
3510
  FfiConverterUInt32.writeIntoCursor(inner.attempt, c);
@@ -3153,7 +3513,7 @@ const FfiConverterTypeP2pEvent = (() => {
3153
3513
  }
3154
3514
  case P2pEvent_Tags.ConnectFailed:
3155
3515
  {
3156
- c.writeI32(25);
3516
+ c.writeI32(26);
3157
3517
  const inner = value.inner;
3158
3518
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3159
3519
  FfiConverterString.writeIntoCursor(inner.peerId, c);
@@ -3163,7 +3523,7 @@ const FfiConverterTypeP2pEvent = (() => {
3163
3523
  }
3164
3524
  case P2pEvent_Tags.ConnectCancelled:
3165
3525
  {
3166
- c.writeI32(26);
3526
+ c.writeI32(27);
3167
3527
  const inner = value.inner;
3168
3528
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3169
3529
  FfiConverterString.writeIntoCursor(inner.peerId, c);
@@ -3171,7 +3531,7 @@ const FfiConverterTypeP2pEvent = (() => {
3171
3531
  }
3172
3532
  case P2pEvent_Tags.InboundDirectUpgrade:
3173
3533
  {
3174
- c.writeI32(27);
3534
+ c.writeI32(28);
3175
3535
  const inner = value.inner;
3176
3536
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3177
3537
  FfiConverterUInt64.writeIntoCursor(inner.oldConnId, c);
@@ -3180,7 +3540,7 @@ const FfiConverterTypeP2pEvent = (() => {
3180
3540
  }
3181
3541
  case P2pEvent_Tags.Message:
3182
3542
  {
3183
- c.writeI32(28);
3543
+ c.writeI32(29);
3184
3544
  const inner = value.inner;
3185
3545
  FfiConverterString.writeIntoCursor(inner.fromPeerId, c);
3186
3546
  FfiConverterSequenceString.writeIntoCursor(inner.topics, c);
@@ -3191,7 +3551,7 @@ const FfiConverterTypeP2pEvent = (() => {
3191
3551
  }
3192
3552
  case P2pEvent_Tags.PeerSubscribed:
3193
3553
  {
3194
- c.writeI32(29);
3554
+ c.writeI32(30);
3195
3555
  const inner = value.inner;
3196
3556
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3197
3557
  FfiConverterString.writeIntoCursor(inner.topic, c);
@@ -3199,7 +3559,7 @@ const FfiConverterTypeP2pEvent = (() => {
3199
3559
  }
3200
3560
  case P2pEvent_Tags.PeerUnsubscribed:
3201
3561
  {
3202
- c.writeI32(30);
3562
+ c.writeI32(31);
3203
3563
  const inner = value.inner;
3204
3564
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3205
3565
  FfiConverterString.writeIntoCursor(inner.topic, c);
@@ -3207,7 +3567,7 @@ const FfiConverterTypeP2pEvent = (() => {
3207
3567
  }
3208
3568
  case P2pEvent_Tags.GossipsubOutboundFailure:
3209
3569
  {
3210
- c.writeI32(31);
3570
+ c.writeI32(32);
3211
3571
  const inner = value.inner;
3212
3572
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3213
3573
  FfiConverterString.writeIntoCursor(inner.reason, c);
@@ -3215,7 +3575,7 @@ const FfiConverterTypeP2pEvent = (() => {
3215
3575
  }
3216
3576
  case P2pEvent_Tags.GossipsubProtocolViolation:
3217
3577
  {
3218
- c.writeI32(32);
3578
+ c.writeI32(33);
3219
3579
  const inner = value.inner;
3220
3580
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3221
3581
  FfiConverterString.writeIntoCursor(inner.reason, c);
@@ -3223,7 +3583,7 @@ const FfiConverterTypeP2pEvent = (() => {
3223
3583
  }
3224
3584
  case P2pEvent_Tags.PeerDiscovered:
3225
3585
  {
3226
- c.writeI32(33);
3586
+ c.writeI32(34);
3227
3587
  const inner = value.inner;
3228
3588
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3229
3589
  FfiConverterSequenceString.writeIntoCursor(inner.addrs, c);
@@ -3232,7 +3592,7 @@ const FfiConverterTypeP2pEvent = (() => {
3232
3592
  }
3233
3593
  case P2pEvent_Tags.PeerUpdated:
3234
3594
  {
3235
- c.writeI32(34);
3595
+ c.writeI32(35);
3236
3596
  const inner = value.inner;
3237
3597
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3238
3598
  FfiConverterSequenceString.writeIntoCursor(inner.addrs, c);
@@ -3241,14 +3601,14 @@ const FfiConverterTypeP2pEvent = (() => {
3241
3601
  }
3242
3602
  case P2pEvent_Tags.PeerExpired:
3243
3603
  {
3244
- c.writeI32(35);
3604
+ c.writeI32(36);
3245
3605
  const inner = value.inner;
3246
3606
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3247
3607
  return;
3248
3608
  }
3249
3609
  case P2pEvent_Tags.DiscoveryDialFailed:
3250
3610
  {
3251
- c.writeI32(36);
3611
+ c.writeI32(37);
3252
3612
  const inner = value.inner;
3253
3613
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3254
3614
  FfiConverterString.writeIntoCursor(inner.reason, c);
@@ -3256,7 +3616,7 @@ const FfiConverterTypeP2pEvent = (() => {
3256
3616
  }
3257
3617
  case P2pEvent_Tags.MdnsFailed:
3258
3618
  {
3259
- c.writeI32(37);
3619
+ c.writeI32(38);
3260
3620
  const inner = value.inner;
3261
3621
  FfiConverterTypeMdnsFailureKind.writeIntoCursor(inner.kind, c);
3262
3622
  FfiConverterString.writeIntoCursor(inner.detail, c);
@@ -3264,12 +3624,12 @@ const FfiConverterTypeP2pEvent = (() => {
3264
3624
  }
3265
3625
  case P2pEvent_Tags.MdnsRecovered:
3266
3626
  {
3267
- c.writeI32(38);
3627
+ c.writeI32(39);
3268
3628
  return;
3269
3629
  }
3270
3630
  case P2pEvent_Tags.DiscoveryProtocolViolation:
3271
3631
  {
3272
- c.writeI32(39);
3632
+ c.writeI32(40);
3273
3633
  const inner = value.inner;
3274
3634
  FfiConverterOptionalString.writeIntoCursor(inner.peerId, c);
3275
3635
  FfiConverterTypeDiscoverySource.writeIntoCursor(inner.source, c);
@@ -3301,6 +3661,14 @@ const FfiConverterTypeP2pEvent = (() => {
3301
3661
  size += FfiConverterString.allocationSize(inner.detail);
3302
3662
  return size;
3303
3663
  }
3664
+ case P2pEvent_Tags.EndpointClosed:
3665
+ {
3666
+ const inner = value.inner;
3667
+ let size = 4;
3668
+ size += FfiConverterTypeCloseOutcome.allocationSize(inner.outcome);
3669
+ size += FfiConverterSequenceTypeUnfinishedConnection.allocationSize(inner.unfinished);
3670
+ return size;
3671
+ }
3304
3672
  case P2pEvent_Tags.ConnectionEstablished:
3305
3673
  {
3306
3674
  const inner = value.inner;
@@ -3315,6 +3683,7 @@ const FfiConverterTypeP2pEvent = (() => {
3315
3683
  let size = 4;
3316
3684
  size += FfiConverterString.allocationSize(inner.peerId);
3317
3685
  size += FfiConverterUInt64.allocationSize(inner.connId);
3686
+ size += FfiConverterTypeConnectionCloseReason.allocationSize(inner.reason);
3318
3687
  return size;
3319
3688
  }
3320
3689
  case P2pEvent_Tags.ConnectionReplaced:
@@ -3634,15 +4003,15 @@ const FfiConverterTypeP2pEvent = (() => {
3634
4003
  return new FFIConverter();
3635
4004
  })();
3636
4005
 
3637
- // FfiConverter for string | undefined
3638
- const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
3639
-
3640
4006
  // FfiConverter for Array<string>
3641
4007
  const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);
3642
4008
 
3643
4009
  // FfiConverter for Array<string> | undefined
3644
4010
  const FfiConverterOptionalSequenceString = new FfiConverterOptional(FfiConverterSequenceString);
3645
4011
 
4012
+ // FfiConverter for string | undefined
4013
+ const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
4014
+
3646
4015
  // FfiConverter for DiscoveryOptions | undefined
3647
4016
  const FfiConverterOptionalTypeDiscoveryOptions = new FfiConverterOptional(FfiConverterTypeDiscoveryOptions);
3648
4017
 
@@ -3658,6 +4027,9 @@ const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);
3658
4027
  // FfiConverter for Array<bigint>
3659
4028
  const FfiConverterSequenceUInt64 = new FfiConverterArray(FfiConverterUInt64);
3660
4029
 
4030
+ // FfiConverter for Array<UnfinishedConnection>
4031
+ const FfiConverterSequenceTypeUnfinishedConnection = new FfiConverterArray(FfiConverterTypeUnfinishedConnection);
4032
+
3661
4033
  /**
3662
4034
  * This should be called before anything else.
3663
4035
  *
@@ -3680,8 +4052,10 @@ function uniffiEnsureInitialized() {
3680
4052
  export default Object.freeze({
3681
4053
  initialize: uniffiEnsureInitialized,
3682
4054
  converters: {
4055
+ FfiConverterTypeCloseOutcome,
3683
4056
  FfiConverterTypeConfigCapability,
3684
4057
  FfiConverterTypeConnectTarget,
4058
+ FfiConverterTypeConnectionCloseReason,
3685
4059
  FfiConverterTypeConnectionInfo,
3686
4060
  FfiConverterTypeDiscoveryOptions,
3687
4061
  FfiConverterTypeDiscoverySource,
@@ -3698,7 +4072,8 @@ export default Object.freeze({
3698
4072
  FfiConverterTypeP2pEvent,
3699
4073
  FfiConverterTypePathKind,
3700
4074
  FfiConverterTypeReachability,
3701
- FfiConverterTypeRelayReservationInfo
4075
+ FfiConverterTypeRelayReservationInfo,
4076
+ FfiConverterTypeUnfinishedConnection
3702
4077
  }
3703
4078
  });
3704
4079
  //# sourceMappingURL=minip2p_ffi_core.js.map