@minip2p/react-native 0.8.3 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/lib/module/adapter.js +95 -18
- package/lib/module/adapter.js.map +1 -1
- package/lib/module/generated/minip2p_ffi.js +4 -2
- package/lib/module/generated/minip2p_ffi.js.map +1 -1
- package/lib/module/generated/minip2p_ffi_core.js +243 -3
- package/lib/module/generated/minip2p_ffi_core.js.map +1 -1
- package/lib/typescript/src/adapter.d.ts.map +1 -1
- package/lib/typescript/src/generated/minip2p_ffi.d.ts +6 -2
- package/lib/typescript/src/generated/minip2p_ffi.d.ts.map +1 -1
- package/lib/typescript/src/generated/minip2p_ffi_core.d.ts +179 -20
- package/lib/typescript/src/generated/minip2p_ffi_core.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/adapter.ts +97 -33
- package/src/generated/minip2p_ffi.ts +7 -3
- package/src/generated/minip2p_ffi_core.ts +237 -11
|
@@ -408,6 +408,77 @@ const FfiConverterTypeRelayReservationInfo = (() => {
|
|
|
408
408
|
return new FFIConverter();
|
|
409
409
|
})();
|
|
410
410
|
|
|
411
|
+
/**
|
|
412
|
+
* The part of an endpoint's configuration an [`FfiError::InvalidConfig`]
|
|
413
|
+
* names.
|
|
414
|
+
*
|
|
415
|
+
* A configuration mistake is fixed by changing that part; an environment
|
|
416
|
+
* failure (a socket the platform refused) is [`FfiError::Transport`]
|
|
417
|
+
* instead.
|
|
418
|
+
*/
|
|
419
|
+
export let ConfigCapability = /*#__PURE__*/function (ConfigCapability) {
|
|
420
|
+
/**
|
|
421
|
+
* Gossipsub settings.
|
|
422
|
+
*/
|
|
423
|
+
ConfigCapability[ConfigCapability["Gossipsub"] = 0] = "Gossipsub";
|
|
424
|
+
/**
|
|
425
|
+
* mDNS settings.
|
|
426
|
+
*/
|
|
427
|
+
ConfigCapability[ConfigCapability["Mdns"] = 1] = "Mdns";
|
|
428
|
+
/**
|
|
429
|
+
* Signed discovery or peer-book settings.
|
|
430
|
+
*/
|
|
431
|
+
ConfigCapability[ConfigCapability["Discovery"] = 2] = "Discovery";
|
|
432
|
+
/**
|
|
433
|
+
* QUIC or TCP transport settings (limits, TLS, the TCP namespace).
|
|
434
|
+
*/
|
|
435
|
+
ConfigCapability[ConfigCapability["Transport"] = 3] = "Transport";
|
|
436
|
+
/**
|
|
437
|
+
* The endpoint's own options: listen addresses, protocols, NAT and
|
|
438
|
+
* relay policy, auto-dial.
|
|
439
|
+
*/
|
|
440
|
+
ConfigCapability[ConfigCapability["Options"] = 4] = "Options";
|
|
441
|
+
return ConfigCapability;
|
|
442
|
+
}({});
|
|
443
|
+
const FfiConverterTypeConfigCapability = (() => {
|
|
444
|
+
class FFIConverter extends AbstractFfiConverterByteArray {
|
|
445
|
+
readFromCursor(c) {
|
|
446
|
+
switch (c.readI32()) {
|
|
447
|
+
case 1:
|
|
448
|
+
return ConfigCapability.Gossipsub;
|
|
449
|
+
case 2:
|
|
450
|
+
return ConfigCapability.Mdns;
|
|
451
|
+
case 3:
|
|
452
|
+
return ConfigCapability.Discovery;
|
|
453
|
+
case 4:
|
|
454
|
+
return ConfigCapability.Transport;
|
|
455
|
+
case 5:
|
|
456
|
+
return ConfigCapability.Options;
|
|
457
|
+
default:
|
|
458
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
writeIntoCursor(value, c) {
|
|
462
|
+
switch (value) {
|
|
463
|
+
case ConfigCapability.Gossipsub:
|
|
464
|
+
return c.writeI32(1);
|
|
465
|
+
case ConfigCapability.Mdns:
|
|
466
|
+
return c.writeI32(2);
|
|
467
|
+
case ConfigCapability.Discovery:
|
|
468
|
+
return c.writeI32(3);
|
|
469
|
+
case ConfigCapability.Transport:
|
|
470
|
+
return c.writeI32(4);
|
|
471
|
+
case ConfigCapability.Options:
|
|
472
|
+
return c.writeI32(5);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
allocationSize(value) {
|
|
476
|
+
return 4;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
return new FFIConverter();
|
|
480
|
+
})();
|
|
481
|
+
|
|
411
482
|
// Enum: ConnectTarget
|
|
412
483
|
export let ConnectTarget_Tags = /*#__PURE__*/function (ConnectTarget_Tags) {
|
|
413
484
|
ConnectTarget_Tags["Peer"] = "Peer";
|
|
@@ -798,7 +869,8 @@ export const FfiError = (() => {
|
|
|
798
869
|
}
|
|
799
870
|
}
|
|
800
871
|
/**
|
|
801
|
-
* Endpoint configuration was
|
|
872
|
+
* Endpoint configuration was invalid; `capability` names the part of
|
|
873
|
+
* it that was.
|
|
802
874
|
*/
|
|
803
875
|
class InvalidConfig_ extends UniffiError {
|
|
804
876
|
/**
|
|
@@ -1006,7 +1078,8 @@ export const FfiError = (() => {
|
|
|
1006
1078
|
}
|
|
1007
1079
|
}
|
|
1008
1080
|
/**
|
|
1009
|
-
* A synchronous transport operation failed
|
|
1081
|
+
* A synchronous transport operation failed, or the platform refused a
|
|
1082
|
+
* socket the endpoint needed (a port in use, say).
|
|
1010
1083
|
*/
|
|
1011
1084
|
class Transport_ extends UniffiError {
|
|
1012
1085
|
/**
|
|
@@ -1121,6 +1194,7 @@ const FfiConverterTypeFfiError = (() => {
|
|
|
1121
1194
|
return new FfiError.Stopped();
|
|
1122
1195
|
case 3:
|
|
1123
1196
|
return new FfiError.InvalidConfig({
|
|
1197
|
+
capability: FfiConverterTypeConfigCapability.readFromCursor(c),
|
|
1124
1198
|
detail: FfiConverterString.readFromCursor(c)
|
|
1125
1199
|
});
|
|
1126
1200
|
case 4:
|
|
@@ -1179,6 +1253,7 @@ const FfiConverterTypeFfiError = (() => {
|
|
|
1179
1253
|
{
|
|
1180
1254
|
c.writeI32(3);
|
|
1181
1255
|
const inner = value.inner;
|
|
1256
|
+
FfiConverterTypeConfigCapability.writeIntoCursor(inner.capability, c);
|
|
1182
1257
|
FfiConverterString.writeIntoCursor(inner.detail, c);
|
|
1183
1258
|
return;
|
|
1184
1259
|
}
|
|
@@ -1267,6 +1342,7 @@ const FfiConverterTypeFfiError = (() => {
|
|
|
1267
1342
|
{
|
|
1268
1343
|
const inner = value.inner;
|
|
1269
1344
|
let size = 4;
|
|
1345
|
+
size += FfiConverterTypeConfigCapability.allocationSize(inner.capability);
|
|
1270
1346
|
size += FfiConverterString.allocationSize(inner.detail);
|
|
1271
1347
|
return size;
|
|
1272
1348
|
}
|
|
@@ -1342,6 +1418,88 @@ const FfiConverterTypeFfiError = (() => {
|
|
|
1342
1418
|
return new FFIConverter();
|
|
1343
1419
|
})();
|
|
1344
1420
|
|
|
1421
|
+
/**
|
|
1422
|
+
* Category of an mDNS failure.
|
|
1423
|
+
*/
|
|
1424
|
+
export let MdnsFailureKind = /*#__PURE__*/function (MdnsFailureKind) {
|
|
1425
|
+
/**
|
|
1426
|
+
* The platform cannot provide mDNS sockets.
|
|
1427
|
+
*/
|
|
1428
|
+
MdnsFailureKind[MdnsFailureKind["Unsupported"] = 0] = "Unsupported";
|
|
1429
|
+
/**
|
|
1430
|
+
* An interface has no usable address.
|
|
1431
|
+
*/
|
|
1432
|
+
MdnsFailureKind[MdnsFailureKind["NoInterfaceAddress"] = 1] = "NoInterfaceAddress";
|
|
1433
|
+
/**
|
|
1434
|
+
* A send named an interface that has gone away.
|
|
1435
|
+
*/
|
|
1436
|
+
MdnsFailureKind[MdnsFailureKind["UnknownInterface"] = 2] = "UnknownInterface";
|
|
1437
|
+
/**
|
|
1438
|
+
* A goodbye could not be sent before shutdown gave up on a full send
|
|
1439
|
+
* buffer.
|
|
1440
|
+
*/
|
|
1441
|
+
MdnsFailureKind[MdnsFailureKind["Congested"] = 3] = "Congested";
|
|
1442
|
+
/**
|
|
1443
|
+
* A datagram is larger than the carrier can ever send.
|
|
1444
|
+
*/
|
|
1445
|
+
MdnsFailureKind[MdnsFailureKind["Oversized"] = 4] = "Oversized";
|
|
1446
|
+
/**
|
|
1447
|
+
* The interface id space is exhausted.
|
|
1448
|
+
*/
|
|
1449
|
+
MdnsFailureKind[MdnsFailureKind["InterfaceIdsExhausted"] = 5] = "InterfaceIdsExhausted";
|
|
1450
|
+
/**
|
|
1451
|
+
* Platform I/O failed.
|
|
1452
|
+
*/
|
|
1453
|
+
MdnsFailureKind[MdnsFailureKind["Io"] = 6] = "Io";
|
|
1454
|
+
return MdnsFailureKind;
|
|
1455
|
+
}({});
|
|
1456
|
+
const FfiConverterTypeMdnsFailureKind = (() => {
|
|
1457
|
+
class FFIConverter extends AbstractFfiConverterByteArray {
|
|
1458
|
+
readFromCursor(c) {
|
|
1459
|
+
switch (c.readI32()) {
|
|
1460
|
+
case 1:
|
|
1461
|
+
return MdnsFailureKind.Unsupported;
|
|
1462
|
+
case 2:
|
|
1463
|
+
return MdnsFailureKind.NoInterfaceAddress;
|
|
1464
|
+
case 3:
|
|
1465
|
+
return MdnsFailureKind.UnknownInterface;
|
|
1466
|
+
case 4:
|
|
1467
|
+
return MdnsFailureKind.Congested;
|
|
1468
|
+
case 5:
|
|
1469
|
+
return MdnsFailureKind.Oversized;
|
|
1470
|
+
case 6:
|
|
1471
|
+
return MdnsFailureKind.InterfaceIdsExhausted;
|
|
1472
|
+
case 7:
|
|
1473
|
+
return MdnsFailureKind.Io;
|
|
1474
|
+
default:
|
|
1475
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
writeIntoCursor(value, c) {
|
|
1479
|
+
switch (value) {
|
|
1480
|
+
case MdnsFailureKind.Unsupported:
|
|
1481
|
+
return c.writeI32(1);
|
|
1482
|
+
case MdnsFailureKind.NoInterfaceAddress:
|
|
1483
|
+
return c.writeI32(2);
|
|
1484
|
+
case MdnsFailureKind.UnknownInterface:
|
|
1485
|
+
return c.writeI32(3);
|
|
1486
|
+
case MdnsFailureKind.Congested:
|
|
1487
|
+
return c.writeI32(4);
|
|
1488
|
+
case MdnsFailureKind.Oversized:
|
|
1489
|
+
return c.writeI32(5);
|
|
1490
|
+
case MdnsFailureKind.InterfaceIdsExhausted:
|
|
1491
|
+
return c.writeI32(6);
|
|
1492
|
+
case MdnsFailureKind.Io:
|
|
1493
|
+
return c.writeI32(7);
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
allocationSize(value) {
|
|
1497
|
+
return 4;
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
return new FFIConverter();
|
|
1501
|
+
})();
|
|
1502
|
+
|
|
1345
1503
|
/**
|
|
1346
1504
|
* Category of a failed NAT connection attempt.
|
|
1347
1505
|
*/
|
|
@@ -1646,6 +1804,8 @@ export let P2pEvent_Tags = /*#__PURE__*/function (P2pEvent_Tags) {
|
|
|
1646
1804
|
P2pEvent_Tags["PeerUpdated"] = "PeerUpdated";
|
|
1647
1805
|
P2pEvent_Tags["PeerExpired"] = "PeerExpired";
|
|
1648
1806
|
P2pEvent_Tags["DiscoveryDialFailed"] = "DiscoveryDialFailed";
|
|
1807
|
+
P2pEvent_Tags["MdnsFailed"] = "MdnsFailed";
|
|
1808
|
+
P2pEvent_Tags["MdnsRecovered"] = "MdnsRecovered";
|
|
1649
1809
|
P2pEvent_Tags["DiscoveryProtocolViolation"] = "DiscoveryProtocolViolation";
|
|
1650
1810
|
return P2pEvent_Tags;
|
|
1651
1811
|
}({});
|
|
@@ -2422,6 +2582,50 @@ export const P2pEvent = (() => {
|
|
|
2422
2582
|
return obj.tag === P2pEvent_Tags.DiscoveryDialFailed;
|
|
2423
2583
|
}
|
|
2424
2584
|
}
|
|
2585
|
+
/**
|
|
2586
|
+
* mDNS hit a hard failure. mDNS keeps running and retries; reported
|
|
2587
|
+
* once per change in failure state, and followed by `MdnsRecovered`
|
|
2588
|
+
* once a retry succeeds. A goodbye that failed during shutdown is
|
|
2589
|
+
* final.
|
|
2590
|
+
*/
|
|
2591
|
+
class MdnsFailed_ extends UniffiEnum {
|
|
2592
|
+
/**
|
|
2593
|
+
* @private
|
|
2594
|
+
* This field is private and should not be used, use `tag` instead.
|
|
2595
|
+
*/
|
|
2596
|
+
[uniffiTypeNameSymbol] = "P2pEvent";
|
|
2597
|
+
tag = P2pEvent_Tags.MdnsFailed;
|
|
2598
|
+
constructor(inner) {
|
|
2599
|
+
super("P2pEvent", "MdnsFailed");
|
|
2600
|
+
this.inner = Object.freeze(inner);
|
|
2601
|
+
}
|
|
2602
|
+
static new(inner) {
|
|
2603
|
+
return new MdnsFailed_(inner);
|
|
2604
|
+
}
|
|
2605
|
+
static instanceOf(obj) {
|
|
2606
|
+
return obj.tag === P2pEvent_Tags.MdnsFailed;
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
/**
|
|
2610
|
+
* mDNS recovered from its last `MdnsFailed`.
|
|
2611
|
+
*/
|
|
2612
|
+
class MdnsRecovered_ extends UniffiEnum {
|
|
2613
|
+
/**
|
|
2614
|
+
* @private
|
|
2615
|
+
* This field is private and should not be used, use `tag` instead.
|
|
2616
|
+
*/
|
|
2617
|
+
[uniffiTypeNameSymbol] = "P2pEvent";
|
|
2618
|
+
tag = P2pEvent_Tags.MdnsRecovered;
|
|
2619
|
+
constructor() {
|
|
2620
|
+
super("P2pEvent", "MdnsRecovered");
|
|
2621
|
+
}
|
|
2622
|
+
static new() {
|
|
2623
|
+
return new MdnsRecovered_();
|
|
2624
|
+
}
|
|
2625
|
+
static instanceOf(obj) {
|
|
2626
|
+
return obj.tag === P2pEvent_Tags.MdnsRecovered;
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2425
2629
|
/**
|
|
2426
2630
|
* A discovery source supplied an invalid claim.
|
|
2427
2631
|
*/
|
|
@@ -2484,6 +2688,8 @@ export const P2pEvent = (() => {
|
|
|
2484
2688
|
PeerUpdated: PeerUpdated_,
|
|
2485
2689
|
PeerExpired: PeerExpired_,
|
|
2486
2690
|
DiscoveryDialFailed: DiscoveryDialFailed_,
|
|
2691
|
+
MdnsFailed: MdnsFailed_,
|
|
2692
|
+
MdnsRecovered: MdnsRecovered_,
|
|
2487
2693
|
DiscoveryProtocolViolation: DiscoveryProtocolViolation_
|
|
2488
2694
|
});
|
|
2489
2695
|
})();
|
|
@@ -2709,6 +2915,13 @@ const FfiConverterTypeP2pEvent = (() => {
|
|
|
2709
2915
|
reason: FfiConverterString.readFromCursor(c)
|
|
2710
2916
|
});
|
|
2711
2917
|
case 37:
|
|
2918
|
+
return new P2pEvent.MdnsFailed({
|
|
2919
|
+
kind: FfiConverterTypeMdnsFailureKind.readFromCursor(c),
|
|
2920
|
+
detail: FfiConverterString.readFromCursor(c)
|
|
2921
|
+
});
|
|
2922
|
+
case 38:
|
|
2923
|
+
return new P2pEvent.MdnsRecovered();
|
|
2924
|
+
case 39:
|
|
2712
2925
|
return new P2pEvent.DiscoveryProtocolViolation({
|
|
2713
2926
|
peerId: FfiConverterOptionalString.readFromCursor(c),
|
|
2714
2927
|
source: FfiConverterTypeDiscoverySource.readFromCursor(c),
|
|
@@ -3041,10 +3254,23 @@ const FfiConverterTypeP2pEvent = (() => {
|
|
|
3041
3254
|
FfiConverterString.writeIntoCursor(inner.reason, c);
|
|
3042
3255
|
return;
|
|
3043
3256
|
}
|
|
3044
|
-
case P2pEvent_Tags.
|
|
3257
|
+
case P2pEvent_Tags.MdnsFailed:
|
|
3045
3258
|
{
|
|
3046
3259
|
c.writeI32(37);
|
|
3047
3260
|
const inner = value.inner;
|
|
3261
|
+
FfiConverterTypeMdnsFailureKind.writeIntoCursor(inner.kind, c);
|
|
3262
|
+
FfiConverterString.writeIntoCursor(inner.detail, c);
|
|
3263
|
+
return;
|
|
3264
|
+
}
|
|
3265
|
+
case P2pEvent_Tags.MdnsRecovered:
|
|
3266
|
+
{
|
|
3267
|
+
c.writeI32(38);
|
|
3268
|
+
return;
|
|
3269
|
+
}
|
|
3270
|
+
case P2pEvent_Tags.DiscoveryProtocolViolation:
|
|
3271
|
+
{
|
|
3272
|
+
c.writeI32(39);
|
|
3273
|
+
const inner = value.inner;
|
|
3048
3274
|
FfiConverterOptionalString.writeIntoCursor(inner.peerId, c);
|
|
3049
3275
|
FfiConverterTypeDiscoverySource.writeIntoCursor(inner.source, c);
|
|
3050
3276
|
FfiConverterString.writeIntoCursor(inner.reason, c);
|
|
@@ -3378,6 +3604,18 @@ const FfiConverterTypeP2pEvent = (() => {
|
|
|
3378
3604
|
size += FfiConverterString.allocationSize(inner.reason);
|
|
3379
3605
|
return size;
|
|
3380
3606
|
}
|
|
3607
|
+
case P2pEvent_Tags.MdnsFailed:
|
|
3608
|
+
{
|
|
3609
|
+
const inner = value.inner;
|
|
3610
|
+
let size = 4;
|
|
3611
|
+
size += FfiConverterTypeMdnsFailureKind.allocationSize(inner.kind);
|
|
3612
|
+
size += FfiConverterString.allocationSize(inner.detail);
|
|
3613
|
+
return size;
|
|
3614
|
+
}
|
|
3615
|
+
case P2pEvent_Tags.MdnsRecovered:
|
|
3616
|
+
{
|
|
3617
|
+
return 4;
|
|
3618
|
+
}
|
|
3381
3619
|
case P2pEvent_Tags.DiscoveryProtocolViolation:
|
|
3382
3620
|
{
|
|
3383
3621
|
const inner = value.inner;
|
|
@@ -3442,6 +3680,7 @@ function uniffiEnsureInitialized() {
|
|
|
3442
3680
|
export default Object.freeze({
|
|
3443
3681
|
initialize: uniffiEnsureInitialized,
|
|
3444
3682
|
converters: {
|
|
3683
|
+
FfiConverterTypeConfigCapability,
|
|
3445
3684
|
FfiConverterTypeConnectTarget,
|
|
3446
3685
|
FfiConverterTypeConnectionInfo,
|
|
3447
3686
|
FfiConverterTypeDiscoveryOptions,
|
|
@@ -3452,6 +3691,7 @@ export default Object.freeze({
|
|
|
3452
3691
|
FfiConverterTypeFfiError,
|
|
3453
3692
|
FfiConverterTypeIdentifyInfo,
|
|
3454
3693
|
FfiConverterTypeKnownPeerInfo,
|
|
3694
|
+
FfiConverterTypeMdnsFailureKind,
|
|
3455
3695
|
FfiConverterTypeMdnsOptions,
|
|
3456
3696
|
FfiConverterTypeNatErrorKind,
|
|
3457
3697
|
FfiConverterTypeOpenStreamResult,
|