@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
@@ -71,23 +71,206 @@ const stringConverter = (() => {
71
71
  })();
72
72
  const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
73
73
 
74
+
75
+ // Enum: PathKind
76
+ export enum PathKind_Tags {
77
+ Direct = "Direct",
78
+ Punched = "Punched",
79
+ Relayed = "Relayed"
80
+ }
74
81
  /**
75
- * State snapshot of the transport connection selected for a peer.
82
+ * How an established connection was made; see `minip2p::Path`.
83
+ */
84
+ export const PathKind = (() => {
85
+
86
+ type Direct__interface = {
87
+ tag: PathKind_Tags.Direct
88
+ };
89
+ /**
90
+ * A direct connection we dialed or accepted.
91
+ */
92
+ class Direct_ extends UniffiEnum implements Direct__interface {
93
+ /**
94
+ * @private
95
+ * This field is private and should not be used, use `tag` instead.
96
+ */
97
+ readonly [uniffiTypeNameSymbol] = "PathKind";
98
+ readonly tag = PathKind_Tags.Direct;
99
+ constructor() {
100
+ super("PathKind", "Direct");
101
+ }
102
+
103
+ static new(): Direct_ {
104
+ return new Direct_();
105
+ }
106
+
107
+ static instanceOf(obj: any): obj is Direct_ {
108
+ return obj.tag === PathKind_Tags.Direct;
109
+ }
110
+
111
+ }
112
+
113
+ type Punched__interface = {
114
+ tag: PathKind_Tags.Punched
115
+ };
116
+ /**
117
+ * A direct connection made by a DCUtR hole punch.
118
+ */
119
+ class Punched_ extends UniffiEnum implements Punched__interface {
120
+ /**
121
+ * @private
122
+ * This field is private and should not be used, use `tag` instead.
123
+ */
124
+ readonly [uniffiTypeNameSymbol] = "PathKind";
125
+ readonly tag = PathKind_Tags.Punched;
126
+ constructor() {
127
+ super("PathKind", "Punched");
128
+ }
129
+
130
+ static new(): Punched_ {
131
+ return new Punched_();
132
+ }
133
+
134
+ static instanceOf(obj: any): obj is Punched_ {
135
+ return obj.tag === PathKind_Tags.Punched;
136
+ }
137
+
138
+ }
139
+
140
+ type Relayed__interface = {
141
+ tag: PathKind_Tags.Relayed;
142
+ inner:
143
+ Readonly<{relayPeerId: string}>
144
+ };
145
+ /**
146
+ * Traffic is carried through a relay.
147
+ */
148
+ class Relayed_ extends UniffiEnum implements Relayed__interface {
149
+ /**
150
+ * @private
151
+ * This field is private and should not be used, use `tag` instead.
152
+ */
153
+ readonly [uniffiTypeNameSymbol] = "PathKind";
154
+ readonly tag = PathKind_Tags.Relayed;
155
+ readonly inner:
156
+ Readonly<{relayPeerId: string}>;
157
+ constructor(
158
+ inner: {relayPeerId: string }) {
159
+ super("PathKind", "Relayed");
160
+
161
+ this.inner = Object.freeze(inner);
162
+ }
163
+ static new(
164
+ inner: {relayPeerId: string }): Relayed_ {
165
+ return new Relayed_(inner);
166
+ }
167
+
168
+ static instanceOf(obj: any): obj is Relayed_ {
169
+ return obj.tag === PathKind_Tags.Relayed;
170
+ }
171
+
172
+ }
173
+
174
+ function instanceOf(obj: any): obj is PathKind {
175
+ return obj[uniffiTypeNameSymbol] === "PathKind";
176
+ }
177
+
178
+ return Object.freeze({
179
+ instanceOf,
180
+ Direct: Direct_,
181
+ Punched: Punched_,
182
+ Relayed: Relayed_
183
+ });
184
+
185
+ })();
186
+ /**
187
+ * How an established connection was made; see `minip2p::Path`.
188
+ */
189
+ export type PathKind = InstanceType<
190
+ typeof PathKind['Direct' | 'Punched' | 'Relayed']
191
+ >;
192
+
193
+ // FfiConverter for enum PathKind
194
+ const FfiConverterTypePathKind = (() => {
195
+ type TypeName = PathKind;
196
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
197
+ readFromCursor(c: Cursor): TypeName {
198
+ switch (c.readI32()) {
199
+ case 1: return new PathKind.Direct();
200
+ case 2: return new PathKind.Punched();
201
+ case 3: return new PathKind.Relayed({relayPeerId: FfiConverterString.readFromCursor(c) });
202
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
203
+ }
204
+ }
205
+ writeIntoCursor(value: TypeName, c: Cursor): void {
206
+ switch (value.tag) {
207
+ case PathKind_Tags.Direct: {
208
+ c.writeI32(1);
209
+ return;
210
+ }
211
+ case PathKind_Tags.Punched: {
212
+ c.writeI32(2);
213
+ return;
214
+ }
215
+ case PathKind_Tags.Relayed: {
216
+ c.writeI32(3);
217
+ const inner = value.inner;
218
+ FfiConverterString.writeIntoCursor(inner.relayPeerId, c);
219
+ return;
220
+ }
221
+ default:
222
+ // Throwing from here means that PathKind_Tags hasn't matched an ordinal.
223
+ throw new UniffiInternalError.UnexpectedEnumCase();
224
+ }
225
+ }
226
+ allocationSize(value: TypeName): number {
227
+ switch (value.tag) {
228
+ case PathKind_Tags.Direct: {
229
+ return 4;
230
+ }
231
+ case PathKind_Tags.Punched: {
232
+ return 4;
233
+ }
234
+ case PathKind_Tags.Relayed: {
235
+ const inner = value.inner;
236
+ let size = 4;
237
+ size += FfiConverterString.allocationSize(inner.relayPeerId);
238
+ return size;
239
+ }
240
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
241
+ }
242
+ }
243
+ }
244
+ return new FFIConverter();
245
+ })();
246
+
247
+ /**
248
+ * State snapshot of a peer's established connection; see
249
+ * `minip2p::ConnectionInfo`.
76
250
  */
77
251
  export type ConnectionInfo = {
252
+ /**
253
+ * The peer on the other end.
254
+ */
255
+ peerId: string,
78
256
  /**
79
257
  * Endpoint-local transport connection id.
80
258
  */
81
259
  connId: bigint,
82
260
  /**
83
- * Remote transport address, when recorded.
261
+ * Remote transport address the transport reported; a circuit reports
262
+ * `/p2p/<relay>/p2p-circuit`.
263
+ */
264
+ remoteAddr: string,
265
+ /**
266
+ * How the connection was made.
84
267
  */
85
- remoteAddr?: string,
268
+ path: PathKind,
86
269
  /**
87
270
  * Protocols this connection advertised through Identify, once it is
88
- * ready (`PeerReady` for this `conn_id`); `None` until then. Readiness,
89
- * connection and protocols come from one snapshot, so a ready wait can
90
- * trust them together.
271
+ * ready (`PeerReady` for this `conn_id`); `None` until then, distinct
272
+ * from an empty list. Readiness, connection and protocols come from one
273
+ * snapshot, so a ready wait can trust them together.
91
274
  */
92
275
  readyProtocols?: Array<string>
93
276
  }
@@ -113,19 +296,25 @@ const FfiConverterTypeConnectionInfo = (() => {
113
296
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
114
297
  readFromCursor(c: Cursor): TypeName {
115
298
  return {
299
+ peerId: FfiConverterString.readFromCursor(c),
116
300
  connId: FfiConverterUInt64.readFromCursor(c),
117
- remoteAddr: FfiConverterOptionalString.readFromCursor(c),
301
+ remoteAddr: FfiConverterString.readFromCursor(c),
302
+ path: FfiConverterTypePathKind.readFromCursor(c),
118
303
  readyProtocols: FfiConverterOptionalSequenceString.readFromCursor(c)
119
304
  };
120
305
  }
121
306
  writeIntoCursor(value: TypeName, c: Cursor): void {
307
+ FfiConverterString.writeIntoCursor(value.peerId, c);
122
308
  FfiConverterUInt64.writeIntoCursor(value.connId, c);
123
- FfiConverterOptionalString.writeIntoCursor(value.remoteAddr, c);
309
+ FfiConverterString.writeIntoCursor(value.remoteAddr, c);
310
+ FfiConverterTypePathKind.writeIntoCursor(value.path, c);
124
311
  FfiConverterOptionalSequenceString.writeIntoCursor(value.readyProtocols, c);
125
312
  }
126
313
  allocationSize(value: TypeName): number {
127
- return FfiConverterUInt64.allocationSize(value.connId) +
128
- FfiConverterOptionalString.allocationSize(value.remoteAddr) +
314
+ return FfiConverterString.allocationSize(value.peerId) +
315
+ FfiConverterUInt64.allocationSize(value.connId) +
316
+ FfiConverterString.allocationSize(value.remoteAddr) +
317
+ FfiConverterTypePathKind.allocationSize(value.path) +
129
318
  FfiConverterOptionalSequenceString.allocationSize(value.readyProtocols);
130
319
 
131
320
  }
@@ -662,6 +851,164 @@ const FfiConverterTypeRelayReservationInfo = (() => {
662
851
  return new FFIConverter();
663
852
  })();
664
853
 
854
+ /**
855
+ * A connection still tracked when the closing drain ended.
856
+ */
857
+ export type UnfinishedConnection = {
858
+ /**
859
+ * Endpoint-local transport connection id.
860
+ */
861
+ connId: bigint,
862
+ /**
863
+ * Remote peer; `None` for an inbound handshake that had not identified
864
+ * one yet.
865
+ */
866
+ peerId?: string
867
+ }
868
+
869
+ /**
870
+ * Generated factory for {@link UnfinishedConnection} record objects.
871
+ */
872
+ export const UnfinishedConnection = (() => {
873
+ const defaults = () => ({
874
+ });
875
+ const create = (() => {
876
+ return uniffiCreateRecord<UnfinishedConnection, ReturnType<typeof defaults>>(defaults);
877
+ })();
878
+ return Object.freeze({
879
+ create,
880
+ new: create,
881
+ defaults: () => Object.freeze(defaults()) as Partial<UnfinishedConnection>,
882
+ });
883
+ })();
884
+
885
+ const FfiConverterTypeUnfinishedConnection = (() => {
886
+ type TypeName = UnfinishedConnection;
887
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
888
+ readFromCursor(c: Cursor): TypeName {
889
+ return {
890
+ connId: FfiConverterUInt64.readFromCursor(c),
891
+ peerId: FfiConverterOptionalString.readFromCursor(c)
892
+ };
893
+ }
894
+ writeIntoCursor(value: TypeName, c: Cursor): void {
895
+ FfiConverterUInt64.writeIntoCursor(value.connId, c);
896
+ FfiConverterOptionalString.writeIntoCursor(value.peerId, c);
897
+ }
898
+ allocationSize(value: TypeName): number {
899
+ return FfiConverterUInt64.allocationSize(value.connId) +
900
+ FfiConverterOptionalString.allocationSize(value.peerId);
901
+
902
+ }
903
+ };
904
+ return new FFIConverter();
905
+ })();
906
+
907
+ /**
908
+ * How the driver's closing drain ended; see [`P2pEvent::EndpointClosed`].
909
+ */
910
+ export enum CloseOutcome {
911
+ /**
912
+ * Every tracked connection finished its teardown in time.
913
+ */
914
+ Drained,
915
+ /**
916
+ * The stop deadline passed with connections still tracked.
917
+ */
918
+ DeadlineExpired,
919
+ /**
920
+ * Driving the transports failed and ended the drain early, or the
921
+ * driver panicked and dropped the endpoint without a drain.
922
+ */
923
+ Failed
924
+ }
925
+
926
+ const FfiConverterTypeCloseOutcome = (() => {
927
+ type TypeName = CloseOutcome;
928
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
929
+ readFromCursor(c: Cursor): TypeName {
930
+ switch (c.readI32()) {
931
+ case 1: return CloseOutcome.Drained;
932
+ case 2: return CloseOutcome.DeadlineExpired;
933
+ case 3: return CloseOutcome.Failed;
934
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
935
+ }
936
+ }
937
+ writeIntoCursor(value: TypeName, c: Cursor): void {
938
+ switch (value) {
939
+ case CloseOutcome.Drained: return c.writeI32(1);
940
+ case CloseOutcome.DeadlineExpired: return c.writeI32(2);
941
+ case CloseOutcome.Failed: return c.writeI32(3);
942
+ }
943
+ }
944
+ allocationSize(value: TypeName): number {
945
+ return 4;
946
+ }
947
+ }
948
+ return new FFIConverter();
949
+ })();
950
+
951
+ /**
952
+ * The part of an endpoint's configuration an [`FfiError::InvalidConfig`]
953
+ * names.
954
+ *
955
+ * A configuration mistake is fixed by changing that part; an environment
956
+ * failure (a socket the platform refused) is [`FfiError::Transport`]
957
+ * instead.
958
+ */
959
+ export enum ConfigCapability {
960
+ /**
961
+ * Gossipsub settings.
962
+ */
963
+ Gossipsub,
964
+ /**
965
+ * mDNS settings.
966
+ */
967
+ Mdns,
968
+ /**
969
+ * Signed discovery or peer-book settings.
970
+ */
971
+ Discovery,
972
+ /**
973
+ * QUIC or TCP transport settings (limits, TLS, the TCP namespace).
974
+ */
975
+ Transport,
976
+ /**
977
+ * The endpoint's own options: listen addresses, protocols, NAT and
978
+ * relay policy, auto-dial.
979
+ */
980
+ Options
981
+ }
982
+
983
+ const FfiConverterTypeConfigCapability = (() => {
984
+ type TypeName = ConfigCapability;
985
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
986
+ readFromCursor(c: Cursor): TypeName {
987
+ switch (c.readI32()) {
988
+ case 1: return ConfigCapability.Gossipsub;
989
+ case 2: return ConfigCapability.Mdns;
990
+ case 3: return ConfigCapability.Discovery;
991
+ case 4: return ConfigCapability.Transport;
992
+ case 5: return ConfigCapability.Options;
993
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
994
+ }
995
+ }
996
+ writeIntoCursor(value: TypeName, c: Cursor): void {
997
+ switch (value) {
998
+ case ConfigCapability.Gossipsub: return c.writeI32(1);
999
+ case ConfigCapability.Mdns: return c.writeI32(2);
1000
+ case ConfigCapability.Discovery: return c.writeI32(3);
1001
+ case ConfigCapability.Transport: return c.writeI32(4);
1002
+ case ConfigCapability.Options: return c.writeI32(5);
1003
+ }
1004
+ }
1005
+ allocationSize(value: TypeName): number {
1006
+ return 4;
1007
+ }
1008
+ }
1009
+ return new FFIConverter();
1010
+ })();
1011
+
665
1012
 
