@minip2p/react-native 0.6.0 → 0.7.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.
- package/README.md +1 -1
- package/android/src/main/jniLibs/arm64-v8a/libminip2p_ffi.so +0 -0
- package/android/src/main/jniLibs/x86_64/libminip2p_ffi.so +0 -0
- package/build/Minip2pFfi.xcframework/ios-arm64/libminip2p_ffi.a +2 -2
- package/build/Minip2pFfi.xcframework/ios-arm64-simulator/libminip2p_ffi.a +2 -2
- package/cpp/generated/minip2p_ffi.cpp +14 -175
- package/cpp/generated/minip2p_ffi.hpp +2 -10
- package/lib/module/adapter.js +23 -78
- package/lib/module/adapter.js.map +1 -1
- package/lib/module/generated/minip2p_ffi-ffi.js.map +1 -1
- package/lib/module/generated/minip2p_ffi.js +211 -118
- package/lib/module/generated/minip2p_ffi.js.map +1 -1
- package/lib/typescript/src/adapter.d.ts.map +1 -1
- package/lib/typescript/src/generated/minip2p_ffi-ffi.d.ts +3 -11
- package/lib/typescript/src/generated/minip2p_ffi-ffi.d.ts.map +1 -1
- package/lib/typescript/src/generated/minip2p_ffi.d.ts +204 -125
- package/lib/typescript/src/generated/minip2p_ffi.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/adapter.ts +22 -142
- package/src/generated/minip2p_ffi-ffi.ts +3 -11
- package/src/generated/minip2p_ffi.ts +288 -223
|
@@ -131,65 +131,51 @@ const stringConverter = (() => {
|
|
|
131
131
|
const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
|
-
*
|
|
134
|
+
* State snapshot of the transport connection selected for a peer.
|
|
135
135
|
*/
|
|
136
|
-
export type
|
|
137
|
-
/**
|
|
138
|
-
* Pubsub topic carrying signed discovery beacons.
|
|
139
|
-
*/
|
|
140
|
-
topic: string,
|
|
141
|
-
/**
|
|
142
|
-
* Milliseconds between local beacon announcements.
|
|
143
|
-
*/
|
|
144
|
-
beaconIntervalMs: bigint,
|
|
136
|
+
export type ConnectionInfo = {
|
|
145
137
|
/**
|
|
146
|
-
*
|
|
138
|
+
* Endpoint-local transport connection id.
|
|
147
139
|
*/
|
|
148
|
-
|
|
140
|
+
connId: bigint,
|
|
149
141
|
/**
|
|
150
|
-
*
|
|
142
|
+
* Remote transport address, when recorded.
|
|
151
143
|
*/
|
|
152
|
-
|
|
144
|
+
remoteAddr?: string
|
|
153
145
|
}
|
|
154
146
|
|
|
155
147
|
/**
|
|
156
|
-
* Generated factory for {@link
|
|
148
|
+
* Generated factory for {@link ConnectionInfo} record objects.
|
|
157
149
|
*/
|
|
158
|
-
export const
|
|
150
|
+
export const ConnectionInfo = (() => {
|
|
159
151
|
const defaults = () => ({
|
|
160
152
|
});
|
|
161
153
|
const create = (() => {
|
|
162
|
-
return uniffiCreateRecord<
|
|
154
|
+
return uniffiCreateRecord<ConnectionInfo, ReturnType<typeof defaults>>(defaults);
|
|
163
155
|
})();
|
|
164
156
|
return Object.freeze({
|
|
165
157
|
create,
|
|
166
158
|
new: create,
|
|
167
|
-
defaults: () => Object.freeze(defaults()) as Partial<
|
|
159
|
+
defaults: () => Object.freeze(defaults()) as Partial<ConnectionInfo>,
|
|
168
160
|
});
|
|
169
161
|
})();
|
|
170
162
|
|
|
171
|
-
const
|
|
172
|
-
type TypeName =
|
|
163
|
+
const FfiConverterTypeConnectionInfo = (() => {
|
|
164
|
+
type TypeName = ConnectionInfo;
|
|
173
165
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
174
166
|
readFromCursor(c: Cursor): TypeName {
|
|
175
167
|
return {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
peerTtlMs: FfiConverterUInt64.readFromCursor(c),
|
|
179
|
-
autoDial: FfiConverterBool.readFromCursor(c)
|
|
168
|
+
connId: FfiConverterUInt64.readFromCursor(c),
|
|
169
|
+
remoteAddr: FfiConverterOptionalString.readFromCursor(c)
|
|
180
170
|
};
|
|
181
171
|
}
|
|
182
172
|
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
FfiConverterUInt64.writeIntoCursor(value.peerTtlMs, c);
|
|
186
|
-
FfiConverterBool.writeIntoCursor(value.autoDial, c);
|
|
173
|
+
FfiConverterUInt64.writeIntoCursor(value.connId, c);
|
|
174
|
+
FfiConverterOptionalString.writeIntoCursor(value.remoteAddr, c);
|
|
187
175
|
}
|
|
188
176
|
allocationSize(value: TypeName): number {
|
|
189
|
-
return
|
|
190
|
-
|
|
191
|
-
FfiConverterUInt64.allocationSize(value.peerTtlMs) +
|
|
192
|
-
FfiConverterBool.allocationSize(value.autoDial);
|
|
177
|
+
return FfiConverterUInt64.allocationSize(value.connId) +
|
|
178
|
+
FfiConverterOptionalString.allocationSize(value.remoteAddr);
|
|
193
179
|
|
|
194
180
|
}
|
|
195
181
|
};
|
|
@@ -197,47 +183,65 @@ const FfiConverterTypeDiscoveryOptions = (() => {
|
|
|
197
183
|
})();
|
|
198
184
|
|
|
199
185
|
/**
|
|
200
|
-
*
|
|
186
|
+
* Signed-discovery configuration.
|
|
201
187
|
*/
|
|
202
|
-
export type
|
|
188
|
+
export type DiscoveryOptions = {
|
|
203
189
|
/**
|
|
204
|
-
*
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
190
|
+
* Pubsub topic carrying signed discovery beacons.
|
|
191
|
+
*/
|
|
192
|
+
topic: string,
|
|
193
|
+
/**
|
|
194
|
+
* Milliseconds between local beacon announcements.
|
|
195
|
+
*/
|
|
196
|
+
beaconIntervalMs: bigint,
|
|
197
|
+
/**
|
|
198
|
+
* Milliseconds before a signed peer observation expires.
|
|
208
199
|
*/
|
|
209
|
-
|
|
200
|
+
peerTtlMs: bigint,
|
|
201
|
+
/**
|
|
202
|
+
* Whether accepted observations may trigger automatic dials.
|
|
203
|
+
*/
|
|
204
|
+
autoDial: boolean
|
|
210
205
|
}
|
|
211
206
|
|
|
212
207
|
/**
|
|
213
|
-
* Generated factory for {@link
|
|
208
|
+
* Generated factory for {@link DiscoveryOptions} record objects.
|
|
214
209
|
*/
|
|
215
|
-
export const
|
|
210
|
+
export const DiscoveryOptions = (() => {
|
|
216
211
|
const defaults = () => ({
|
|
217
212
|
});
|
|
218
213
|
const create = (() => {
|
|
219
|
-
return uniffiCreateRecord<
|
|
214
|
+
return uniffiCreateRecord<DiscoveryOptions, ReturnType<typeof defaults>>(defaults);
|
|
220
215
|
})();
|
|
221
216
|
return Object.freeze({
|
|
222
217
|
create,
|
|
223
218
|
new: create,
|
|
224
|
-
defaults: () => Object.freeze(defaults()) as Partial<
|
|
219
|
+
defaults: () => Object.freeze(defaults()) as Partial<DiscoveryOptions>,
|
|
225
220
|
});
|
|
226
221
|
})();
|
|
227
222
|
|
|
228
|
-
const
|
|
229
|
-
type TypeName =
|
|
223
|
+
const FfiConverterTypeDiscoveryOptions = (() => {
|
|
224
|
+
type TypeName = DiscoveryOptions;
|
|
230
225
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
231
226
|
readFromCursor(c: Cursor): TypeName {
|
|
232
227
|
return {
|
|
233
|
-
|
|
228
|
+
topic: FfiConverterString.readFromCursor(c),
|
|
229
|
+
beaconIntervalMs: FfiConverterUInt64.readFromCursor(c),
|
|
230
|
+
peerTtlMs: FfiConverterUInt64.readFromCursor(c),
|
|
231
|
+
autoDial: FfiConverterBool.readFromCursor(c)
|
|
234
232
|
};
|
|
235
233
|
}
|
|
236
234
|
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
237
|
-
|
|
235
|
+
FfiConverterString.writeIntoCursor(value.topic, c);
|
|
236
|
+
FfiConverterUInt64.writeIntoCursor(value.beaconIntervalMs, c);
|
|
237
|
+
FfiConverterUInt64.writeIntoCursor(value.peerTtlMs, c);
|
|
238
|
+
FfiConverterBool.writeIntoCursor(value.autoDial, c);
|
|
238
239
|
}
|
|
239
240
|
allocationSize(value: TypeName): number {
|
|
240
|
-
return
|
|
241
|
+
return FfiConverterString.allocationSize(value.topic) +
|
|
242
|
+
FfiConverterUInt64.allocationSize(value.beaconIntervalMs) +
|
|
243
|
+
FfiConverterUInt64.allocationSize(value.peerTtlMs) +
|
|
244
|
+
FfiConverterBool.allocationSize(value.autoDial);
|
|
241
245
|
|
|
242
246
|
}
|
|
243
247
|
};
|
|
@@ -355,13 +359,10 @@ export type EndpointConfig = {
|
|
|
355
359
|
*/
|
|
356
360
|
autonatServers: Array<string>,
|
|
357
361
|
/**
|
|
358
|
-
*
|
|
359
|
-
|
|
360
|
-
quic?: TransportOptions,
|
|
361
|
-
/**
|
|
362
|
-
* TCP configuration, or no TCP transport when absent.
|
|
362
|
+
* Listen multiaddresses; each address's shape selects its transport.
|
|
363
|
+
* Absent binds the QUIC dual-stack defaults; an empty list is rejected.
|
|
363
364
|
*/
|
|
364
|
-
|
|
365
|
+
listen?: Array<string>,
|
|
365
366
|
/**
|
|
366
367
|
* Whether connection attempts must remain relayed.
|
|
367
368
|
*/
|
|
@@ -408,8 +409,7 @@ const FfiConverterTypeEndpointConfig = (() => {
|
|
|
408
409
|
agentVersion: FfiConverterOptionalString.readFromCursor(c),
|
|
409
410
|
relays: FfiConverterSequenceString.readFromCursor(c),
|
|
410
411
|
autonatServers: FfiConverterSequenceString.readFromCursor(c),
|
|
411
|
-
|
|
412
|
-
tcp: FfiConverterOptionalTypeTransportOptions.readFromCursor(c),
|
|
412
|
+
listen: FfiConverterOptionalSequenceString.readFromCursor(c),
|
|
413
413
|
forceRelay: FfiConverterBool.readFromCursor(c),
|
|
414
414
|
allowUnsigned: FfiConverterBool.readFromCursor(c),
|
|
415
415
|
protocols: FfiConverterSequenceString.readFromCursor(c),
|
|
@@ -421,8 +421,7 @@ const FfiConverterTypeEndpointConfig = (() => {
|
|
|
421
421
|
FfiConverterOptionalString.writeIntoCursor(value.agentVersion, c);
|
|
422
422
|
FfiConverterSequenceString.writeIntoCursor(value.relays, c);
|
|
423
423
|
FfiConverterSequenceString.writeIntoCursor(value.autonatServers, c);
|
|
424
|
-
|
|
425
|
-
FfiConverterOptionalTypeTransportOptions.writeIntoCursor(value.tcp, c);
|
|
424
|
+
FfiConverterOptionalSequenceString.writeIntoCursor(value.listen, c);
|
|
426
425
|
FfiConverterBool.writeIntoCursor(value.forceRelay, c);
|
|
427
426
|
FfiConverterBool.writeIntoCursor(value.allowUnsigned, c);
|
|
428
427
|
FfiConverterSequenceString.writeIntoCursor(value.protocols, c);
|
|
@@ -433,8 +432,7 @@ const FfiConverterTypeEndpointConfig = (() => {
|
|
|
433
432
|
return FfiConverterOptionalString.allocationSize(value.agentVersion) +
|
|
434
433
|
FfiConverterSequenceString.allocationSize(value.relays) +
|
|
435
434
|
FfiConverterSequenceString.allocationSize(value.autonatServers) +
|
|
436
|
-
|
|
437
|
-
FfiConverterOptionalTypeTransportOptions.allocationSize(value.tcp) +
|
|
435
|
+
FfiConverterOptionalSequenceString.allocationSize(value.listen) +
|
|
438
436
|
FfiConverterBool.allocationSize(value.forceRelay) +
|
|
439
437
|
FfiConverterBool.allocationSize(value.allowUnsigned) +
|
|
440
438
|
FfiConverterSequenceString.allocationSize(value.protocols) +
|
|
@@ -717,6 +715,160 @@ const FfiConverterTypeRelayReservationInfo = (() => {
|
|
|
717
715
|
return new FFIConverter();
|
|
718
716
|
})();
|
|
719
717
|
|
|
718
|
+
|
|
719
|
+
// Enum: ConnectTarget
|
|
720
|
+
export enum ConnectTarget_Tags {
|
|
721
|
+
Peer = "Peer",
|
|
722
|
+
Addresses = "Addresses"
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* What a foreign runtime supplies to start one Connection attempt.
|
|
726
|
+
*
|
|
727
|
+
* Validation lives in `minip2p-ffi-core`; this mirror only declares the shape.
|
|
728
|
+
*/
|
|
729
|
+
export const ConnectTarget = (() => {
|
|
730
|
+
|
|
731
|
+
type Peer__interface = {
|
|
732
|
+
tag: ConnectTarget_Tags.Peer;
|
|
733
|
+
inner:
|
|
734
|
+
Readonly<{peerId: string}>
|
|
735
|
+
};
|
|
736
|
+
/**
|
|
737
|
+
* Peer ID only: the endpoint applies its discovery-book and relay
|
|
738
|
+
* policy.
|
|
739
|
+
*/
|
|
740
|
+
class Peer_ extends UniffiEnum implements Peer__interface {
|
|
741
|
+
/**
|
|
742
|
+
* @private
|
|
743
|
+
* This field is private and should not be used, use `tag` instead.
|
|
744
|
+
*/
|
|
745
|
+
readonly [uniffiTypeNameSymbol] = "ConnectTarget";
|
|
746
|
+
readonly tag = ConnectTarget_Tags.Peer;
|
|
747
|
+
readonly inner:
|
|
748
|
+
Readonly<{peerId: string}>;
|
|
749
|
+
constructor(
|
|
750
|
+
inner: {peerId: string }) {
|
|
751
|
+
super("ConnectTarget", "Peer");
|
|
752
|
+
|
|
753
|
+
this.inner = Object.freeze(inner);
|
|
754
|
+
}
|
|
755
|
+
static new(
|
|
756
|
+
inner: {peerId: string }): Peer_ {
|
|
757
|
+
return new Peer_(inner);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
static instanceOf(obj: any): obj is Peer_ {
|
|
761
|
+
return obj.tag === ConnectTarget_Tags.Peer;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
type Addresses__interface = {
|
|
767
|
+
tag: ConnectTarget_Tags.Addresses;
|
|
768
|
+
inner:
|
|
769
|
+
Readonly<{addresses: Array<string>}>
|
|
770
|
+
};
|
|
771
|
+
/**
|
|
772
|
+
* One or more complete direct peer addresses that all name the same
|
|
773
|
+
* peer. One address is the single-address form.
|
|
774
|
+
*/
|
|
775
|
+
class Addresses_ extends UniffiEnum implements Addresses__interface {
|
|
776
|
+
/**
|
|
777
|
+
* @private
|
|
778
|
+
* This field is private and should not be used, use `tag` instead.
|
|
779
|
+
*/
|
|
780
|
+
readonly [uniffiTypeNameSymbol] = "ConnectTarget";
|
|
781
|
+
readonly tag = ConnectTarget_Tags.Addresses;
|
|
782
|
+
readonly inner:
|
|
783
|
+
Readonly<{addresses: Array<string>}>;
|
|
784
|
+
constructor(
|
|
785
|
+
inner: {addresses: Array<string> }) {
|
|
786
|
+
super("ConnectTarget", "Addresses");
|
|
787
|
+
|
|
788
|
+
this.inner = Object.freeze(inner);
|
|
789
|
+
}
|
|
790
|
+
static new(
|
|
791
|
+
inner: {addresses: Array<string> }): Addresses_ {
|
|
792
|
+
return new Addresses_(inner);
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
static instanceOf(obj: any): obj is Addresses_ {
|
|
796
|
+
return obj.tag === ConnectTarget_Tags.Addresses;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
function instanceOf(obj: any): obj is ConnectTarget {
|
|
802
|
+
return obj[uniffiTypeNameSymbol] === "ConnectTarget";
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
return Object.freeze({
|
|
806
|
+
instanceOf,
|
|
807
|
+
Peer: Peer_,
|
|
808
|
+
Addresses: Addresses_
|
|
809
|
+
});
|
|
810
|
+
|
|
811
|
+
})();
|
|
812
|
+
/**
|
|
813
|
+
* What a foreign runtime supplies to start one Connection attempt.
|
|
814
|
+
*
|
|
815
|
+
* Validation lives in `minip2p-ffi-core`; this mirror only declares the shape.
|
|
816
|
+
*/
|
|
817
|
+
export type ConnectTarget = InstanceType<
|
|
818
|
+
typeof ConnectTarget['Peer' | 'Addresses']
|
|
819
|
+
>;
|
|
820
|
+
|
|
821
|
+
// FfiConverter for enum ConnectTarget
|
|
822
|
+
const FfiConverterTypeConnectTarget = (() => {
|
|
823
|
+
type TypeName = ConnectTarget;
|
|
824
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
825
|
+
readFromCursor(c: Cursor): TypeName {
|
|
826
|
+
switch (c.readI32()) {
|
|
827
|
+
case 1: return new ConnectTarget.Peer({peerId: FfiConverterString.readFromCursor(c) });
|
|
828
|
+
case 2: return new ConnectTarget.Addresses({addresses: FfiConverterSequenceString.readFromCursor(c) });
|
|
829
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
833
|
+
switch (value.tag) {
|
|
834
|
+
case ConnectTarget_Tags.Peer: {
|
|
835
|
+
c.writeI32(1);
|
|
836
|
+
const inner = value.inner;
|
|
837
|
+
FfiConverterString.writeIntoCursor(inner.peerId, c);
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
case ConnectTarget_Tags.Addresses: {
|
|
841
|
+
c.writeI32(2);
|
|
842
|
+
const inner = value.inner;
|
|
843
|
+
FfiConverterSequenceString.writeIntoCursor(inner.addresses, c);
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
default:
|
|
847
|
+
// Throwing from here means that ConnectTarget_Tags hasn't matched an ordinal.
|
|
848
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
allocationSize(value: TypeName): number {
|
|
852
|
+
switch (value.tag) {
|
|
853
|
+
case ConnectTarget_Tags.Peer: {
|
|
854
|
+
const inner = value.inner;
|
|
855
|
+
let size = 4;
|
|
856
|
+
size += FfiConverterString.allocationSize(inner.peerId);
|
|
857
|
+
return size;
|
|
858
|
+
}
|
|
859
|
+
case ConnectTarget_Tags.Addresses: {
|
|
860
|
+
const inner = value.inner;
|
|
861
|
+
let size = 4;
|
|
862
|
+
size += FfiConverterSequenceString.allocationSize(inner.addresses);
|
|
863
|
+
return size;
|
|
864
|
+
}
|
|
865
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
return new FFIConverter();
|
|
870
|
+
})();
|
|
871
|
+
|
|
720
872
|
/**
|
|
721
873
|
* Source that contributed a discovery observation.
|
|
722
874
|
*/
|
|
@@ -1894,8 +2046,8 @@ export enum P2pEvent_Tags {
|
|
|
1894
2046
|
InboundPathEstablished = "InboundPathEstablished",
|
|
1895
2047
|
PathUpgraded = "PathUpgraded",
|
|
1896
2048
|
HolePunchFailed = "HolePunchFailed",
|
|
1897
|
-
FellBackToRelay = "FellBackToRelay",
|
|
1898
2049
|
ConnectFailed = "ConnectFailed",
|
|
2050
|
+
ConnectCancelled = "ConnectCancelled",
|
|
1899
2051
|
InboundDirectUpgrade = "InboundDirectUpgrade",
|
|
1900
2052
|
Message = "Message",
|
|
1901
2053
|
PeerSubscribed = "PeerSubscribed",
|
|
@@ -1916,7 +2068,7 @@ export const P2pEvent = (() => {
|
|
|
1916
2068
|
type EventsDropped__interface = {
|
|
1917
2069
|
tag: P2pEvent_Tags.EventsDropped;
|
|
1918
2070
|
inner:
|
|
1919
|
-
Readonly<{dropped: bigint; totalDropped: bigint}>
|
|
2071
|
+
Readonly<{dropped: bigint; totalDropped: bigint; terminalConnectIds: Array<bigint>}>
|
|
1920
2072
|
};
|
|
1921
2073
|
/**
|
|
1922
2074
|
* Native event carry overflow discarded source events.
|
|
@@ -1929,15 +2081,15 @@ Readonly<{dropped: bigint; totalDropped: bigint}>
|
|
|
1929
2081
|
readonly [uniffiTypeNameSymbol] = "P2pEvent";
|
|
1930
2082
|
readonly tag = P2pEvent_Tags.EventsDropped;
|
|
1931
2083
|
readonly inner:
|
|
1932
|
-
Readonly<{dropped: bigint; totalDropped: bigint}>;
|
|
2084
|
+
Readonly<{dropped: bigint; totalDropped: bigint; terminalConnectIds: Array<bigint>}>;
|
|
1933
2085
|
constructor(
|
|
1934
|
-
inner: {dropped: bigint; totalDropped: bigint }) {
|
|
2086
|
+
inner: {dropped: bigint; totalDropped: bigint; terminalConnectIds: Array<bigint> }) {
|
|
1935
2087
|
super("P2pEvent", "EventsDropped");
|
|
1936
2088
|
|
|
1937
2089
|
this.inner = Object.freeze(inner);
|
|
1938
2090
|
}
|
|
1939
2091
|
static new(
|
|
1940
|
-
inner: {dropped: bigint; totalDropped: bigint }): EventsDropped_ {
|
|
2092
|
+
inner: {dropped: bigint; totalDropped: bigint; terminalConnectIds: Array<bigint> }): EventsDropped_ {
|
|
1941
2093
|
return new EventsDropped_(inner);
|
|
1942
2094
|
}
|
|
1943
2095
|
|
|
@@ -2494,7 +2646,7 @@ inner: {relayPeerId: string }): RelayReservationLost_ {
|
|
|
2494
2646
|
type PathEstablished__interface = {
|
|
2495
2647
|
tag: P2pEvent_Tags.PathEstablished;
|
|
2496
2648
|
inner:
|
|
2497
|
-
Readonly<{connectId: bigint; peerId: string; path: PathKind}>
|
|
2649
|
+
Readonly<{connectId: bigint; peerId: string; connId: bigint; path: PathKind}>
|
|
2498
2650
|
};
|
|
2499
2651
|
/**
|
|
2500
2652
|
* The first usable path for an attempt became available.
|
|
@@ -2507,15 +2659,15 @@ Readonly<{connectId: bigint; peerId: string; path: PathKind}>
|
|
|
2507
2659
|
readonly [uniffiTypeNameSymbol] = "P2pEvent";
|
|
2508
2660
|
readonly tag = P2pEvent_Tags.PathEstablished;
|
|
2509
2661
|
readonly inner:
|
|
2510
|
-
Readonly<{connectId: bigint; peerId: string; path: PathKind}>;
|
|
2662
|
+
Readonly<{connectId: bigint; peerId: string; connId: bigint; path: PathKind}>;
|
|
2511
2663
|
constructor(
|
|
2512
|
-
inner: {connectId: bigint; peerId: string; path: PathKind }) {
|
|
2664
|
+
inner: {connectId: bigint; peerId: string; connId: bigint; path: PathKind }) {
|
|
2513
2665
|
super("P2pEvent", "PathEstablished");
|
|
2514
2666
|
|
|
2515
2667
|
this.inner = Object.freeze(inner);
|
|
2516
2668
|
}
|
|
2517
2669
|
static new(
|
|
2518
|
-
inner: {connectId: bigint; peerId: string; path: PathKind }): PathEstablished_ {
|
|
2670
|
+
inner: {connectId: bigint; peerId: string; connId: bigint; path: PathKind }): PathEstablished_ {
|
|
2519
2671
|
return new PathEstablished_(inner);
|
|
2520
2672
|
}
|
|
2521
2673
|
|
|
@@ -2627,70 +2779,71 @@ inner: {connectId: bigint; attempt: number; reason: string }): HolePunchFailed_
|
|
|
2627
2779
|
|
|
2628
2780
|
}
|
|
2629
2781
|
|
|
2630
|
-
type
|
|
2631
|
-
tag: P2pEvent_Tags.
|
|
2782
|
+
type ConnectFailed__interface = {
|
|
2783
|
+
tag: P2pEvent_Tags.ConnectFailed;
|
|
2632
2784
|
inner:
|
|
2633
|
-
Readonly<{connectId: bigint; peerId: string}>
|
|
2785
|
+
Readonly<{connectId: bigint; peerId: string; kind: NatErrorKind; detail: string}>
|
|
2634
2786
|
};
|
|
2635
2787
|
/**
|
|
2636
|
-
*
|
|
2788
|
+
* A connection attempt ended without a usable path.
|
|
2637
2789
|
*/
|
|
2638
|
-
class
|
|
2790
|
+
class ConnectFailed_ extends UniffiEnum implements ConnectFailed__interface {
|
|
2639
2791
|
/**
|
|
2640
2792
|
* @private
|
|
2641
2793
|
* This field is private and should not be used, use `tag` instead.
|
|
2642
2794
|
*/
|
|
2643
2795
|
readonly [uniffiTypeNameSymbol] = "P2pEvent";
|
|
2644
|
-
readonly tag = P2pEvent_Tags.
|
|
2796
|
+
readonly tag = P2pEvent_Tags.ConnectFailed;
|
|
2645
2797
|
readonly inner:
|
|
2646
|
-
Readonly<{connectId: bigint; peerId: string}>;
|
|
2798
|
+
Readonly<{connectId: bigint; peerId: string; kind: NatErrorKind; detail: string}>;
|
|
2647
2799
|
constructor(
|
|
2648
|
-
inner: {connectId: bigint; peerId: string }) {
|
|
2649
|
-
super("P2pEvent", "
|
|
2800
|
+
inner: {connectId: bigint; peerId: string; kind: NatErrorKind; detail: string }) {
|
|
2801
|
+
super("P2pEvent", "ConnectFailed");
|
|
2650
2802
|
|
|
2651
2803
|
this.inner = Object.freeze(inner);
|
|
2652
2804
|
}
|
|
2653
2805
|
static new(
|
|
2654
|
-
inner: {connectId: bigint; peerId: string }):
|
|
2655
|
-
return new
|
|
2806
|
+
inner: {connectId: bigint; peerId: string; kind: NatErrorKind; detail: string }): ConnectFailed_ {
|
|
2807
|
+
return new ConnectFailed_(inner);
|
|
2656
2808
|
}
|
|
2657
2809
|
|
|
2658
|
-
static instanceOf(obj: any): obj is
|
|
2659
|
-
return obj.tag === P2pEvent_Tags.
|
|
2810
|
+
static instanceOf(obj: any): obj is ConnectFailed_ {
|
|
2811
|
+
return obj.tag === P2pEvent_Tags.ConnectFailed;
|
|
2660
2812
|
}
|
|
2661
2813
|
|
|
2662
2814
|
}
|
|
2663
2815
|
|
|
2664
|
-
type
|
|
2665
|
-
tag: P2pEvent_Tags.
|
|
2816
|
+
type ConnectCancelled__interface = {
|
|
2817
|
+
tag: P2pEvent_Tags.ConnectCancelled;
|
|
2666
2818
|
inner:
|
|
2667
|
-
Readonly<{connectId: bigint; peerId: string
|
|
2819
|
+
Readonly<{connectId: bigint; peerId: string}>
|
|
2668
2820
|
};
|
|
2669
2821
|
/**
|
|
2670
|
-
* A
|
|
2822
|
+
* A Connection attempt was cancelled by `cancel_connect` before it
|
|
2823
|
+
* settled. Terminal for that Connect ID.
|
|
2671
2824
|
*/
|
|
2672
|
-
class
|
|
2825
|
+
class ConnectCancelled_ extends UniffiEnum implements ConnectCancelled__interface {
|
|
2673
2826
|
/**
|
|
2674
2827
|
* @private
|
|
2675
2828
|
* This field is private and should not be used, use `tag` instead.
|
|
2676
2829
|
*/
|
|
2677
2830
|
readonly [uniffiTypeNameSymbol] = "P2pEvent";
|
|
2678
|
-
readonly tag = P2pEvent_Tags.
|
|
2831
|
+
readonly tag = P2pEvent_Tags.ConnectCancelled;
|
|
2679
2832
|
readonly inner:
|
|
2680
|
-
Readonly<{connectId: bigint; peerId: string
|
|
2833
|
+
Readonly<{connectId: bigint; peerId: string}>;
|
|
2681
2834
|
constructor(
|
|
2682
|
-
inner: {connectId: bigint; peerId: string
|
|
2683
|
-
super("P2pEvent", "
|
|
2835
|
+
inner: {connectId: bigint; peerId: string }) {
|
|
2836
|
+
super("P2pEvent", "ConnectCancelled");
|
|
2684
2837
|
|
|
2685
2838
|
this.inner = Object.freeze(inner);
|
|
2686
2839
|
}
|
|
2687
2840
|
static new(
|
|
2688
|
-
inner: {connectId: bigint; peerId: string
|
|
2689
|
-
return new
|
|
2841
|
+
inner: {connectId: bigint; peerId: string }): ConnectCancelled_ {
|
|
2842
|
+
return new ConnectCancelled_(inner);
|
|
2690
2843
|
}
|
|
2691
2844
|
|
|
2692
|
-
static instanceOf(obj: any): obj is
|
|
2693
|
-
return obj.tag === P2pEvent_Tags.
|
|
2845
|
+
static instanceOf(obj: any): obj is ConnectCancelled_ {
|
|
2846
|
+
return obj.tag === P2pEvent_Tags.ConnectCancelled;
|
|
2694
2847
|
}
|
|
2695
2848
|
|
|
2696
2849
|
}
|
|
@@ -3100,8 +3253,8 @@ inner: {peerId?: string; source: DiscoverySource; reason: string; suppressed: nu
|
|
|
3100
3253
|
InboundPathEstablished: InboundPathEstablished_,
|
|
3101
3254
|
PathUpgraded: PathUpgraded_,
|
|
3102
3255
|
HolePunchFailed: HolePunchFailed_,
|
|
3103
|
-
FellBackToRelay: FellBackToRelay_,
|
|
3104
3256
|
ConnectFailed: ConnectFailed_,
|
|
3257
|
+
ConnectCancelled: ConnectCancelled_,
|
|
3105
3258
|
InboundDirectUpgrade: InboundDirectUpgrade_,
|
|
3106
3259
|
Message: Message_,
|
|
3107
3260
|
PeerSubscribed: PeerSubscribed_,
|
|
@@ -3120,7 +3273,7 @@ inner: {peerId?: string; source: DiscoverySource; reason: string; suppressed: nu
|
|
|
3120
3273
|
* Event delivered by the native endpoint driver.
|
|
3121
3274
|
*/
|
|
3122
3275
|
export type P2pEvent = InstanceType<
|
|
3123
|
-
typeof P2pEvent['EventsDropped' | 'DriverFailed' | 'ConnectionEstablished' | 'ConnectionClosed' | 'PeerReady' | 'IdentifyReceived' | 'PingRttMeasured' | 'PingTimeout' | 'StreamReady' | 'StreamData' | 'StreamRemoteWriteClosed' | 'StreamClosed' | 'EndpointError' | 'ReachabilityChanged' | 'PublicAddressesChanged' | 'RelayReserved' | 'RelayReservationLost' | 'PathEstablished' | 'InboundPathEstablished' | 'PathUpgraded' | 'HolePunchFailed' | '
|
|
3276
|
+
typeof P2pEvent['EventsDropped' | 'DriverFailed' | 'ConnectionEstablished' | 'ConnectionClosed' | 'PeerReady' | 'IdentifyReceived' | 'PingRttMeasured' | 'PingTimeout' | 'StreamReady' | 'StreamData' | 'StreamRemoteWriteClosed' | 'StreamClosed' | 'EndpointError' | 'ReachabilityChanged' | 'PublicAddressesChanged' | 'RelayReserved' | 'RelayReservationLost' | 'PathEstablished' | 'InboundPathEstablished' | 'PathUpgraded' | 'HolePunchFailed' | 'ConnectFailed' | 'ConnectCancelled' | 'InboundDirectUpgrade' | 'Message' | 'PeerSubscribed' | 'PeerUnsubscribed' | 'GossipsubOutboundFailure' | 'GossipsubProtocolViolation' | 'PeerDiscovered' | 'PeerUpdated' | 'PeerExpired' | 'DiscoveryDialFailed' | 'DiscoveryProtocolViolation']
|
|
3124
3277
|
>;
|
|
3125
3278
|
|
|
3126
3279
|
// FfiConverter for enum P2pEvent
|
|
@@ -3129,7 +3282,7 @@ const FfiConverterTypeP2pEvent = (() => {
|
|
|
3129
3282
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3130
3283
|
readFromCursor(c: Cursor): TypeName {
|
|
3131
3284
|
switch (c.readI32()) {
|
|
3132
|
-
case 1: return new P2pEvent.EventsDropped({dropped: FfiConverterUInt64.readFromCursor(c), totalDropped: FfiConverterUInt64.readFromCursor(c) });
|
|
3285
|
+
case 1: return new P2pEvent.EventsDropped({dropped: FfiConverterUInt64.readFromCursor(c), totalDropped: FfiConverterUInt64.readFromCursor(c), terminalConnectIds: FfiConverterSequenceUInt64.readFromCursor(c) });
|
|
3133
3286
|
case 2: return new P2pEvent.DriverFailed({kind: FfiConverterTypeDriverFailureKind.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
|
|
3134
3287
|
case 3: return new P2pEvent.ConnectionEstablished({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
|
|
3135
3288
|
case 4: return new P2pEvent.ConnectionClosed({peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c) });
|
|
@@ -3146,12 +3299,12 @@ const FfiConverterTypeP2pEvent = (() => {
|
|
|
3146
3299
|
case 15: return new P2pEvent.PublicAddressesChanged({addrs: FfiConverterSequenceString.readFromCursor(c) });
|
|
3147
3300
|
case 16: return new P2pEvent.RelayReserved({relayPeerId: FfiConverterString.readFromCursor(c), expiresUnixSecs: FfiConverterOptionalUInt64.readFromCursor(c) });
|
|
3148
3301
|
case 17: return new P2pEvent.RelayReservationLost({relayPeerId: FfiConverterString.readFromCursor(c) });
|
|
3149
|
-
case 18: return new P2pEvent.PathEstablished({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c) });
|
|
3302
|
+
case 18: return new P2pEvent.PathEstablished({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), connId: FfiConverterUInt64.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c) });
|
|
3150
3303
|
case 19: return new P2pEvent.InboundPathEstablished({peerId: FfiConverterString.readFromCursor(c), path: FfiConverterTypePathKind.readFromCursor(c) });
|
|
3151
3304
|
case 20: return new P2pEvent.PathUpgraded({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), from: FfiConverterTypePathKind.readFromCursor(c), to: FfiConverterTypePathKind.readFromCursor(c) });
|
|
3152
3305
|
case 21: return new P2pEvent.HolePunchFailed({connectId: FfiConverterUInt64.readFromCursor(c), attempt: FfiConverterUInt32.readFromCursor(c), reason: FfiConverterString.readFromCursor(c) });
|
|
3153
|
-
case 22: return new P2pEvent.
|
|
3154
|
-
case 23: return new P2pEvent.
|
|
3306
|
+
case 22: return new P2pEvent.ConnectFailed({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c), kind: FfiConverterTypeNatErrorKind.readFromCursor(c), detail: FfiConverterString.readFromCursor(c) });
|
|
3307
|
+
case 23: return new P2pEvent.ConnectCancelled({connectId: FfiConverterUInt64.readFromCursor(c), peerId: FfiConverterString.readFromCursor(c) });
|
|
3155
3308
|
case 24: return new P2pEvent.InboundDirectUpgrade({peerId: FfiConverterString.readFromCursor(c) });
|
|
3156
3309
|
case 25: return new P2pEvent.Message({fromPeerId: FfiConverterString.readFromCursor(c), topics: FfiConverterSequenceString.readFromCursor(c), data: FfiConverterArrayBuffer.readFromCursor(c), seqno: FfiConverterArrayBuffer.readFromCursor(c), signed: FfiConverterBool.readFromCursor(c) });
|
|
3157
3310
|
case 26: return new P2pEvent.PeerSubscribed({peerId: FfiConverterString.readFromCursor(c), topic: FfiConverterString.readFromCursor(c) });
|
|
@@ -3173,6 +3326,7 @@ const FfiConverterTypeP2pEvent = (() => {
|
|
|
3173
3326
|
const inner = value.inner;
|
|
3174
3327
|
FfiConverterUInt64.writeIntoCursor(inner.dropped, c);
|
|
3175
3328
|
FfiConverterUInt64.writeIntoCursor(inner.totalDropped, c);
|
|
3329
|
+
FfiConverterSequenceUInt64.writeIntoCursor(inner.terminalConnectIds, c);
|
|
3176
3330
|
return;
|
|
3177
3331
|
}
|
|
3178
3332
|
case P2pEvent_Tags.DriverFailed: {
|
|
@@ -3300,6 +3454,7 @@ const FfiConverterTypeP2pEvent = (() => {
|
|
|
3300
3454
|
const inner = value.inner;
|
|
3301
3455
|
FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
|
|
3302
3456
|
FfiConverterString.writeIntoCursor(inner.peerId, c);
|
|
3457
|
+
FfiConverterUInt64.writeIntoCursor(inner.connId, c);
|
|
3303
3458
|
FfiConverterTypePathKind.writeIntoCursor(inner.path, c);
|
|
3304
3459
|
return;
|
|
3305
3460
|
}
|
|
@@ -3327,20 +3482,20 @@ const FfiConverterTypeP2pEvent = (() => {
|
|
|
3327
3482
|
FfiConverterString.writeIntoCursor(inner.reason, c);
|
|
3328
3483
|
return;
|
|
3329
3484
|
}
|
|
3330
|
-
case P2pEvent_Tags.
|
|
3485
|
+
case P2pEvent_Tags.ConnectFailed: {
|
|
3331
3486
|
c.writeI32(22);
|
|
3332
3487
|
const inner = value.inner;
|
|
3333
3488
|
FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
|
|
3334
3489
|
FfiConverterString.writeIntoCursor(inner.peerId, c);
|
|
3490
|
+
FfiConverterTypeNatErrorKind.writeIntoCursor(inner.kind, c);
|
|
3491
|
+
FfiConverterString.writeIntoCursor(inner.detail, c);
|
|
3335
3492
|
return;
|
|
3336
3493
|
}
|
|
3337
|
-
case P2pEvent_Tags.
|
|
3494
|
+
case P2pEvent_Tags.ConnectCancelled: {
|
|
3338
3495
|
c.writeI32(23);
|
|
3339
3496
|
const inner = value.inner;
|
|
3340
3497
|
FfiConverterUInt64.writeIntoCursor(inner.connectId, c);
|
|
3341
3498
|
FfiConverterString.writeIntoCursor(inner.peerId, c);
|
|
3342
|
-
FfiConverterTypeNatErrorKind.writeIntoCursor(inner.kind, c);
|
|
3343
|
-
FfiConverterString.writeIntoCursor(inner.detail, c);
|
|
3344
3499
|
return;
|
|
3345
3500
|
}
|
|
3346
3501
|
case P2pEvent_Tags.InboundDirectUpgrade: {
|
|
@@ -3437,6 +3592,7 @@ const FfiConverterTypeP2pEvent = (() => {
|
|
|
3437
3592
|
let size = 4;
|
|
3438
3593
|
size += FfiConverterUInt64.allocationSize(inner.dropped);
|
|
3439
3594
|
size += FfiConverterUInt64.allocationSize(inner.totalDropped);
|
|
3595
|
+
size += FfiConverterSequenceUInt64.allocationSize(inner.terminalConnectIds);
|
|
3440
3596
|
return size;
|
|
3441
3597
|
}
|
|
3442
3598
|
case P2pEvent_Tags.DriverFailed: {
|
|
@@ -3564,6 +3720,7 @@ const FfiConverterTypeP2pEvent = (() => {
|
|
|
3564
3720
|
let size = 4;
|
|
3565
3721
|
size += FfiConverterUInt64.allocationSize(inner.connectId);
|
|
3566
3722
|
size += FfiConverterString.allocationSize(inner.peerId);
|
|
3723
|
+
size += FfiConverterUInt64.allocationSize(inner.connId);
|
|
3567
3724
|
size += FfiConverterTypePathKind.allocationSize(inner.path);
|
|
3568
3725
|
return size;
|
|
3569
3726
|
}
|
|
@@ -3591,20 +3748,20 @@ const FfiConverterTypeP2pEvent = (() => {
|
|
|
3591
3748
|
size += FfiConverterString.allocationSize(inner.reason);
|
|
3592
3749
|
return size;
|
|
3593
3750
|
}
|
|
3594
|
-
case P2pEvent_Tags.
|
|
3751
|
+
case P2pEvent_Tags.ConnectFailed: {
|
|
3595
3752
|
const inner = value.inner;
|
|
3596
3753
|
let size = 4;
|
|
3597
3754
|
size += FfiConverterUInt64.allocationSize(inner.connectId);
|
|
3598
3755
|
size += FfiConverterString.allocationSize(inner.peerId);
|
|
3756
|
+
size += FfiConverterTypeNatErrorKind.allocationSize(inner.kind);
|
|
3757
|
+
size += FfiConverterString.allocationSize(inner.detail);
|
|
3599
3758
|
return size;
|
|
3600
3759
|
}
|
|
3601
|
-
case P2pEvent_Tags.
|
|
3760
|
+
case P2pEvent_Tags.ConnectCancelled: {
|
|
3602
3761
|
const inner = value.inner;
|
|
3603
3762
|
let size = 4;
|
|
3604
3763
|
size += FfiConverterUInt64.allocationSize(inner.connectId);
|
|
3605
3764
|
size += FfiConverterString.allocationSize(inner.peerId);
|
|
3606
|
-
size += FfiConverterTypeNatErrorKind.allocationSize(inner.kind);
|
|
3607
|
-
size += FfiConverterString.allocationSize(inner.detail);
|
|
3608
3765
|
return size;
|
|
3609
3766
|
}
|
|
3610
3767
|
case P2pEvent_Tags.InboundDirectUpgrade: {
|
|
@@ -3878,33 +4035,17 @@ export interface P2pEndpointLike {
|
|
|
3878
4035
|
*/
|
|
3879
4036
|
closeStreamWrite(peerId: string, streamId: bigint) /*throws*/: void;
|
|
3880
4037
|
/**
|
|
3881
|
-
* Starts
|
|
3882
|
-
*/
|
|
3883
|
-
connect(peerId: string) /*throws*/: bigint;
|
|
3884
|
-
/**
|
|
3885
|
-
* Starts a direct-address connection attempt.
|
|
4038
|
+
* Starts one Connection attempt and returns its Connect ID.
|
|
3886
4039
|
*/
|
|
3887
|
-
|
|
3888
|
-
/**
|
|
3889
|
-
* Starts a connection attempt with explicit addresses.
|
|
3890
|
-
*/
|
|
3891
|
-
connectWithAddrs(peerId: string, addresses: Array<string>) /*throws*/: bigint;
|
|
4040
|
+
connect(target: ConnectTarget) /*throws*/: bigint;
|
|
3892
4041
|
/**
|
|
3893
4042
|
* Returns connected peers.
|
|
3894
4043
|
*/
|
|
3895
4044
|
connectedPeers() /*throws*/: Array<string>;
|
|
3896
4045
|
/**
|
|
3897
|
-
*
|
|
3898
|
-
*/
|
|
3899
|
-
dial(address: string) /*throws*/: Array<bigint>;
|
|
3900
|
-
/**
|
|
3901
|
-
* Dials using IPv4.
|
|
4046
|
+
* Returns the transport connection selected for a peer.
|
|
3902
4047
|
*/
|
|
3903
|
-
|
|
3904
|
-
/**
|
|
3905
|
-
* Dials using IPv6.
|
|
3906
|
-
*/
|
|
3907
|
-
dialIp6(address: string) /*throws*/: bigint;
|
|
4048
|
+
connectionInfo(peerId: string) /*throws*/: ConnectionInfo | undefined;
|
|
3908
4049
|
/**
|
|
3909
4050
|
* Disconnects a peer.
|
|
3910
4051
|
*/
|
|
@@ -4110,48 +4251,15 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
|
|
|
4110
4251
|
}
|
|
4111
4252
|
|
|
4112
4253
|
/**
|
|
4113
|
-
* Starts
|
|
4254
|
+
* Starts one Connection attempt and returns its Connect ID.
|
|
4114
4255
|
*/
|
|
4115
|
-
connect(
|
|
4256
|
+
connect(target: ConnectTarget): bigint /*throws*/ {
|
|
4116
4257
|
return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(
|
|
4117
4258
|
/*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
|
|
4118
4259
|
/*caller:*/ (callStatus) => {
|
|
4119
4260
|
return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connect(
|
|
4120
4261
|
uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
|
|
4121
|
-
|
|
4122
|
-
callStatus);
|
|
4123
|
-
},
|
|
4124
|
-
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
4125
|
-
));
|
|
4126
|
-
}
|
|
4127
|
-
|
|
4128
|
-
/**
|
|
4129
|
-
* Starts a direct-address connection attempt.
|
|
4130
|
-
*/
|
|
4131
|
-
connectAddr(address: string): bigint /*throws*/ {
|
|
4132
|
-
return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(
|
|
4133
|
-
/*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
|
|
4134
|
-
/*caller:*/ (callStatus) => {
|
|
4135
|
-
return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connect_addr(
|
|
4136
|
-
uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
|
|
4137
|
-
FfiConverterString.lower(address, nativeModule().rustbuffer_alloc),
|
|
4138
|
-
callStatus);
|
|
4139
|
-
},
|
|
4140
|
-
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
4141
|
-
));
|
|
4142
|
-
}
|
|
4143
|
-
|
|
4144
|
-
/**
|
|
4145
|
-
* Starts a connection attempt with explicit addresses.
|
|
4146
|
-
*/
|
|
4147
|
-
connectWithAddrs(peerId: string, addresses: Array<string>): bigint /*throws*/ {
|
|
4148
|
-
return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(
|
|
4149
|
-
/*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
|
|
4150
|
-
/*caller:*/ (callStatus) => {
|
|
4151
|
-
return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connect_with_addrs(
|
|
4152
|
-
uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
|
|
4153
|
-
FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc),
|
|
4154
|
-
FfiConverterSequenceString.lower(addresses, nativeModule().rustbuffer_alloc),
|
|
4262
|
+
FfiConverterTypeConnectTarget.lower(target, nativeModule().rustbuffer_alloc),
|
|
4155
4263
|
callStatus);
|
|
4156
4264
|
},
|
|
4157
4265
|
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
@@ -4179,58 +4287,26 @@ export class P2pEndpoint extends UniffiAbstractObject implements P2pEndpointLike
|
|
|
4179
4287
|
}
|
|
4180
4288
|
|
|
4181
4289
|
/**
|
|
4182
|
-
*
|
|
4290
|
+
* Returns the transport connection selected for a peer.
|
|
4183
4291
|
*/
|
|
4184
|
-
|
|
4292
|
+
connectionInfo(peerId: string): ConnectionInfo | undefined /*throws*/ {
|
|
4185
4293
|
const __rb: Uint8Array = uniffiCaller.rustCallWithError(
|
|
4186
4294
|
/*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
|
|
4187
4295
|
/*caller:*/ (callStatus) => {
|
|
4188
|
-
return nativeModule().
|
|
4296
|
+
return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_connection_info(
|
|
4189
4297
|
uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
|
|
4190
|
-
FfiConverterString.lower(
|
|
4298
|
+
FfiConverterString.lower(peerId, nativeModule().rustbuffer_alloc),
|
|
4191
4299
|
callStatus);
|
|
4192
4300
|
},
|
|
4193
4301
|
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
4194
4302
|
);
|
|
4195
4303
|
try {
|
|
4196
|
-
return
|
|
4304
|
+
return FfiConverterOptionalTypeConnectionInfo.lift(__rb);
|
|
4197
4305
|
} finally {
|
|
4198
4306
|
nativeModule().rustbuffer_free(__rb);
|
|
4199
4307
|
}
|
|
4200
4308
|
}
|
|
4201
4309
|
|
|
4202
|
-
/**
|
|
4203
|
-
* Dials using IPv4.
|
|
4204
|
-
*/
|
|
4205
|
-
dialIp4(address: string): bigint /*throws*/ {
|
|
4206
|
-
return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(
|
|
4207
|
-
/*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
|
|
4208
|
-
/*caller:*/ (callStatus) => {
|
|
4209
|
-
return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_dial_ip4(
|
|
4210
|
-
uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
|
|
4211
|
-
FfiConverterString.lower(address, nativeModule().rustbuffer_alloc),
|
|
4212
|
-
callStatus);
|
|
4213
|
-
},
|
|
4214
|
-
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
4215
|
-
));
|
|
4216
|
-
}
|
|
4217
|
-
|
|
4218
|
-
/**
|
|
4219
|
-
* Dials using IPv6.
|
|
4220
|
-
*/
|
|
4221
|
-
dialIp6(address: string): bigint /*throws*/ {
|
|
4222
|
-
return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(
|
|
4223
|
-
/*liftError:*/ FfiConverterTypeFfiError.lift.bind(FfiConverterTypeFfiError),
|
|
4224
|
-
/*caller:*/ (callStatus) => {
|
|
4225
|
-
return nativeModule().ubrn_uniffi_minip2p_ffi_fn_method_p2pendpoint_dial_ip6(
|
|
4226
|
-
uniffiTypeP2pEndpointObjectFactory.clonePointer(this),
|
|
4227
|
-
FfiConverterString.lower(address, nativeModule().rustbuffer_alloc),
|
|
4228
|
-
callStatus);
|
|
4229
|
-
},
|
|
4230
|
-
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
4231
|
-
));
|
|
4232
|
-
}
|
|
4233
|
-
|
|
4234
4310
|
/**
|
|
4235
4311
|
* Disconnects a peer.
|
|
4236
4312
|
*/
|
|
@@ -4682,9 +4758,6 @@ const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);
|
|
|
4682
4758
|
// FfiConverter for Array<string> | undefined
|
|
4683
4759
|
const FfiConverterOptionalSequenceString = new FfiConverterOptional(FfiConverterSequenceString);
|
|
4684
4760
|
|
|
4685
|
-
// FfiConverter for TransportOptions | undefined
|
|
4686
|
-
const FfiConverterOptionalTypeTransportOptions = new FfiConverterOptional(FfiConverterTypeTransportOptions);
|
|
4687
|
-
|
|
4688
4761
|
// FfiConverter for DiscoveryOptions | undefined
|
|
4689
4762
|
const FfiConverterOptionalTypeDiscoveryOptions = new FfiConverterOptional(FfiConverterTypeDiscoveryOptions);
|
|
4690
4763
|
|
|
@@ -4697,11 +4770,14 @@ const FfiConverterOptionalBytes = new FfiConverterOptional(FfiConverterArrayBuff
|
|
|
4697
4770
|
// FfiConverter for bigint | undefined
|
|
4698
4771
|
const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);
|
|
4699
4772
|
|
|
4773
|
+
// FfiConverter for Array<bigint>
|
|
4774
|
+
const FfiConverterSequenceUInt64 = new FfiConverterArray(FfiConverterUInt64);
|
|
4775
|
+
|
|
4700
4776
|
// FfiConverter for RelayReservationInfo | undefined
|
|
4701
4777
|
const FfiConverterOptionalTypeRelayReservationInfo = new FfiConverterOptional(FfiConverterTypeRelayReservationInfo);
|
|
4702
4778
|
|
|
4703
|
-
// FfiConverter for
|
|
4704
|
-
const
|
|
4779
|
+
// FfiConverter for ConnectionInfo | undefined
|
|
4780
|
+
const FfiConverterOptionalTypeConnectionInfo = new FfiConverterOptional(FfiConverterTypeConnectionInfo);
|
|
4705
4781
|
|
|
4706
4782
|
// FfiConverter for Array<P2pEvent>
|
|
4707
4783
|
const FfiConverterSequenceTypeP2pEvent = new FfiConverterArray(FfiConverterTypeP2pEvent);
|
|
@@ -4761,26 +4837,14 @@ function uniffiEnsureInitialized() {
|
|
|
4761
4837
|
if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write() !== 17994) {
|
|
4762
4838
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_close_stream_write");
|
|
4763
4839
|
}
|
|
4764
|
-
if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect() !==
|
|
4840
|
+
if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect() !== 53603) {
|
|
4765
4841
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect");
|
|
4766
4842
|
}
|
|
4767
|
-
if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_addr() !== 56611) {
|
|
4768
|
-
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_addr");
|
|
4769
|
-
}
|
|
4770
|
-
if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_with_addrs() !== 2062) {
|
|
4771
|
-
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connect_with_addrs");
|
|
4772
|
-
}
|
|
4773
4843
|
if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers() !== 64148) {
|
|
4774
4844
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connected_peers");
|
|
4775
4845
|
}
|
|
4776
|
-
if (nativeModule().
|
|
4777
|
-
throw new UniffiInternalError.ApiChecksumMismatch("
|
|
4778
|
-
}
|
|
4779
|
-
if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip4() !== 54241) {
|
|
4780
|
-
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip4");
|
|
4781
|
-
}
|
|
4782
|
-
if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip6() !== 3676) {
|
|
4783
|
-
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_dial_ip6");
|
|
4846
|
+
if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_connection_info() !== 24337) {
|
|
4847
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_connection_info");
|
|
4784
4848
|
}
|
|
4785
4849
|
if (nativeModule().ubrn_uniffi_minip2p_ffi_checksum_method_p2pendpoint_disconnect() !== 23975) {
|
|
4786
4850
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_minip2p_ffi_checksum_method_p2pendpoint_disconnect");
|
|
@@ -4858,6 +4922,8 @@ function uniffiEnsureInitialized() {
|
|
|
4858
4922
|
export default Object.freeze({
|
|
4859
4923
|
initialize: uniffiEnsureInitialized,
|
|
4860
4924
|
converters: {
|
|
4925
|
+
FfiConverterTypeConnectTarget,
|
|
4926
|
+
FfiConverterTypeConnectionInfo,
|
|
4861
4927
|
FfiConverterTypeDiscoveryOptions,
|
|
4862
4928
|
FfiConverterTypeDiscoverySource,
|
|
4863
4929
|
FfiConverterTypeDriverFailureKind,
|
|
@@ -4875,6 +4941,5 @@ export default Object.freeze({
|
|
|
4875
4941
|
FfiConverterTypePathKind,
|
|
4876
4942
|
FfiConverterTypeReachability,
|
|
4877
4943
|
FfiConverterTypeRelayReservationInfo,
|
|
4878
|
-
FfiConverterTypeTransportOptions,
|
|
4879
4944
|
}
|
|
4880
4945
|
});
|