666
1013
  // Enum: ConnectTarget
667
1014
  export enum ConnectTarget_Tags {
@@ -676,139 +1023,399 @@ export enum ConnectTarget_Tags {
676
1023
  */
677
1024
  export const ConnectTarget = (() => {
678
1025
 
679
- type Peer__interface = {
680
- tag: ConnectTarget_Tags.Peer;
1026
+ type Peer__interface = {
1027
+ tag: ConnectTarget_Tags.Peer;
1028
+ inner:
1029
+ Readonly<{peerId: string}>
1030
+ };
1031
+ /**
1032
+ * Peer ID only: the endpoint applies its discovery-book and relay
1033
+ * policy.
1034
+ */
1035
+ class Peer_ extends UniffiEnum implements Peer__interface {
1036
+ /**
1037
+ * @private
1038
+ * This field is private and should not be used, use `tag` instead.
1039
+ */
1040
+ readonly [uniffiTypeNameSymbol] = "ConnectTarget";
1041
+ readonly tag = ConnectTarget_Tags.Peer;
1042
+ readonly inner:
1043
+ Readonly<{peerId: string}>;
1044
+ constructor(
1045
+ inner: {peerId: string }) {
1046
+ super("ConnectTarget", "Peer");
1047
+
1048
+ this.inner = Object.freeze(inner);
1049
+ }
1050
+ static new(
1051
+ inner: {peerId: string }): Peer_ {
1052
+ return new Peer_(inner);
1053
+ }
1054
+
1055
+ static instanceOf(obj: any): obj is Peer_ {
1056
+ return obj.tag === ConnectTarget_Tags.Peer;
1057
+ }
1058
+
1059
+ }
1060
+
1061
+ type Addresses__interface = {
1062
+ tag: ConnectTarget_Tags.Addresses;
1063
+ inner:
1064
+ Readonly<{addresses: Array<string>}>
1065
+ };
1066
+ /**
1067
+ * One or more complete direct peer addresses that all name the same
1068
+ * peer. One address is the single-address form.
1069
+ */
1070
+ class Addresses_ extends UniffiEnum implements Addresses__interface {
1071
+ /**
1072
+ * @private
1073
+ * This field is private and should not be used, use `tag` instead.
1074
+ */
1075
+ readonly [uniffiTypeNameSymbol] = "ConnectTarget";
1076
+ readonly tag = ConnectTarget_Tags.Addresses;
1077
+ readonly inner:
1078
+ Readonly<{addresses: Array<string>}>;
1079
+ constructor(
1080
+ inner: {addresses: Array<string> }) {
1081
+ super("ConnectTarget", "Addresses");
1082
+
1083
+ this.inner = Object.freeze(inner);
1084
+ }
1085
+ static new(
1086
+ inner: {addresses: Array<string> }): Addresses_ {
1087
+ return new Addresses_(inner);
1088
+ }
1089
+
1090
+ static instanceOf(obj: any): obj is Addresses_ {
1091
+ return obj.tag === ConnectTarget_Tags.Addresses;
1092
+ }
1093
+
1094
+ }
1095
+
1096
+ function instanceOf(obj: any): obj is ConnectTarget {
1097
+ return obj[uniffiTypeNameSymbol] === "ConnectTarget";
1098
+ }
1099
+
1100
+ return Object.freeze({
1101
+ instanceOf,
1102
+ Peer: Peer_,
1103
+ Addresses: Addresses_
1104
+ });
1105
+
1106
+ })();
1107
+ /**
1108
+ * What a foreign runtime supplies to start one Connection attempt.
1109
+ *
1110
+ * Validation for every form lives in this module, once; binding shells only
1111
+ * adapt the shape to their toolchain.
1112
+ */
1113
+ export type ConnectTarget = InstanceType<
1114
+ typeof ConnectTarget['Peer' | 'Addresses']
1115
+ >;
1116
+
1117
+ // FfiConverter for enum ConnectTarget
1118
+ const FfiConverterTypeConnectTarget = (() => {
1119
+ type TypeName = ConnectTarget;
1120
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1121
+ readFromCursor(c: Cursor): TypeName {
1122
+ switch (c.readI32()) {
1123
+ case 1: return new ConnectTarget.Peer({peerId: FfiConverterString.readFromCursor(c) });
1124
+ case 2: return new ConnectTarget.Addresses({addresses: FfiConverterSequenceString.readFromCursor(c) });
1125
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
1126
+ }
1127
+ }
1128
+ writeIntoCursor(value: TypeName, c: Cursor): void {
1129
+ switch (value.tag) {
1130
+ case ConnectTarget_Tags.Peer: {
1131
+ c.writeI32(1);
1132
+ const inner = value.inner;
1133
+ FfiConverterString.writeIntoCursor(inner.peerId, c);
1134
+ return;
1135
+ }
1136
+ case ConnectTarget_Tags.Addresses: {
1137
+ c.writeI32(2);
1138
+ const inner = value.inner;
1139
+ FfiConverterSequenceString.writeIntoCursor(inner.addresses, c);
1140
+ return;
1141
+ }
1142
+ default:
1143
+ // Throwing from here means that ConnectTarget_Tags hasn't matched an ordinal.
1144
+ throw new UniffiInternalError.UnexpectedEnumCase();
1145
+ }
1146
+ }
1147
+ allocationSize(value: TypeName): number {
1148
+ switch (value.tag) {
1149
+ case ConnectTarget_Tags.Peer: {
1150
+ const inner = value.inner;
1151
+ let size = 4;
1152
+ size += FfiConverterString.allocationSize(inner.peerId);
1153
+ return size;
1154
+ }
1155
+ case ConnectTarget_Tags.Addresses: {
1156
+ const inner = value.inner;
1157
+ let size = 4;
1158
+ size += FfiConverterSequenceString.allocationSize(inner.addresses);
1159
+ return size;
1160
+ }
1161
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
1162
+ }
1163
+ }
1164
+ }
1165
+ return new FFIConverter();
1166
+ })();
1167
+
1168
+
1169
+ // Enum: ConnectionCloseReason
1170
+ export enum ConnectionCloseReason_Tags {
1171
+ Local = "Local",
1172
+ Remote = "Remote",
1173
+ TimedOut = "TimedOut",
1174
+ Stalled = "Stalled",
1175
+ Error = "Error"
1176
+ }
1177
+ /**
1178
+ * Why one connection ended; see `minip2p::ConnectionCloseReason`.
1179
+ */
1180
+ export const ConnectionCloseReason = (() => {
1181
+
1182
+ type Local__interface = {
1183
+ tag: ConnectionCloseReason_Tags.Local
1184
+ };
1185
+ /**
1186
+ * We closed it.
1187
+ */
1188
+ class Local_ extends UniffiEnum implements Local__interface {
1189
+ /**
1190
+ * @private
1191
+ * This field is private and should not be used, use `tag` instead.
1192
+ */
1193
+ readonly [uniffiTypeNameSymbol] = "ConnectionCloseReason";
1194
+ readonly tag = ConnectionCloseReason_Tags.Local;
1195
+ constructor() {
1196
+ super("ConnectionCloseReason", "Local");
1197
+ }
1198
+
1199
+ static new(): Local_ {
1200
+ return new Local_();
1201
+ }
1202
+
1203
+ static instanceOf(obj: any): obj is Local_ {
1204
+ return obj.tag === ConnectionCloseReason_Tags.Local;
1205
+ }
1206
+
1207
+ }
1208
+
1209
+ type Remote__interface = {
1210
+ tag: ConnectionCloseReason_Tags.Remote;
681
1211
  inner:
682
- Readonly<{peerId: string}>
1212
+ Readonly<{code: bigint}>
683
1213
  };
684
1214
  /**
685
- * Peer ID only: the endpoint applies its discovery-book and relay
686
- * policy.
1215
+ * The peer closed it with `code`: its QUIC CONNECTION_CLOSE code, or
1216
+ * its Yamux `GoAway` code on TCP and relay circuits.
687
1217
  */
688
- class Peer_ extends UniffiEnum implements Peer__interface {
1218
+ class Remote_ extends UniffiEnum implements Remote__interface {
689
1219
  /**
690
1220
  * @private
691
1221
  * This field is private and should not be used, use `tag` instead.
692
1222
  */
693
- readonly [uniffiTypeNameSymbol] = "ConnectTarget";
694
- readonly tag = ConnectTarget_Tags.Peer;
1223
+ readonly [uniffiTypeNameSymbol] = "ConnectionCloseReason";
1224
+ readonly tag = ConnectionCloseReason_Tags.Remote;
695
1225
  readonly inner:
696
- Readonly<{peerId: string}>;
1226
+ Readonly<{code: bigint}>;
697
1227
  constructor(
698
- inner: {peerId: string }) {
699
- super("ConnectTarget", "Peer");
1228
+ inner: {code: bigint }) {
1229
+ super("ConnectionCloseReason", "Remote");
700
1230
 
701
1231
  this.inner = Object.freeze(inner);
702
1232
  }
703
1233
  static new(
704
- inner: {peerId: string }): Peer_ {
705
- return new Peer_(inner);
1234
+ inner: {code: bigint }): Remote_ {
1235
+ return new Remote_(inner);
706
1236
  }
707
1237
 
708
- static instanceOf(obj: any): obj is Peer_ {
709
- return obj.tag === ConnectTarget_Tags.Peer;
1238
+ static instanceOf(obj: any): obj is Remote_ {
1239
+ return obj.tag === ConnectionCloseReason_Tags.Remote;
710
1240
  }
711
1241
 
712
1242
  }
713
1243
 
714
- type Addresses__interface = {
715
- tag: ConnectTarget_Tags.Addresses;
1244
+ type TimedOut__interface = {
1245
+ tag: ConnectionCloseReason_Tags.TimedOut
1246
+ };
1247
+ /**
1248
+ * The peer went silent (an idle, keepalive or handshake timeout).
1249
+ */
1250
+ class TimedOut_ extends UniffiEnum implements TimedOut__interface {
1251
+ /**
1252
+ * @private
1253
+ * This field is private and should not be used, use `tag` instead.
1254
+ */
1255
+ readonly [uniffiTypeNameSymbol] = "ConnectionCloseReason";
1256
+ readonly tag = ConnectionCloseReason_Tags.TimedOut;
1257
+ constructor() {
1258
+ super("ConnectionCloseReason", "TimedOut");
1259
+ }
1260
+
1261
+ static new(): TimedOut_ {
1262
+ return new TimedOut_();
1263
+ }
1264
+
1265
+ static instanceOf(obj: any): obj is TimedOut_ {
1266
+ return obj.tag === ConnectionCloseReason_Tags.TimedOut;
1267
+ }
1268
+
1269
+ }
1270
+
1271
+ type Stalled__interface = {
1272
+ tag: ConnectionCloseReason_Tags.Stalled
1273
+ };
1274
+ /**
1275
+ * The peer stopped reading (a TCP send stall).
1276
+ */
1277
+ class Stalled_ extends UniffiEnum implements Stalled__interface {
1278
+ /**
1279
+ * @private
1280
+ * This field is private and should not be used, use `tag` instead.
1281
+ */
1282
+ readonly [uniffiTypeNameSymbol] = "ConnectionCloseReason";
1283
+ readonly tag = ConnectionCloseReason_Tags.Stalled;
1284
+ constructor() {
1285
+ super("ConnectionCloseReason", "Stalled");
1286
+ }
1287
+
1288
+ static new(): Stalled_ {
1289
+ return new Stalled_();
1290
+ }
1291
+
1292
+ static instanceOf(obj: any): obj is Stalled_ {
1293
+ return obj.tag === ConnectionCloseReason_Tags.Stalled;
1294
+ }
1295
+
1296
+ }
1297
+
1298
+ type Error__interface = {
1299
+ tag: ConnectionCloseReason_Tags.Error;
716
1300
  inner:
717
- Readonly<{addresses: Array<string>}>
1301
+ Readonly<{message: string}>
718
1302
  };
719
1303
  /**
720
- * One or more complete direct peer addresses that all name the same
721
- * peer. One address is the single-address form.
1304
+ * Anything else that ended it.
722
1305
  */
723
- class Addresses_ extends UniffiEnum implements Addresses__interface {
1306
+ class Error_ extends UniffiEnum implements Error__interface {
724
1307
  /**
725
1308
  * @private
726
1309
  * This field is private and should not be used, use `tag` instead.
727
1310
  */
728
- readonly [uniffiTypeNameSymbol] = "ConnectTarget";
729
- readonly tag = ConnectTarget_Tags.Addresses;
1311
+ readonly [uniffiTypeNameSymbol] = "ConnectionCloseReason";
1312
+ readonly tag = ConnectionCloseReason_Tags.Error;
730
1313
  readonly inner:
731
- Readonly<{addresses: Array<string>}>;
1314
+ Readonly<{message: string}>;
732
1315
  constructor(
733
- inner: {addresses: Array<string> }) {
734
- super("ConnectTarget", "Addresses");
1316
+ inner: {message: string }) {
1317
+ super("ConnectionCloseReason", "Error");
735
1318
 
736
1319
  this.inner = Object.freeze(inner);
737
1320
  }
738
1321
  static new(
739
- inner: {addresses: Array<string> }): Addresses_ {
740
- return new Addresses_(inner);
1322
+ inner: {message: string }): Error_ {
1323
+ return new Error_(inner);
741
1324
  }
742
1325
 
743
- static instanceOf(obj: any): obj is Addresses_ {
744
- return obj.tag === ConnectTarget_Tags.Addresses;
1326
+ static instanceOf(obj: any): obj is Error_ {
1327
+ return obj.tag === ConnectionCloseReason_Tags.Error;
745
1328
  }
746
1329
 
747
1330
  }
748
1331
 
749
- function instanceOf(obj: any): obj is ConnectTarget {
750
- return obj[uniffiTypeNameSymbol] === "ConnectTarget";
1332
+ function instanceOf(obj: any): obj is ConnectionCloseReason {
1333
+ return obj[uniffiTypeNameSymbol] === "ConnectionCloseReason";
751
1334
  }
752
1335
 
753
1336
  return Object.freeze({
754
1337
  instanceOf,
755
- Peer: Peer_,
756
- Addresses: Addresses_
1338
+ Local: Local_,
1339
+ Remote: Remote_,
1340
+ TimedOut: TimedOut_,
1341
+ Stalled: Stalled_,
1342
+ Error: Error_
757
1343
  });
758
1344
 
759
1345
  })();
760
1346
  /**
761
- * What a foreign runtime supplies to start one Connection attempt.
762
- *
763
- * Validation for every form lives in this module, once; binding shells only
764
- * adapt the shape to their toolchain.
1347
+ * Why one connection ended; see `minip2p::ConnectionCloseReason`.
765
1348
  */
766
- export type ConnectTarget = InstanceType<
767
- typeof ConnectTarget['Peer' | 'Addresses']
1349
+ export type ConnectionCloseReason = InstanceType<
1350
+ typeof ConnectionCloseReason['Local' | 'Remote' | 'TimedOut' | 'Stalled' | 'Error']
768
1351
  >;
769
1352
 
770
- // FfiConverter for enum ConnectTarget
771
- const FfiConverterTypeConnectTarget = (() => {
772
- type TypeName = ConnectTarget;
1353
+ // FfiConverter for enum ConnectionCloseReason
1354
+ const FfiConverterTypeConnectionCloseReason = (() => {
1355
+ type TypeName = ConnectionCloseReason;
773
1356
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
774
1357
  readFromCursor(c: Cursor): TypeName {
775
1358
  switch (c.readI32()) {
776
- case 1: return new ConnectTarget.Peer({peerId: FfiConverterString.readFromCursor(c) });
777
- case 2: return new ConnectTarget.Addresses({addresses: FfiConverterSequenceString.readFromCursor(c) });
1359
+ case 1: return new ConnectionCloseReason.Local();
1360
+ case 2: return new ConnectionCloseReason.Remote({code: FfiConverterUInt64.readFromCursor(c) });
1361
+ case 3: return new ConnectionCloseReason.TimedOut();
1362
+ case 4: return new ConnectionCloseReason.Stalled();
1363
+ case 5: return new ConnectionCloseReason.Error({message: FfiConverterString.readFromCursor(c) });
778
1364
  default: throw new UniffiInternalError.UnexpectedEnumCase();
779
1365
  }
780
1366
  }
781
1367
  writeIntoCursor(value: TypeName, c: Cursor): void {
782
1368
  switch (value.tag) {
783
- case ConnectTarget_Tags.Peer: {
1369
+ case ConnectionCloseReason_Tags.Local: {
784
1370
  c.writeI32(1);
785
- const inner = value.inner;
786
- FfiConverterString.writeIntoCursor(inner.peerId, c);
787
1371
  return;
788
1372
  }
789
- case ConnectTarget_Tags.Addresses: {
1373
+ case ConnectionCloseReason_Tags.Remote: {
790
1374
  c.writeI32(2);
791
1375
  const inner = value.inner;
792
- FfiConverterSequenceString.writeIntoCursor(inner.addresses, c);
1376
+ FfiConverterUInt64.writeIntoCursor(inner.code, c);
1377
+ return;
1378
+ }
1379
+ case ConnectionCloseReason_Tags.TimedOut: {
1380
+ c.writeI32(3);
1381
+ return;
1382
+ }
1383
+ case ConnectionCloseReason_Tags.Stalled: {
1384
+ c.writeI32(4);
1385
+ return;
1386
+ }
1387
+ case ConnectionCloseReason_Tags.Error: {
1388
+ c.writeI32(5);
1389
+ const inner = value.inner;
1390
+ FfiConverterString.writeIntoCursor(inner.message, c);
793
1391
  return;
794
1392
  }
795
1393
  default:
796
- // Throwing from here means that ConnectTarget_Tags hasn't matched an ordinal.
1394
+ // Throwing from here means that ConnectionCloseReason_Tags hasn't matched an ordinal.
797
1395
  throw new UniffiInternalError.UnexpectedEnumCase();
798
1396
  }
799
1397
  }
800
1398
  allocationSize(value: TypeName): number {
801
1399
  switch (value.tag) {
802
- case ConnectTarget_Tags.Peer: {
1400
+ case ConnectionCloseReason_Tags.Local: {
1401
+ return 4;
1402
+ }
1403
+ case ConnectionCloseReason_Tags.Remote: {
803
1404
  const inner = value.inner;
804
1405
  let size = 4;
805
- size += FfiConverterString.allocationSize(inner.peerId);
1406
+ size += FfiConverterUInt64.allocationSize(inner.code);
806
1407
  return size;
807
1408
  }
808
- case ConnectTarget_Tags.Addresses: {
1409
+ case ConnectionCloseReason_Tags.TimedOut: {
1410
+ return 4;
1411
+ }
1412
+ case ConnectionCloseReason_Tags.Stalled: {
1413
+ return 4;
1414
+ }
1415
+ case ConnectionCloseReason_Tags.Error: {
809
1416
  const inner = value.inner;
810
1417
  let size = 4;
811
- size += FfiConverterSequenceString.allocationSize(inner.addresses);
1418
+ size += FfiConverterString.allocationSize(inner.message);
812
1419
  return size;
813
1420
  }
814
1421
  default: throw new UniffiInternalError.UnexpectedEnumCase();
@@ -1062,10 +1669,11 @@ export const FfiError = (() => {
1062
1669
  type InvalidConfig__interface = {
1063
1670
  tag: FfiError_Tags.InvalidConfig;
1064
1671
  inner:
1065
- Readonly<{detail: string}>
1672
+ Readonly<{capability: ConfigCapability; detail: string}>
1066
1673
  };
1067
1674
  /**
1068
- * Endpoint configuration was internally inconsistent.
1675
+ * Endpoint configuration was invalid; `capability` names the part of
1676
+ * it that was.
1069
1677
  */
1070
1678
  class InvalidConfig_ extends UniffiError implements InvalidConfig__interface {
1071
1679
  /**
@@ -1075,15 +1683,15 @@ Readonly<{detail: string}>
1075
1683
  readonly [uniffiTypeNameSymbol] = "FfiError";
1076
1684
  readonly tag = FfiError_Tags.InvalidConfig;
1077
1685
  readonly inner:
1078
- Readonly<{detail: string}>;
1686
+ Readonly<{capability: ConfigCapability; detail: string}>;
1079
1687
  constructor(
1080
- inner: {detail: string }) {
1688
+ inner: {capability: ConfigCapability; detail: string }) {
1081
1689
  super("FfiError", "InvalidConfig");
1082
1690
 
1083
1691
  this.inner = Object.freeze(inner);
1084
1692
  }
1085
1693
  static new(
1086
- inner: {detail: string }): InvalidConfig_ {
1694
+ inner: {capability: ConfigCapability; detail: string }): InvalidConfig_ {
1087
1695
  return new InvalidConfig_(inner);
1088
1696
  }
1089
1697
 
@@ -1095,7 +1703,7 @@ inner: {detail: string }): InvalidConfig_ {
1095
1703
  }
1096
1704
 
1097
1705
  static getInner(obj: InvalidConfig_):
1098
- Readonly<{detail: string}> {
1706
+ Readonly<{capability: ConfigCapability; detail: string}> {
1099
1707
  return obj.inner;
1100
1708
  }
1101
1709
 
@@ -1377,7 +1985,8 @@ Readonly<{detail: string}> {
1377
1985
  Readonly<{detail: string}>
1378
1986
  };
1379
1987
  /**
1380
- * A synchronous transport operation failed.
1988
+ * A synchronous transport operation failed, or the platform refused a
1989
+ * socket the endpoint needed (a port in use, say).
1381
1990
  */
1382
1991
  class Transport_ extends UniffiError implements Transport__interface {
1383
1992
  /**
@@ -1534,7 +2143,7 @@ const FfiConverterTypeFfiError = (() => {
1534
2143
  switch (c.readI32()) {
1535
2144
  case 1: return new FfiError.AlreadyStarted();
1536
2145
  case 2: return new FfiError.Stopped();
1537
- case 3: return new FfiError.InvalidConfig({detail: FfiConverterString.readFromCursor(c) });
2146
+ case 3: return new FfiError.InvalidConfig({capability: FfiConverterTypeConfigCapability.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
1538
2147
  case 4: return new FfiError.InvalidKey({detail: FfiConverterString.readFromCursor(c) });
1539
2148
  case 5: return new FfiError.InvalidPeerId({detail: FfiConverterString.readFromCursor(c) });
1540
2149
  case 6: return new FfiError.InvalidAddress({detail: FfiConverterString.readFromCursor(c) });
@@ -1561,6 +2170,7 @@ const FfiConverterTypeFfiError = (() => {
1561
2170
  case FfiError_Tags.InvalidConfig: {
1562
2171
  c.writeI32(3);
1563
2172
  const inner = value.inner;
2173
+ FfiConverterTypeConfigCapability.writeIntoCursor(inner.capability, c);
1564
2174
  FfiConverterString.writeIntoCursor(inner.detail, c);
1565
2175
  return;
1566
2176
  }
@@ -1636,6 +2246,7 @@ const FfiConverterTypeFfiError = (() => {
1636
2246
  case FfiError_Tags.InvalidConfig: {
1637
2247
  const inner = value.inner;
1638
2248
  let size = 4;
2249
+ size += FfiConverterTypeConfigCapability.allocationSize(inner.capability);
1639
2250
  size += FfiConverterString.allocationSize(inner.detail);
1640
2251
  return size;
1641
2252
  }
@@ -1701,94 +2312,64 @@ const FfiConverterTypeFfiError = (() => {
1701
2312
  })();
1702
2313
 
1703
2314
  /**
1704
- * Category of a failed NAT connection attempt.
2315
+ * Category of an mDNS failure.
1705
2316
  */
1706
- export enum NatErrorKind {
1707
- /**
1708
- * No usable direct or relayed path exists.
1709
- */
1710
- NoPathAvailable,
2317
+ export enum MdnsFailureKind {
1711
2318
  /**
1712
- * The connection attempt timed out.
2319
+ * The platform cannot provide mDNS sockets.
1713
2320
  */
1714
- Timeout,
2321
+ Unsupported,
1715
2322
  /**
1716
- * A transport dial failed.
2323
+ * An interface has no usable address.
1717
2324
  */
1718
- DialFailed,
2325
+ NoInterfaceAddress,
1719
2326
  /**
1720
- * A traversal protocol exchange failed.
2327
+ * A send named an interface that has gone away.
1721
2328
  */
1722
- Protocol,
2329
+ UnknownInterface,
1723
2330
  /**
1724
- * A relay refused the circuit.
2331
+ * A goodbye could not be sent before shutdown gave up on a full send
2332
+ * buffer.
1725
2333
  */
1726
- RelayRefused
1727
- }
1728
-
1729
- const FfiConverterTypeNatErrorKind = (() => {
1730
- type TypeName = NatErrorKind;
1731
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1732
- readFromCursor(c: Cursor): TypeName {
1733
- switch (c.readI32()) {
1734
- case 1: return NatErrorKind.NoPathAvailable;
1735
- case 2: return NatErrorKind.Timeout;
1736
- case 3: return NatErrorKind.DialFailed;
1737
- case 4: return NatErrorKind.Protocol;
1738
- case 5: return NatErrorKind.RelayRefused;
1739
- default: throw new UniffiInternalError.UnexpectedEnumCase();
1740
- }
1741
- }
1742
- writeIntoCursor(value: TypeName, c: Cursor): void {
1743
- switch (value) {
1744
- case NatErrorKind.NoPathAvailable: return c.writeI32(1);
1745
- case NatErrorKind.Timeout: return c.writeI32(2);
1746
- case NatErrorKind.DialFailed: return c.writeI32(3);
1747
- case NatErrorKind.Protocol: return c.writeI32(4);
1748
- case NatErrorKind.RelayRefused: return c.writeI32(5);
1749
- }
1750
- }
1751
- allocationSize(value: TypeName): number {
1752
- return 4;
1753
- }
1754
- }
1755
- return new FFIConverter();
1756
- })();
1757
-
1758
- /**
1759
- * Coarse local reachability state.
1760
- */
1761
- export enum Reachability {
2334
+ Congested,
1762
2335
  /**
1763
- * Not enough evidence is available.
2336
+ * A datagram is larger than the carrier can ever send.
1764
2337
  */
1765
- Unknown,
2338
+ Oversized,
1766
2339
  /**
1767
- * The endpoint is directly reachable.
2340
+ * The interface id space is exhausted.
1768
2341
  */
1769
- Public,
2342
+ InterfaceIdsExhausted,
1770
2343
  /**
1771
- * The endpoint needs traversal or relay assistance.
2344
+ * Platform I/O failed.
1772
2345
  */
1773
- Private
2346
+ Io
1774
2347
  }
1775
2348
 
1776
- const FfiConverterTypeReachability = (() => {
1777
- type TypeName = Reachability;
2349
+ const FfiConverterTypeMdnsFailureKind = (() => {
2350
+ type TypeName = MdnsFailureKind;
1778
2351
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1779
2352
  readFromCursor(c: Cursor): TypeName {
1780
2353
  switch (c.readI32()) {
1781
- case 1: return Reachability.Unknown;
1782
- case 2: return Reachability.Public;
1783
- case 3: return Reachability.Private;
2354
+ case 1: return MdnsFailureKind.Unsupported;
2355
+ case 2: return MdnsFailureKind.NoInterfaceAddress;
2356
+ case 3: return MdnsFailureKind.UnknownInterface;
2357
+ case 4: return MdnsFailureKind.Congested;
2358
+ case 5: return MdnsFailureKind.Oversized;
2359
+ case 6: return MdnsFailureKind.InterfaceIdsExhausted;
2360
+ case 7: return MdnsFailureKind.Io;
1784
2361
  default: throw new UniffiInternalError.UnexpectedEnumCase();
1785
2362
  }
1786
2363
  }
1787
2364
  writeIntoCursor(value: TypeName, c: Cursor): void {
1788
2365
  switch (value) {
1789
- case Reachability.Unknown: return c.writeI32(1);
1790
- case Reachability.Public: return c.writeI32(2);
1791
- case Reachability.Private: return c.writeI32(3);
2366
+ case MdnsFailureKind.Unsupported: return c.writeI32(1);
2367
+ case MdnsFailureKind.NoInterfaceAddress: return c.writeI32(2);
2368
+ case MdnsFailureKind.UnknownInterface: return c.writeI32(3);
2369
+ case MdnsFailureKind.Congested: return c.writeI32(4);
2370
+ case MdnsFailureKind.Oversized: return c.writeI32(5);
2371
+ case MdnsFailureKind.InterfaceIdsExhausted: return c.writeI32(6);
2372
+ case MdnsFailureKind.Io: return c.writeI32(7);
1792
2373
  }
1793
2374
  }
1794
2375
  allocationSize(value: TypeName): number {
@@ -1798,174 +2379,99 @@ const FfiConverterTypeReachability = (() => {
1798
2379
  return new FFIConverter();
1799
2380
  })();
1800
2381
 
1801
-
1802
- // Enum: PathKind
1803
- export enum PathKind_Tags {
1804
- DirectDialed = "DirectDialed",
1805
- DirectPunched = "DirectPunched",
1806
- Relayed = "Relayed"
1807
- }
1808
2382
  /**
1809
- * Kind of usable connection path.
2383
+ * Category of a failed NAT connection attempt.
1810
2384
  */
1811
- export const PathKind = (() => {
1812
-
1813
- type DirectDialed__interface = {
1814
- tag: PathKind_Tags.DirectDialed
1815
- };
2385
+ export enum NatErrorKind {
1816
2386
  /**
1817
- * A known address was dialed directly.
2387
+ * No usable direct or relayed path exists.
1818
2388
  */
1819
- class DirectDialed_ extends UniffiEnum implements DirectDialed__interface {
1820
- /**
1821
- * @private
1822
- * This field is private and should not be used, use `tag` instead.
1823
- */
1824
- readonly [uniffiTypeNameSymbol] = "PathKind";
1825
- readonly tag = PathKind_Tags.DirectDialed;
1826
- constructor() {
1827
- super("PathKind", "DirectDialed");
1828
- }
1829
-
1830
- static new(): DirectDialed_ {
1831
- return new DirectDialed_();
1832
- }
1833
-
1834
- static instanceOf(obj: any): obj is DirectDialed_ {
1835
- return obj.tag === PathKind_Tags.DirectDialed;
1836
- }
1837
-
1838
- }
1839
-
1840
- type DirectPunched__interface = {
1841
- tag: PathKind_Tags.DirectPunched
1842
- };
2389
+ NoPathAvailable,
1843
2390
  /**
1844
- * A direct path was established by hole punching.
2391
+ * The connection attempt timed out.
1845
2392
  */
1846
- class DirectPunched_ extends UniffiEnum implements DirectPunched__interface {
1847
- /**
1848
- * @private
1849
- * This field is private and should not be used, use `tag` instead.
1850
- */
1851
- readonly [uniffiTypeNameSymbol] = "PathKind";
1852
- readonly tag = PathKind_Tags.DirectPunched;
1853
- constructor() {
1854
- super("PathKind", "DirectPunched");
1855
- }
1856
-
1857
- static new(): DirectPunched_ {
1858
- return new DirectPunched_();
1859
- }
1860
-
1861
- static instanceOf(obj: any): obj is DirectPunched_ {
1862
- return obj.tag === PathKind_Tags.DirectPunched;
1863
- }
1864
-
1865
- }
1866
-
1867
- type Relayed__interface = {
1868
- tag: PathKind_Tags.Relayed;
1869
- inner:
1870
- Readonly<{relayPeerId: string}>
1871
- };
2393
+ Timeout,
1872
2394
  /**
1873
- * Traffic is carried through a relay.
2395
+ * A transport dial failed.
1874
2396
  */
1875
- class Relayed_ extends UniffiEnum implements Relayed__interface {
1876
- /**
1877
- * @private
1878
- * This field is private and should not be used, use `tag` instead.
1879
- */
1880
- readonly [uniffiTypeNameSymbol] = "PathKind";
1881
- readonly tag = PathKind_Tags.Relayed;
1882
- readonly inner:
1883
- Readonly<{relayPeerId: string}>;
1884
- constructor(
1885
- inner: {relayPeerId: string }) {
1886
- super("PathKind", "Relayed");
2397
+ DialFailed,
2398
+ /**
2399
+ * A traversal protocol exchange failed.
2400
+ */
2401
+ Protocol,
2402
+ /**
2403
+ * A relay refused the circuit.
2404
+ */
2405
+ RelayRefused
2406
+ }
1887
2407
 
1888
- this.inner = Object.freeze(inner);
2408
+ const FfiConverterTypeNatErrorKind = (() => {
2409
+ type TypeName = NatErrorKind;
2410
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
2411
+ readFromCursor(c: Cursor): TypeName {
2412
+ switch (c.readI32()) {
2413
+ case 1: return NatErrorKind.NoPathAvailable;
2414
+ case 2: return NatErrorKind.Timeout;
2415
+ case 3: return NatErrorKind.DialFailed;
2416
+ case 4: return NatErrorKind.Protocol;
2417
+ case 5: return NatErrorKind.RelayRefused;
2418
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
2419
+ }
1889
2420
  }
1890
- static new(
1891
- inner: {relayPeerId: string }): Relayed_ {
1892
- return new Relayed_(inner);
2421
+ writeIntoCursor(value: TypeName, c: Cursor): void {
2422
+ switch (value) {
2423
+ case NatErrorKind.NoPathAvailable: return c.writeI32(1);
2424
+ case NatErrorKind.Timeout: return c.writeI32(2);
2425
+ case NatErrorKind.DialFailed: return c.writeI32(3);
2426
+ case NatErrorKind.Protocol: return c.writeI32(4);
2427
+ case NatErrorKind.RelayRefused: return c.writeI32(5);
2428
+ }
1893
2429
  }
1894
-
1895
- static instanceOf(obj: any): obj is Relayed_ {
1896
- return obj.tag === PathKind_Tags.Relayed;
2430
+ allocationSize(value: TypeName): number {
2431
+ return 4;
1897
2432
  }
1898
-
1899
- }
1900
-
1901
- function instanceOf(obj: any): obj is PathKind {
1902
- return obj[uniffiTypeNameSymbol] === "PathKind";
1903
2433
  }
1904
-
1905
- return Object.freeze({
1906
- instanceOf,
1907
- DirectDialed: DirectDialed_,
1908
- DirectPunched: DirectPunched_,
1909
- Relayed: Relayed_
1910
- });
1911
-
2434
+ return new FFIConverter();
1912
2435
  })();
2436
+
1913
2437
  /**
1914
- * Kind of usable connection path.
2438
+ * Coarse local reachability state.
1915
2439
  */
1916
- export type PathKind = InstanceType<
1917
- typeof PathKind['DirectDialed' | 'DirectPunched' | 'Relayed']
1918
- >;
2440
+ export enum Reachability {
2441
+ /**
2442
+ * Not enough evidence is available.
2443
+ */
2444
+ Unknown,
2445
+ /**
2446
+ * The endpoint is directly reachable.
2447
+ */
2448
+ Public,
2449
+ /**
2450
+ * The endpoint needs traversal or relay assistance.
2451
+ */
2452
+ Private
2453
+ }
1919
2454
 
1920
- // FfiConverter for enum PathKind
1921
- const FfiConverterTypePathKind = (() => {
1922
- type TypeName = PathKind;
2455
+ const FfiConverterTypeReachability = (() => {
2456
+ type TypeName = Reachability;
1923
2457
  class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1924
2458
  readFromCursor(c: Cursor): TypeName {
1925
2459
  switch (c.readI32()) {
1926
- case 1: return new PathKind.DirectDialed();
1927
- case 2: return new PathKind.DirectPunched();
1928
- case 3: return new PathKind.Relayed({relayPeerId: FfiConverterString.readFromCursor(c) });
2460
+ case 1: return Reachability.Unknown;
2461
+ case 2: return Reachability.Public;
2462
+ case 3: return Reachability.Private;
1929
2463
  default: throw new UniffiInternalError.UnexpectedEnumCase();
1930
2464
  }
1931
2465
  }
1932
2466
  writeIntoCursor(value: TypeName, c: Cursor): void {
1933
- switch (value.tag) {
1934
- case PathKind_Tags.DirectDialed: {
1935
- c.writeI32(1);
1936
- return;
1937
- }
1938
- case PathKind_Tags.DirectPunched: {
1939
- c.writeI32(2);
1940
- return;
1941
- }
1942
- case PathKind_Tags.Relayed: {
1943
- c.writeI32(3);
1944
- const inner = value.inner;
1945
- FfiConverterString.writeIntoCursor(inner.relayPeerId, c);
1946
- return;
1947
- }
1948
- default:
1949
- // Throwing from here means that PathKind_Tags hasn't matched an ordinal.
1950
- throw new UniffiInternalError.UnexpectedEnumCase();
2467
+ switch (value) {
2468
+ case Reachability.Unknown: return c.writeI32(1);
2469
+ case Reachability.Public: return c.writeI32(2);
2470
+ case Reachability.Private: return c.writeI32(3);
1951
2471
  }
1952
2472
  }
1953
2473
  allocationSize(value: TypeName): number {
1954
- switch (value.tag) {
1955
- case PathKind_Tags.DirectDialed: {
1956
- return 4;
1957
- }
1958
- case PathKind_Tags.DirectPunched: {
1959
- return 4;
1960
- }
1961
- case PathKind_Tags.Relayed: {
1962
- const inner = value.inner;
1963
- let size = 4;
1964
- size += FfiConverterString.allocationSize(inner.relayPeerId);
1965
- return size;
1966
- }
1967
- default: throw new UniffiInternalError.UnexpectedEnumCase();
1968
- }
2474
+ return 4;
1969
2475
  }
1970
2476
  }
1971
2477
  return new FFIConverter();
@@ -1976,6 +2482,7 @@ const FfiConverterTypePathKind = (() => {
1976
2482
  export enum P2pEvent_Tags {
1977
2483
  EventsDropped = "EventsDropped",
1978
2484
  DriverFailed = "DriverFailed",
2485
+ EndpointClosed = "EndpointClosed",
1979
2486
  ConnectionEstablished = "ConnectionEstablished",
1980
2487
  ConnectionClosed = "ConnectionClosed",
1981
2488
  ConnectionReplaced = "ConnectionReplaced",
@@ -2010,6 +2517,8 @@ export enum P2pEvent_Tags {
2010
2517
  PeerUpdated = "PeerUpdated",
2011
2518
  PeerExpired = "PeerExpired",
2012
2519
  DiscoveryDialFailed = "DiscoveryDialFailed",
2520
+ MdnsFailed = "MdnsFailed",
2521
+ MdnsRecovered = "MdnsRecovered",
2013
2522
  DiscoveryProtocolViolation = "DiscoveryProtocolViolation"
2014
2523
  }
2015
2524
  /**
@@ -2085,6 +2594,42 @@ inner: {kind: DriverFailureKind; detail: string }): DriverFailed_ {
2085
2594
 
2086
2595
  }
2087
2596
 
2597
+ type EndpointClosed__interface = {
2598
+ tag: P2pEvent_Tags.EndpointClosed;
2599
+ inner:
2600
+ Readonly<{outcome: CloseOutcome; unfinished: Array<UnfinishedConnection>}>
2601
+ };
2602
+ /**
2603
+ * The driver finished shutting down: its last event, after
2604
+ * [`P2pEndpoint::stop`](crate::P2pEndpoint::stop) or a
2605
+ * [`P2pEvent::DriverFailed`], when a failed driver tears down at once.
2606
+ */
2607
+ class EndpointClosed_ extends UniffiEnum implements EndpointClosed__interface {
2608
+ /**
2609
+ * @private
2610
+ * This field is private and should not be used, use `tag` instead.
2611
+ */
2612
+ readonly [uniffiTypeNameSymbol] = "P2pEvent";
2613
+ readonly tag = P2pEvent_Tags.EndpointClosed;
2614
+ readonly inner:
2615
+ Readonly<{outcome: CloseOutcome; unfinished: Array<UnfinishedConnection>}>;
2616
+ constructor(
2617
+ inner: {outcome: CloseOutcome; unfinished: Array<UnfinishedConnection> }) {
2618
+ super("P2pEvent", "EndpointClosed");
2619
+
2620
+ this.inner = Object.freeze(inner);
2621
+ }
2622
+ static new(
2623
+ inner: {outcome: CloseOutcome; unfinished: Array<UnfinishedConnection> }): EndpointClosed_ {
2624
+ return new EndpointClosed_(inner);
2625
+ }
2626
+
2627
+ static instanceOf(obj: any): obj is EndpointClosed_ {
2628
+ return obj.tag === P2pEvent_Tags.EndpointClosed;
2629
+ }
2630
+
2631
+ }
2632
+
2088
2633
  type ConnectionEstablished__interface = {
2089
2634
  tag: P2pEvent_Tags.ConnectionEstablished;
2090
2635
  inner:
@@ -2122,7 +2667,7 @@ inner: {peerId: string; connId: bigint }): ConnectionEstablished_ {
2122
2667
  type ConnectionClosed__interface = {
2123
2668
  tag: P2pEvent_Tags.ConnectionClosed;
2124
2669
  inner:
2125
- Readonly<{peerId: string; connId: bigint}>
2670
+ Readonly<{peerId: string; connId: bigint; reason: ConnectionCloseReason}>
2126
2671
  };
2127
2672
  /**
2128
2673
  * The peer's last connection closed; the peer is now disconnected.
@@ -2135,15 +2680,15 @@ Readonly<{peerId: string; connId: bigint}>
2135
2680
  readonly [uniffiTypeNameSymbol] = "P2pEvent";
2136
2681
  readonly tag = P2pEvent_Tags.ConnectionClosed;
2137
2682
  readonly inner:
2138
- Readonly<{peerId: string; connId: bigint}>;
2683
+ Readonly<{peerId: string; connId: bigint; reason: ConnectionCloseReason}>;
2139
2684
  constructor(
2140
- inner: {peerId: string; connId: bigint }) {
2685
+ inner: {peerId: string; connId: bigint; reason: ConnectionCloseReason }) {
2141
2686
  super("P2pEvent", "ConnectionClosed");
2142
2687
 
2143
2688
  this.inner = Object.freeze(inner);
2144
2689
  }
2145
2690
  static new(
2146
- inner: {peerId: string; connId: bigint }): ConnectionClosed_ {
2691
+ inner: {peerId: string; connId: bigint; reason: ConnectionCloseReason }): ConnectionClosed_ {
2147
2692
  return new ConnectionClosed_(inner);
2148
2693
  }
2149
2694
 
@@ -3254,6 +3799,70 @@ inner: {peerId: string; reason: string }): DiscoveryDialFailed_ {
3254
3799
 
3255
3800
  }
3256
3801
 
3802
+ type MdnsFailed__interface = {
3803
+ tag: P2pEvent_Tags.MdnsFailed;
3804
+ inner:
3805
+ Readonly<{kind: MdnsFailureKind; detail: string}>
3806
+ };
3807
+ /**
3808
+ * mDNS hit a hard failure. mDNS keeps running and retries; reported
3809
+ * once per change in failure state, and followed by `MdnsRecovered`
3810
+ * once a retry succeeds. A goodbye that failed during shutdown is
3811
+ * final.
3812
+ */
3813
+ class MdnsFailed_ extends UniffiEnum implements MdnsFailed__interface {
3814
+ /**
3815
+ * @private
3816
+ * This field is private and should not be used, use `tag` instead.
3817
+ */
3818
+ readonly [uniffiTypeNameSymbol] = "P2pEvent";
3819
+ readonly tag = P2pEvent_Tags.MdnsFailed;
3820
+ readonly inner:
3821
+ Readonly<{kind: MdnsFailureKind; detail: string}>;
3822
+ constructor(
3823
+ inner: {kind: MdnsFailureKind; detail: string }) {
3824
+ super("P2pEvent", "MdnsFailed");
3825
+
3826
+ this.inner = Object.freeze(inner);
3827
+ }
3828
+ static new(
3829
+ inner: {kind: MdnsFailureKind; detail: string }): MdnsFailed_ {
3830
+ return new MdnsFailed_(inner);
3831
+ }
3832
+
3833
+ static instanceOf(obj: any): obj is MdnsFailed_ {
3834
+ return obj.tag === P2pEvent_Tags.MdnsFailed;
3835
+ }
3836
+
3837
+ }
3838
+
3839
+ type MdnsRecovered__interface = {
3840
+ tag: P2pEvent_Tags.MdnsRecovered
3841
+ };
3842
+ /**
3843
+ * mDNS recovered from its last `MdnsFailed`.
3844
+ */
3845
+ class MdnsRecovered_ extends UniffiEnum implements MdnsRecovered__interface {
3846
+ /**
3847
+ * @private
3848
+ * This field is private and should not be used, use `tag` instead.
3849
+ */
3850
+ readonly [uniffiTypeNameSymbol] = "P2pEvent";
3851
+ readonly tag = P2pEvent_Tags.MdnsRecovered;
3852
+ constructor() {
3853
+ super("P2pEvent", "MdnsRecovered");
3854
+ }
3855
+
3856
+ static new(): MdnsRecovered_ {
3857
+ return new MdnsRecovered_();
3858
+ }
3859
+
3860
+ static instanceOf(obj: any): obj is MdnsRecovered_ {
3861
+ return obj.tag === P2pEvent_Tags.MdnsRecovered;
3862
+ }
3863
+
3864
+ }
3865
+
3257
3866
  type DiscoveryProtocolViolation__interface = {
3258
3867
  tag: P2pEvent_Tags.DiscoveryProtocolViolation;
3259
3868
  inner:
@@ -3296,6 +3905,7 @@ inner: {peerId?: string; source: DiscoverySource; reason: string; suppressed: nu
3296
3905
  instanceOf,
3297
3906
  EventsDropped: EventsDropped_,
3298
3907
  DriverFailed: DriverFailed_,
3908
+ EndpointClosed: EndpointClosed_,
3299
3909
  ConnectionEstablished: ConnectionEstablished_,
3300
3910
  ConnectionClosed: ConnectionClosed_,
3301
3911
  ConnectionReplaced: ConnectionReplaced_,
@@ -3330,6 +3940,8 @@ inner: {peerId?: string; source: DiscoverySource; reason: string; suppressed: nu
3330
3940
  PeerUpdated: PeerUpdated_,
3331
3941
  PeerExpired: PeerExpired_,
3332
3942
  DiscoveryDialFailed: DiscoveryDialFailed_,
3943
+ MdnsFailed: MdnsFailed_,
3944
+ MdnsRecovered: MdnsRecovered_,
3333
3945
  DiscoveryProtocolViolation: DiscoveryProtocolViolation_
3334
3946
  });
3335
3947
 
@@ -3338,7 +3950,7 @@ inner: {peerId?: string; source: DiscoverySource; reason: string; suppressed: nu
3338
3950
  * Event delivered by the native endpoint driver.
3339
3951
  */
3340
3952
  export type P2pEvent = InstanceType<
3341
- 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']
3953
+ 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']
3342
3954
  >;
3343
3955
 
3344
3956
  // FfiConverter for enum P2pEvent
@@ -3349,41 +3961,44 @@ const FfiConverterTypeP2pEvent = (() => {
3349
3961
  switch (c.readI32()) {
3350
3962
  case 1: return new P2pEvent.EventsDropped({dropped: FfiConverterUInt64.readFromCursor(c), totalDropped: FfiConverterUInt64.readFromCursor(c), terminalConnectIds: FfiConverterSequenceUInt64.readFromCursor(c) });
3351
3963
  case 2: return new P2pEvent.DriverFailed({kind: FfiConverterTypeDriverFailureKind.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
3352
- case 3: return new P2pEvent.ConnectionEstablished({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3353
- case 4: return new P2pEvent.ConnectionClosed({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3354
- case 5: return new P2pEvent.ConnectionReplaced({peerId: FfiConverterString.readFromCursor(c), oldConnId: FfiConverterUInt64.readFromCursor(c), newConnId: FfiConverterUInt64.readFromCursor(c) });
3355
- case 6: return new P2pEvent.PeerReady({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), protocols: FfiConverterSequenceString.readFromCursor(c) });
3356
- case 7: return new P2pEvent.IdentifyReceived({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), info: FfiConverterTypeIdentifyInfo.readFromCursor(c) });
3357
- case 8: return new P2pEvent.PingRttMeasured({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), rttMs: FfiConverterUInt64.readFromCursor(c) });
3358
- case 9: return new P2pEvent.PingTimeout({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3359
- 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) });
3360
- case 11: return new P2pEvent.StreamData({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c), data: FfiConverterArrayBuffer.readFromCursor(c) });
3361
- case 12: return new P2pEvent.StreamWriteAccepted({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c) });
3362
- case 13: return new P2pEvent.StreamWriteStopped({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c), errorCode: FfiConverterUInt64.readFromCursor(c) });
3363
- case 14: return new P2pEvent.StreamRemoteWriteClosed({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c) });
3364
- case 15: return new P2pEvent.StreamClosed({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c) });
3365
- case 16: return new P2pEvent.EndpointError({kind: FfiConverterTypeEndpointErrorKind.readFromCursor(c), peerId: FfiConverterOptionalString.readFromCursor(c), connId: FfiConverterOptionalUInt64.readFromCursor(c), streamId: FfiConverterOptionalUInt64.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
3366
- case 17: return new P2pEvent.ReachabilityChanged({previous: FfiConverterTypeReachability.readFromCursor(c), current: FfiConverterTypeReachability.readFromCursor(c), confirmedAddrs: FfiConverterSequenceString.readFromCursor(c) });
3367
- case 18: return new P2pEvent.PublicAddressesChanged({addrs: FfiConverterSequenceString.readFromCursor(c) });
3368
- case 19: return new P2pEvent.RelayReserved({relayPeerId: FfiConverterString.readFromCursor(c), expiresUnixSecs: FfiConverterOptionalUInt64.readFromCursor(c) });
3369
- case 20: return new P2pEvent.RelayReservationLost({relayPeerId: FfiConverterString.readFromCursor(c) });
3370
- case 21: return new P2pEvent.PathEstablished({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c) });
3371
- case 22: return new P2pEvent.InboundPathEstablished({peerId: FfiConverterString.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3372
- 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) });
3373
- case 24: return new P2pEvent.HolePunchFailed({connectId: FfiConverterUInt64.readFromCursor(c), attempt: FfiConverterUInt32.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3374
- case 25: return new P2pEvent.ConnectFailed({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), kind: FfiConverterTypeNatErrorKind.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
3375
- case 26: return new P2pEvent.ConnectCancelled({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c) });
3376
- case 27: return new P2pEvent.InboundDirectUpgrade({peerId: FfiConverterString.readFromCursor(c), oldConnId: FfiConverterUInt64.readFromCursor(c), newConnId: FfiConverterUInt64.readFromCursor(c) });
3377
- 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) });
3378
- case 29: return new P2pEvent.PeerSubscribed({peerId: FfiConverterString.readFromCursor(c), topic: FfiConverterString.readFromCursor(c) });
3379
- case 30: return new P2pEvent.PeerUnsubscribed({peerId: FfiConverterString.readFromCursor(c), topic: FfiConverterString.readFromCursor(c) });
3380
- case 31: return new P2pEvent.GossipsubOutboundFailure({peerId: FfiConverterString.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3381
- case 32: return new P2pEvent.GossipsubProtocolViolation({peerId: FfiConverterString.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3382
- case 33: return new P2pEvent.PeerDiscovered({peerId: FfiConverterString.readFromCursor(c), addrs: FfiConverterSequenceString.readFromCursor(c), source: FfiConverterTypeDiscoverySource.readFromCursor(c) });
3383
- case 34: return new P2pEvent.PeerUpdated({peerId: FfiConverterString.readFromCursor(c), addrs: FfiConverterSequenceString.readFromCursor(c), source: FfiConverterTypeDiscoverySource.readFromCursor(c) });
3384
- case 35: return new P2pEvent.PeerExpired({peerId: FfiConverterString.readFromCursor(c) });
3385
- case 36: return new P2pEvent.DiscoveryDialFailed({peerId: FfiConverterString.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3386
- case 37: return new P2pEvent.DiscoveryProtocolViolation({peerId: FfiConverterOptionalString.readFromCursor(c), source: FfiConverterTypeDiscoverySource.readFromCursor(c), reason: FfiConverterString.readFromCursor(c), suppressed: FfiConverterUInt32.readFromCursor(c) });
3964
+ case 3: return new P2pEvent.EndpointClosed({outcome: FfiConverterTypeCloseOutcome.readFromCursor(c), unfinished: FfiConverterSequenceTypeUnfinishedConnection.readFromCursor(c) });
3965
+ case 4: return new P2pEvent.ConnectionEstablished({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3966
+ case 5: return new P2pEvent.ConnectionClosed({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), reason: FfiConverterTypeConnectionCloseReason.readFromCursor(c) });
3967
+ case 6: return new P2pEvent.ConnectionReplaced({peerId: FfiConverterString.readFromCursor(c), oldConnId: FfiConverterUInt64.readFromCursor(c), newConnId: FfiConverterUInt64.readFromCursor(c) });
3968
+ case 7: return new P2pEvent.PeerReady({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), protocols: FfiConverterSequenceString.readFromCursor(c) });
3969
+ case 8: return new P2pEvent.IdentifyReceived({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), info: FfiConverterTypeIdentifyInfo.readFromCursor(c) });
3970
+ case 9: return new P2pEvent.PingRttMeasured({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), rttMs: FfiConverterUInt64.readFromCursor(c) });
3971
+ case 10: return new P2pEvent.PingTimeout({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3972
+ case 11: return new P2pEvent.StreamReady({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c), protocolId: FfiConverterString.readFromCursor(c), initiatedLocally: FfiConverterBool.readFromCursor(c) });
3973
+ case 12: return new P2pEvent.StreamData({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c), data: FfiConverterArrayBuffer.readFromCursor(c) });
3974
+ case 13: return new P2pEvent.StreamWriteAccepted({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c) });
3975
+ case 14: return new P2pEvent.StreamWriteStopped({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c), errorCode: FfiConverterUInt64.readFromCursor(c) });
3976
+ case 15: return new P2pEvent.StreamRemoteWriteClosed({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c) });
3977
+ case 16: return new P2pEvent.StreamClosed({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), streamId: FfiConverterUInt64.readFromCursor(c) });
3978
+ case 17: return new P2pEvent.EndpointError({kind: FfiConverterTypeEndpointErrorKind.readFromCursor(c), peerId: FfiConverterOptionalString.readFromCursor(c), connId: FfiConverterOptionalUInt64.readFromCursor(c), streamId: FfiConverterOptionalUInt64.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
3979
+ case 18: return new P2pEvent.ReachabilityChanged({previous: FfiConverterTypeReachability.readFromCursor(c), current: FfiConverterTypeReachability.readFromCursor(c), confirmedAddrs: FfiConverterSequenceString.readFromCursor(c) });
3980
+ case 19: return new P2pEvent.PublicAddressesChanged({addrs: FfiConverterSequenceString.readFromCursor(c) });
3981
+ case 20: return new P2pEvent.RelayReserved({relayPeerId: FfiConverterString.readFromCursor(c), expiresUnixSecs: FfiConverterOptionalUInt64.readFromCursor(c) });
3982
+ case 21: return new P2pEvent.RelayReservationLost({relayPeerId: FfiConverterString.readFromCursor(c) });
3983
+ case 22: return new P2pEvent.PathEstablished({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c) });
3984
+ case 23: return new P2pEvent.InboundPathEstablished({peerId: FfiConverterString.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
3985
+ case 24: 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) });
3986
+ case 25: return new P2pEvent.HolePunchFailed({connectId: FfiConverterUInt64.readFromCursor(c), attempt: FfiConverterUInt32.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3987
+ case 26: return new P2pEvent.ConnectFailed({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), kind: FfiConverterTypeNatErrorKind.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
3988
+ case 27: return new P2pEvent.ConnectCancelled({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c) });
3989
+ case 28: return new P2pEvent.InboundDirectUpgrade({peerId: FfiConverterString.readFromCursor(c), oldConnId: FfiConverterUInt64.readFromCursor(c), newConnId: FfiConverterUInt64.readFromCursor(c) });
3990
+ case 29: return new P2pEvent.Message({fromPeerId: FfiConverterString.readFromCursor(c), topics: FfiConverterSequenceString.readFromCursor(c), data: FfiConverterArrayBuffer.readFromCursor(c), seqno: FfiConverterArrayBuffer.readFromCursor(c), signed: FfiConverterBool.readFromCursor(c) });
3991
+ case 30: return new P2pEvent.PeerSubscribed({peerId: FfiConverterString.readFromCursor(c), topic: FfiConverterString.readFromCursor(c) });
3992
+ case 31: return new P2pEvent.PeerUnsubscribed({peerId: FfiConverterString.readFromCursor(c), topic: FfiConverterString.readFromCursor(c) });
3993
+ case 32: return new P2pEvent.GossipsubOutboundFailure({peerId: FfiConverterString.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3994
+ case 33: return new P2pEvent.GossipsubProtocolViolation({peerId: FfiConverterString.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3995
+ case 34: return new P2pEvent.PeerDiscovered({peerId: FfiConverterString.readFromCursor(c), addrs: FfiConverterSequenceString.readFromCursor(c), source: FfiConverterTypeDiscoverySource.readFromCursor(c) });
3996
+ case 35: return new P2pEvent.PeerUpdated({peerId: FfiConverterString.readFromCursor(c), addrs: FfiConverterSequenceString.readFromCursor(c), source: FfiConverterTypeDiscoverySource.readFromCursor(c) });
3997
+ case 36: return new P2pEvent.PeerExpired({peerId: FfiConverterString.readFromCursor(c) });
3998
+ case 37: return new P2pEvent.DiscoveryDialFailed({peerId: FfiConverterString.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
3999
+ case 38: return new P2pEvent.MdnsFailed({kind: FfiConverterTypeMdnsFailureKind.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
4000
+ case 39: return new P2pEvent.MdnsRecovered();
4001
+ case 40: return new P2pEvent.DiscoveryProtocolViolation({peerId: FfiConverterOptionalString.readFromCursor(c), source: FfiConverterTypeDiscoverySource.readFromCursor(c), reason: FfiConverterString.readFromCursor(c), suppressed: FfiConverterUInt32.readFromCursor(c) });
3387
4002
  default: throw new UniffiInternalError.UnexpectedEnumCase();
3388
4003
  }
3389
4004
  }
@@ -3404,22 +4019,30 @@ const FfiConverterTypeP2pEvent = (() => {
3404
4019
  FfiConverterString.writeIntoCursor(inner.detail, c);
3405
4020
  return;
3406
4021
  }
3407
- case P2pEvent_Tags.ConnectionEstablished: {
4022
+ case P2pEvent_Tags.EndpointClosed: {
3408
4023
  c.writeI32(3);
3409
4024
  const inner = value.inner;
4025
+ FfiConverterTypeCloseOutcome.writeIntoCursor(inner.outcome, c);
4026
+ FfiConverterSequenceTypeUnfinishedConnection.writeIntoCursor(inner.unfinished, c);
4027
+ return;
4028
+ }
4029
+ case P2pEvent_Tags.ConnectionEstablished: {
4030
+ c.writeI32(4);
4031
+ const inner = value.inner;
3410
4032
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3411
4033
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3412
4034
  return;
3413
4035
  }
3414
4036
  case P2pEvent_Tags.ConnectionClosed: {
3415
- c.writeI32(4);
4037
+ c.writeI32(5);
3416
4038
  const inner = value.inner;
3417
4039
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3418
4040
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
4041
+ FfiConverterTypeConnectionCloseReason.writeIntoCursor(inner.reason, c);
3419
4042
  return;
3420
4043
  }
3421
4044
  case P2pEvent_Tags.ConnectionReplaced: {
3422
- c.writeI32(5);
4045
+ c.writeI32(6);
3423
4046
  const inner = value.inner;
3424
4047
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3425
4048
  FfiConverterUInt64.writeIntoCursor(inner.oldConnId, c);
@@ -3427,7 +4050,7 @@ const FfiConverterTypeP2pEvent = (() => {
3427
4050
  return;
3428
4051
  }
3429
4052
  case P2pEvent_Tags.PeerReady: {
3430
- c.writeI32(6);
4053
+ c.writeI32(7);
3431
4054
  const inner = value.inner;
3432
4055
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3433
4056
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3435,7 +4058,7 @@ const FfiConverterTypeP2pEvent = (() => {
3435
4058
  return;
3436
4059
  }
3437
4060
  case P2pEvent_Tags.IdentifyReceived: {
3438
- c.writeI32(7);
4061
+ c.writeI32(8);
3439
4062
  const inner = value.inner;
3440
4063
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3441
4064
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3443,7 +4066,7 @@ const FfiConverterTypeP2pEvent = (() => {
3443
4066
  return;
3444
4067
  }
3445
4068
  case P2pEvent_Tags.PingRttMeasured: {
3446
- c.writeI32(8);
4069
+ c.writeI32(9);
3447
4070
  const inner = value.inner;
3448
4071
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3449
4072
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3451,14 +4074,14 @@ const FfiConverterTypeP2pEvent = (() => {
3451
4074
  return;
3452
4075
  }
3453
4076
  case P2pEvent_Tags.PingTimeout: {
3454
- c.writeI32(9);
4077
+ c.writeI32(10);
3455
4078
  const inner = value.inner;
3456
4079
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3457
4080
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
3458
4081
  return;
3459
4082
  }
3460
4083
  case P2pEvent_Tags.StreamReady: {
3461
- c.writeI32(10);
4084
+ c.writeI32(11);
3462
4085
  const inner = value.inner;
3463
4086
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3464
4087
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3468,7 +4091,7 @@ const FfiConverterTypeP2pEvent = (() => {
3468
4091
  return;
3469
4092
  }
3470
4093
  case P2pEvent_Tags.StreamData: {
3471
- c.writeI32(11);
4094
+ c.writeI32(12);
3472
4095
  const inner = value.inner;
3473
4096
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3474
4097
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3477,7 +4100,7 @@ const FfiConverterTypeP2pEvent = (() => {
3477
4100
  return;
3478
4101
  }
3479
4102
  case P2pEvent_Tags.StreamWriteAccepted: {
3480
- c.writeI32(12);
4103
+ c.writeI32(13);
3481
4104
  const inner = value.inner;
3482
4105
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3483
4106
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3485,7 +4108,7 @@ const FfiConverterTypeP2pEvent = (() => {
3485
4108
  return;
3486
4109
  }
3487
4110
  case P2pEvent_Tags.StreamWriteStopped: {
3488
- c.writeI32(13);
4111
+ c.writeI32(14);
3489
4112
  const inner = value.inner;
3490
4113
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3491
4114
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3494,7 +4117,7 @@ const FfiConverterTypeP2pEvent = (() => {
3494
4117
  return;
3495
4118
  }
3496
4119
  case P2pEvent_Tags.StreamRemoteWriteClosed: {
3497
- c.writeI32(14);
4120
+ c.writeI32(15);
3498
4121
  const inner = value.inner;
3499
4122
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3500
4123
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3502,7 +4125,7 @@ const FfiConverterTypeP2pEvent = (() => {
3502
4125
  return;
3503
4126
  }
3504
4127
  case P2pEvent_Tags.StreamClosed: {
3505
- c.writeI32(15);
4128
+ c.writeI32(16);
3506
4129
  const inner = value.inner;
3507
4130
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3508
4131
  FfiConverterUInt64.writeIntoCursor(inner.connId, c);
@@ -3510,7 +4133,7 @@ const FfiConverterTypeP2pEvent = (() => {
3510
4133
  return;
3511
4134
  }
3512
4135
  case P2pEvent_Tags.EndpointError: {
3513
- c.writeI32(16);
4136
+ c.writeI32(17);
3514
4137
  const inner = value.inner;
3515
4138
  FfiConverterTypeEndpointErrorKind.writeIntoCursor(inner.kind, c);
3516
4139
  FfiConverterOptionalString.writeIntoCursor(inner.peerId, c);
@@ -3520,7 +4143,7 @@ const FfiConverterTypeP2pEvent = (() => {
3520
4143
  return;
3521
4144
  }
3522
4145
  case P2pEvent_Tags.ReachabilityChanged: {
3523
- c.writeI32(17);
4146
+ c.writeI32(18);
3524
4147
  const inner = value.inner;
3525
4148
  FfiConverterTypeReachability.writeIntoCursor(inner.previous, c);
3526
4149
  FfiConverterTypeReachability.writeIntoCursor(inner.current, c);
@@ -3528,26 +4151,26 @@ const FfiConverterTypeP2pEvent = (() => {
3528
4151
  return;
3529
4152
  }
3530
4153
  case P2pEvent_Tags.PublicAddressesChanged: {
3531
- c.writeI32(18);
4154
+ c.writeI32(19);
3532
4155
  const inner = value.inner;
3533
4156
  FfiConverterSequenceString.writeIntoCursor(inner.addrs, c);
3534
4157
  return;
3535
4158
  }
3536
4159
  case P2pEvent_Tags.RelayReserved: {
3537
- c.writeI32(19);
4160
+ c.writeI32(20);
3538
4161
  const inner = value.inner;
3539
4162
  FfiConverterString.writeIntoCursor(inner.relayPeerId, c);
3540
4163
  FfiConverterOptionalUInt64.writeIntoCursor(inner.expiresUnixSecs, c);
3541
4164
  return;
3542
4165
  }
3543
4166
  case P2pEvent_Tags.RelayReservationLost: {
3544
- c.writeI32(20);
4167
+ c.writeI32(21);
3545
4168
  const inner = value.inner;
3546
4169
  FfiConverterString.writeIntoCursor(inner.relayPeerId, c);
3547
4170
  return;
3548
4171
  }
3549
4172
  case P2pEvent_Tags.PathEstablished: {
3550
- c.writeI32(21);
4173
+ c.writeI32(22);
3551
4174
  const inner = value.inner;
3552
4175
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3553
4176
  FfiConverterString.writeIntoCursor(inner.peerId, c);
@@ -3556,7 +4179,7 @@ const FfiConverterTypeP2pEvent = (() => {
3556
4179
  return;
3557
4180
  }
3558
4181
  case P2pEvent_Tags.InboundPathEstablished: {
3559
- c.writeI32(22);
4182
+ c.writeI32(23);
3560
4183
  const inner = value.inner;
3561
4184
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3562
4185
  FfiConverterTypePathKind.writeIntoCursor(inner.path, c);
@@ -3564,7 +4187,7 @@ const FfiConverterTypeP2pEvent = (() => {
3564
4187
  return;
3565
4188
  }
3566
4189
  case P2pEvent_Tags.PathUpgraded: {
3567
- c.writeI32(23);
4190
+ c.writeI32(24);
3568
4191
  const inner = value.inner;
3569
4192
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3570
4193
  FfiConverterString.writeIntoCursor(inner.peerId, c);
@@ -3575,7 +4198,7 @@ const FfiConverterTypeP2pEvent = (() => {
3575
4198
  return;
3576
4199
  }
3577
4200
  case P2pEvent_Tags.HolePunchFailed: {
3578
- c.writeI32(24);
4201
+ c.writeI32(25);
3579
4202
  const inner = value.inner;
3580
4203
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3581
4204
  FfiConverterUInt32.writeIntoCursor(inner.attempt, c);
@@ -3583,7 +4206,7 @@ const FfiConverterTypeP2pEvent = (() => {
3583
4206
  return;
3584
4207
  }
3585
4208
  case P2pEvent_Tags.ConnectFailed: {
3586
- c.writeI32(25);
4209
+ c.writeI32(26);
3587
4210
  const inner = value.inner;
3588
4211
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3589
4212
  FfiConverterString.writeIntoCursor(inner.peerId, c);
@@ -3592,14 +4215,14 @@ const FfiConverterTypeP2pEvent = (() => {
3592
4215
  return;
3593
4216
  }
3594
4217
  case P2pEvent_Tags.ConnectCancelled: {
3595
- c.writeI32(26);
4218
+ c.writeI32(27);
3596
4219
  const inner = value.inner;
3597
4220
  FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
3598
4221
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3599
4222
  return;
3600
4223
  }
3601
4224
  case P2pEvent_Tags.InboundDirectUpgrade: {
3602
- c.writeI32(27);
4225
+ c.writeI32(28);
3603
4226
  const inner = value.inner;
3604
4227
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3605
4228
  FfiConverterUInt64.writeIntoCursor(inner.oldConnId, c);
@@ -3607,7 +4230,7 @@ const FfiConverterTypeP2pEvent = (() => {
3607
4230
  return;
3608
4231
  }
3609
4232
  case P2pEvent_Tags.Message: {
3610
- c.writeI32(28);
4233
+ c.writeI32(29);
3611
4234
  const inner = value.inner;
3612
4235
  FfiConverterString.writeIntoCursor(inner.fromPeerId, c);
3613
4236
  FfiConverterSequenceString.writeIntoCursor(inner.topics, c);
@@ -3617,35 +4240,35 @@ const FfiConverterTypeP2pEvent = (() => {
3617
4240
  return;
3618
4241
  }
3619
4242
  case P2pEvent_Tags.PeerSubscribed: {
3620
- c.writeI32(29);
4243
+ c.writeI32(30);
3621
4244
  const inner = value.inner;
3622
4245
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3623
4246
  FfiConverterString.writeIntoCursor(inner.topic, c);
3624
4247
  return;
3625
4248
  }
3626
4249
  case P2pEvent_Tags.PeerUnsubscribed: {
3627
- c.writeI32(30);
4250
+ c.writeI32(31);
3628
4251
  const inner = value.inner;
3629
4252
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3630
4253
  FfiConverterString.writeIntoCursor(inner.topic, c);
3631
4254
  return;
3632
4255
  }
3633
4256
  case P2pEvent_Tags.GossipsubOutboundFailure: {
3634
- c.writeI32(31);
4257
+ c.writeI32(32);
3635
4258
  const inner = value.inner;
3636
4259
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3637
4260
  FfiConverterString.writeIntoCursor(inner.reason, c);
3638
4261
  return;
3639
4262
  }
3640
4263
  case P2pEvent_Tags.GossipsubProtocolViolation: {
3641
- c.writeI32(32);
4264
+ c.writeI32(33);
3642
4265
  const inner = value.inner;
3643
4266
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3644
4267
  FfiConverterString.writeIntoCursor(inner.reason, c);
3645
4268
  return;
3646
4269
  }
3647
4270
  case P2pEvent_Tags.PeerDiscovered: {
3648
- c.writeI32(33);
4271
+ c.writeI32(34);
3649
4272
  const inner = value.inner;
3650
4273
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3651
4274
  FfiConverterSequenceString.writeIntoCursor(inner.addrs, c);
@@ -3653,7 +4276,7 @@ const FfiConverterTypeP2pEvent = (() => {
3653
4276
  return;
3654
4277
  }
3655
4278
  case P2pEvent_Tags.PeerUpdated: {
3656
- c.writeI32(34);
4279
+ c.writeI32(35);
3657
4280
  const inner = value.inner;
3658
4281
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3659
4282
  FfiConverterSequenceString.writeIntoCursor(inner.addrs, c);
@@ -3661,20 +4284,31 @@ const FfiConverterTypeP2pEvent = (() => {
3661
4284
  return;
3662
4285
  }
3663
4286
  case P2pEvent_Tags.PeerExpired: {
3664
- c.writeI32(35);
4287
+ c.writeI32(36);
3665
4288
  const inner = value.inner;
3666
4289
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3667
4290
  return;
3668
4291
  }
3669
4292
  case P2pEvent_Tags.DiscoveryDialFailed: {
3670
- c.writeI32(36);
4293
+ c.writeI32(37);
3671
4294
  const inner = value.inner;
3672
4295
  FfiConverterString.writeIntoCursor(inner.peerId, c);
3673
4296
  FfiConverterString.writeIntoCursor(inner.reason, c);
3674
4297
  return;
3675
4298
  }
4299
+ case P2pEvent_Tags.MdnsFailed: {
4300
+ c.writeI32(38);
4301
+ const inner = value.inner;
4302
+ FfiConverterTypeMdnsFailureKind.writeIntoCursor(inner.kind, c);
4303
+ FfiConverterString.writeIntoCursor(inner.detail, c);
4304
+ return;
4305
+ }
4306
+ case P2pEvent_Tags.MdnsRecovered: {
4307
+ c.writeI32(39);
4308
+ return;
4309
+ }
3676
4310
  case P2pEvent_Tags.DiscoveryProtocolViolation: {
3677
- c.writeI32(37);
4311
+ c.writeI32(40);
3678
4312
  const inner = value.inner;
3679
4313
  FfiConverterOptionalString.writeIntoCursor(inner.peerId, c);
3680
4314
  FfiConverterTypeDiscoverySource.writeIntoCursor(inner.source, c);
@@ -3704,6 +4338,13 @@ const FfiConverterTypeP2pEvent = (() => {
3704
4338
  size += FfiConverterString.allocationSize(inner.detail);
3705
4339
  return size;
3706
4340
  }
4341
+ case P2pEvent_Tags.EndpointClosed: {
4342
+ const inner = value.inner;
4343
+ let size = 4;
4344
+ size += FfiConverterTypeCloseOutcome.allocationSize(inner.outcome);
4345
+ size += FfiConverterSequenceTypeUnfinishedConnection.allocationSize(inner.unfinished);
4346
+ return size;
4347
+ }
3707
4348
  case P2pEvent_Tags.ConnectionEstablished: {
3708
4349
  const inner = value.inner;
3709
4350
  let size = 4;
@@ -3716,6 +4357,7 @@ const FfiConverterTypeP2pEvent = (() => {
3716
4357
  let size = 4;
3717
4358
  size += FfiConverterString.allocationSize(inner.peerId);
3718
4359
  size += FfiConverterUInt64.allocationSize(inner.connId);
4360
+ size += FfiConverterTypeConnectionCloseReason.allocationSize(inner.reason);
3719
4361
  return size;
3720
4362
  }
3721
4363
  case P2pEvent_Tags.ConnectionReplaced: {
@@ -3973,6 +4615,16 @@ const FfiConverterTypeP2pEvent = (() => {
3973
4615
  size += FfiConverterString.allocationSize(inner.reason);
3974
4616
  return size;
3975
4617
  }
4618
+ case P2pEvent_Tags.MdnsFailed: {
4619
+ const inner = value.inner;
4620
+ let size = 4;
4621
+ size += FfiConverterTypeMdnsFailureKind.allocationSize(inner.kind);
4622
+ size += FfiConverterString.allocationSize(inner.detail);
4623
+ return size;
4624
+ }
4625
+ case P2pEvent_Tags.MdnsRecovered: {
4626
+ return 4;
4627
+ }
3976
4628
  case P2pEvent_Tags.DiscoveryProtocolViolation: {
3977
4629
  const inner = value.inner;
3978
4630
  let size = 4;
@@ -3989,15 +4641,15 @@ const FfiConverterTypeP2pEvent = (() => {
3989
4641
  return new FFIConverter();
3990
4642
  })();
3991
4643
 
3992
- // FfiConverter for string | undefined
3993
- const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
3994
-
3995
4644
  // FfiConverter for Array<string>
3996
4645
  const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);
3997
4646
 
3998
4647
  // FfiConverter for Array<string> | undefined
3999
4648
  const FfiConverterOptionalSequenceString = new FfiConverterOptional(FfiConverterSequenceString);
4000
4649
 
4650
+ // FfiConverter for string | undefined
4651
+ const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
4652
+
4001
4653
  // FfiConverter for DiscoveryOptions | undefined
4002
4654
  const FfiConverterOptionalTypeDiscoveryOptions = new FfiConverterOptional(FfiConverterTypeDiscoveryOptions);
4003
4655
 
@@ -4013,6 +4665,9 @@ const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);
4013
4665
  // FfiConverter for Array<bigint>
4014
4666
  const FfiConverterSequenceUInt64 = new FfiConverterArray(FfiConverterUInt64);
4015
4667
 
4668
+ // FfiConverter for Array<UnfinishedConnection>
4669
+ const FfiConverterSequenceTypeUnfinishedConnection = new FfiConverterArray(FfiConverterTypeUnfinishedConnection);
4670
+
4016
4671
 
4017
4672
  /**
4018
4673
  * This should be called before anything else.
@@ -4038,7 +4693,10 @@ function uniffiEnsureInitialized() {
4038
4693
  export default Object.freeze({
4039
4694
  initialize: uniffiEnsureInitialized,
4040
4695
  converters: {
4696
+ FfiConverterTypeCloseOutcome,
4697
+ FfiConverterTypeConfigCapability,
4041
4698
  FfiConverterTypeConnectTarget,
4699
+ FfiConverterTypeConnectionCloseReason,
4042
4700
  FfiConverterTypeConnectionInfo,
4043
4701
  FfiConverterTypeDiscoveryOptions,
4044
4702
  FfiConverterTypeDiscoverySource,
@@ -4048,6 +4706,7 @@ export default Object.freeze({
4048
4706
  FfiConverterTypeFfiError,
4049
4707
  FfiConverterTypeIdentifyInfo,
4050
4708
  FfiConverterTypeKnownPeerInfo,
4709
+ FfiConverterTypeMdnsFailureKind,
4051
4710
  FfiConverterTypeMdnsOptions,
4052
4711
  FfiConverterTypeNatErrorKind,
4053
4712
  FfiConverterTypeOpenStreamResult,
@@ -4055,5 +4714,6 @@ export default Object.freeze({
4055
4714
  FfiConverterTypePathKind,
4056
4715
  FfiConverterTypeReachability,
4057
4716
  FfiConverterTypeRelayReservationInfo,
4717
+ FfiConverterTypeUnfinishedConnection,
4058
4718
  }
4059
4719
  });