@streamr/trackerless-network 0.0.1-tatum.7 → 100.0.0-pretestnet.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/dist/package.json +6 -6
- package/dist/src/NetworkNode.js +1 -1
- package/dist/src/NetworkNode.js.map +1 -1
- package/dist/src/NetworkStack.d.ts +4 -3
- package/dist/src/NetworkStack.js +12 -12
- package/dist/src/NetworkStack.js.map +1 -1
- package/dist/src/logic/EntryPointDiscovery.d.ts +2 -2
- package/dist/src/logic/EntryPointDiscovery.js +4 -4
- package/dist/src/logic/EntryPointDiscovery.js.map +1 -1
- package/dist/src/logic/{ILayer0.d.ts → Layer0Node.d.ts} +5 -1
- package/dist/src/logic/{ILayer1.js → Layer0Node.js} +1 -1
- package/dist/src/logic/Layer0Node.js.map +1 -0
- package/dist/src/logic/{ILayer1.d.ts → Layer1Node.d.ts} +5 -5
- package/dist/src/logic/{ILayer0.js → Layer1Node.js} +1 -1
- package/dist/src/logic/Layer1Node.js.map +1 -0
- package/dist/src/logic/RandomGraphNode.d.ts +3 -3
- package/dist/src/logic/RandomGraphNode.js +9 -9
- package/dist/src/logic/RandomGraphNode.js.map +1 -1
- package/dist/src/logic/StreamrNode.d.ts +6 -6
- package/dist/src/logic/StreamrNode.js +29 -28
- package/dist/src/logic/StreamrNode.js.map +1 -1
- package/dist/src/logic/createRandomGraphNode.js +1 -1
- package/dist/src/logic/createRandomGraphNode.js.map +1 -1
- package/dist/src/logic/proxy/ProxyClient.d.ts +1 -1
- package/dist/src/logic/proxy/ProxyClient.js +2 -2
- package/dist/src/logic/proxy/ProxyClient.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +10 -0
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +7 -0
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +54 -114
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +49 -47
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +6 -0
- package/dist/test/benchmark/first-message.js +9 -7
- package/dist/test/benchmark/first-message.js.map +1 -1
- package/dist/test/utils/utils.d.ts +3 -2
- package/dist/test/utils/utils.js +4 -4
- package/dist/test/utils/utils.js.map +1 -1
- package/package.json +6 -6
- package/src/NetworkNode.ts +1 -1
- package/src/NetworkStack.ts +14 -13
- package/src/logic/EntryPointDiscovery.ts +6 -6
- package/src/logic/{ILayer0.ts → Layer0Node.ts} +5 -1
- package/src/logic/{ILayer1.ts → Layer1Node.ts} +5 -5
- package/src/logic/RandomGraphNode.ts +12 -12
- package/src/logic/StreamrNode.ts +35 -34
- package/src/logic/createRandomGraphNode.ts +1 -1
- package/src/logic/proxy/ProxyClient.ts +3 -3
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +13 -0
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +6 -0
- package/src/proto/packages/dht/protos/DhtRpc.ts +87 -160
- package/test/benchmark/first-message.ts +11 -9
- package/test/end-to-end/proxy-and-full-node.test.ts +4 -4
- package/test/end-to-end/random-graph-with-real-connections.test.ts +20 -15
- package/test/integration/Inspect.test.ts +1 -1
- package/test/integration/Propagation.test.ts +13 -12
- package/test/integration/RandomGraphNode-Layer1Node-Latencies.test.ts +13 -12
- package/test/integration/RandomGraphNode-Layer1Node.test.ts +13 -12
- package/test/integration/StreamrNode.test.ts +11 -10
- package/test/integration/joining-streams-on-offline-peers.test.ts +2 -2
- package/test/integration/stream-without-default-entrypoints.test.ts +1 -1
- package/test/unit/EntrypointDiscovery.test.ts +7 -7
- package/test/unit/RandomGraphNode.test.ts +10 -9
- package/test/unit/StreamrNode.test.ts +2 -2
- package/test/utils/mock/{MockLayer0.ts → MockLayer0Node.ts} +21 -5
- package/test/utils/mock/{MockLayer1.ts → MockLayer1Node.ts} +2 -2
- package/test/utils/utils.ts +6 -5
- package/dist/src/logic/ILayer0.js.map +0 -1
- package/dist/src/logic/ILayer1.js.map +0 -1
|
@@ -39,6 +39,28 @@ export interface StoreDataResponse {
|
|
|
39
39
|
*/
|
|
40
40
|
error: string;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* @generated from protobuf message dht.ExternalStoreDataRequest
|
|
44
|
+
*/
|
|
45
|
+
export interface ExternalStoreDataRequest {
|
|
46
|
+
/**
|
|
47
|
+
* @generated from protobuf field: bytes key = 1;
|
|
48
|
+
*/
|
|
49
|
+
key: Uint8Array;
|
|
50
|
+
/**
|
|
51
|
+
* @generated from protobuf field: google.protobuf.Any data = 2;
|
|
52
|
+
*/
|
|
53
|
+
data?: Any;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @generated from protobuf message dht.ExternalStoreDataResponse
|
|
57
|
+
*/
|
|
58
|
+
export interface ExternalStoreDataResponse {
|
|
59
|
+
/**
|
|
60
|
+
* @generated from protobuf field: repeated dht.PeerDescriptor storers = 1;
|
|
61
|
+
*/
|
|
62
|
+
storers: PeerDescriptor[];
|
|
63
|
+
}
|
|
42
64
|
/**
|
|
43
65
|
* @generated from protobuf message dht.MigrateDataRequest
|
|
44
66
|
*/
|
|
@@ -287,19 +309,11 @@ export interface RouteMessageWrapper {
|
|
|
287
309
|
*/
|
|
288
310
|
export interface RouteMessageAck {
|
|
289
311
|
/**
|
|
290
|
-
* @generated from protobuf field:
|
|
291
|
-
*/
|
|
292
|
-
sourcePeer?: PeerDescriptor;
|
|
293
|
-
/**
|
|
294
|
-
* @generated from protobuf field: string requestId = 2;
|
|
312
|
+
* @generated from protobuf field: string requestId = 1;
|
|
295
313
|
*/
|
|
296
314
|
requestId: string;
|
|
297
315
|
/**
|
|
298
|
-
* @generated from protobuf field:
|
|
299
|
-
*/
|
|
300
|
-
destinationPeer?: PeerDescriptor;
|
|
301
|
-
/**
|
|
302
|
-
* @generated from protobuf field: string error = 4;
|
|
316
|
+
* @generated from protobuf field: string error = 2;
|
|
303
317
|
*/
|
|
304
318
|
error: string;
|
|
305
319
|
}
|
|
@@ -352,11 +366,7 @@ export interface HandshakeRequest {
|
|
|
352
366
|
*/
|
|
353
367
|
sourceId: Uint8Array;
|
|
354
368
|
/**
|
|
355
|
-
* @generated from protobuf field:
|
|
356
|
-
*/
|
|
357
|
-
protocolVersion: string;
|
|
358
|
-
/**
|
|
359
|
-
* @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 3;
|
|
369
|
+
* @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 2;
|
|
360
370
|
*/
|
|
361
371
|
peerDescriptor?: PeerDescriptor;
|
|
362
372
|
}
|
|
@@ -369,15 +379,11 @@ export interface HandshakeResponse {
|
|
|
369
379
|
*/
|
|
370
380
|
sourceId: Uint8Array;
|
|
371
381
|
/**
|
|
372
|
-
* @generated from protobuf field:
|
|
373
|
-
*/
|
|
374
|
-
protocolVersion: string;
|
|
375
|
-
/**
|
|
376
|
-
* @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 3;
|
|
382
|
+
* @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 2;
|
|
377
383
|
*/
|
|
378
384
|
peerDescriptor?: PeerDescriptor;
|
|
379
385
|
/**
|
|
380
|
-
* @generated from protobuf field: optional string responseError =
|
|
386
|
+
* @generated from protobuf field: optional string responseError = 3;
|
|
381
387
|
*/
|
|
382
388
|
responseError?: string;
|
|
383
389
|
}
|
|
@@ -457,19 +463,11 @@ export interface Message {
|
|
|
457
463
|
*/
|
|
458
464
|
export interface WebSocketConnectionRequest {
|
|
459
465
|
/**
|
|
460
|
-
* @generated from protobuf field:
|
|
461
|
-
*/
|
|
462
|
-
requester?: PeerDescriptor;
|
|
463
|
-
/**
|
|
464
|
-
* @generated from protobuf field: dht.PeerDescriptor target = 2;
|
|
465
|
-
*/
|
|
466
|
-
target?: PeerDescriptor;
|
|
467
|
-
/**
|
|
468
|
-
* @generated from protobuf field: string ip = 3;
|
|
466
|
+
* @generated from protobuf field: string ip = 1;
|
|
469
467
|
*/
|
|
470
468
|
ip: string;
|
|
471
469
|
/**
|
|
472
|
-
* @generated from protobuf field: uint32 port =
|
|
470
|
+
* @generated from protobuf field: uint32 port = 2;
|
|
473
471
|
*/
|
|
474
472
|
port: number;
|
|
475
473
|
}
|
|
@@ -478,19 +476,11 @@ export interface WebSocketConnectionRequest {
|
|
|
478
476
|
*/
|
|
479
477
|
export interface WebSocketConnectionResponse {
|
|
480
478
|
/**
|
|
481
|
-
* @generated from protobuf field:
|
|
482
|
-
*/
|
|
483
|
-
requester?: PeerDescriptor;
|
|
484
|
-
/**
|
|
485
|
-
* @generated from protobuf field: dht.PeerDescriptor target = 2;
|
|
486
|
-
*/
|
|
487
|
-
target?: PeerDescriptor;
|
|
488
|
-
/**
|
|
489
|
-
* @generated from protobuf field: bool accepted = 3;
|
|
479
|
+
* @generated from protobuf field: bool accepted = 1;
|
|
490
480
|
*/
|
|
491
481
|
accepted: boolean;
|
|
492
482
|
/**
|
|
493
|
-
* @generated from protobuf field: optional string reason =
|
|
483
|
+
* @generated from protobuf field: optional string reason = 2;
|
|
494
484
|
*/
|
|
495
485
|
reason?: string;
|
|
496
486
|
}
|
|
@@ -501,15 +491,7 @@ export interface WebSocketConnectionResponse {
|
|
|
501
491
|
*/
|
|
502
492
|
export interface WebRtcConnectionRequest {
|
|
503
493
|
/**
|
|
504
|
-
* @generated from protobuf field:
|
|
505
|
-
*/
|
|
506
|
-
requester?: PeerDescriptor;
|
|
507
|
-
/**
|
|
508
|
-
* @generated from protobuf field: dht.PeerDescriptor target = 2;
|
|
509
|
-
*/
|
|
510
|
-
target?: PeerDescriptor;
|
|
511
|
-
/**
|
|
512
|
-
* @generated from protobuf field: string connectionId = 3;
|
|
494
|
+
* @generated from protobuf field: string connectionId = 1;
|
|
513
495
|
*/
|
|
514
496
|
connectionId: string;
|
|
515
497
|
}
|
|
@@ -518,19 +500,11 @@ export interface WebRtcConnectionRequest {
|
|
|
518
500
|
*/
|
|
519
501
|
export interface RtcOffer {
|
|
520
502
|
/**
|
|
521
|
-
* @generated from protobuf field:
|
|
522
|
-
*/
|
|
523
|
-
requester?: PeerDescriptor;
|
|
524
|
-
/**
|
|
525
|
-
* @generated from protobuf field: dht.PeerDescriptor target = 2;
|
|
526
|
-
*/
|
|
527
|
-
target?: PeerDescriptor;
|
|
528
|
-
/**
|
|
529
|
-
* @generated from protobuf field: string description = 3;
|
|
503
|
+
* @generated from protobuf field: string description = 1;
|
|
530
504
|
*/
|
|
531
505
|
description: string;
|
|
532
506
|
/**
|
|
533
|
-
* @generated from protobuf field: string connectionId =
|
|
507
|
+
* @generated from protobuf field: string connectionId = 2;
|
|
534
508
|
*/
|
|
535
509
|
connectionId: string;
|
|
536
510
|
}
|
|
@@ -539,19 +513,11 @@ export interface RtcOffer {
|
|
|
539
513
|
*/
|
|
540
514
|
export interface RtcAnswer {
|
|
541
515
|
/**
|
|
542
|
-
* @generated from protobuf field:
|
|
543
|
-
*/
|
|
544
|
-
requester?: PeerDescriptor;
|
|
545
|
-
/**
|
|
546
|
-
* @generated from protobuf field: dht.PeerDescriptor target = 2;
|
|
547
|
-
*/
|
|
548
|
-
target?: PeerDescriptor;
|
|
549
|
-
/**
|
|
550
|
-
* @generated from protobuf field: string description = 3;
|
|
516
|
+
* @generated from protobuf field: string description = 1;
|
|
551
517
|
*/
|
|
552
518
|
description: string;
|
|
553
519
|
/**
|
|
554
|
-
* @generated from protobuf field: string connectionId =
|
|
520
|
+
* @generated from protobuf field: string connectionId = 2;
|
|
555
521
|
*/
|
|
556
522
|
connectionId: string;
|
|
557
523
|
}
|
|
@@ -571,29 +537,13 @@ export interface IceCandidate {
|
|
|
571
537
|
* @generated from protobuf field: string connectionId = 3;
|
|
572
538
|
*/
|
|
573
539
|
connectionId: string;
|
|
574
|
-
/**
|
|
575
|
-
* @generated from protobuf field: dht.PeerDescriptor requester = 4;
|
|
576
|
-
*/
|
|
577
|
-
requester?: PeerDescriptor;
|
|
578
|
-
/**
|
|
579
|
-
* @generated from protobuf field: dht.PeerDescriptor target = 5;
|
|
580
|
-
*/
|
|
581
|
-
target?: PeerDescriptor;
|
|
582
540
|
}
|
|
583
541
|
/**
|
|
584
542
|
* @generated from protobuf message dht.LockRequest
|
|
585
543
|
*/
|
|
586
544
|
export interface LockRequest {
|
|
587
545
|
/**
|
|
588
|
-
* @generated from protobuf field: string
|
|
589
|
-
*/
|
|
590
|
-
protocolVersion: string;
|
|
591
|
-
/**
|
|
592
|
-
* @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 2;
|
|
593
|
-
*/
|
|
594
|
-
peerDescriptor?: PeerDescriptor;
|
|
595
|
-
/**
|
|
596
|
-
* @generated from protobuf field: string serviceId = 3;
|
|
546
|
+
* @generated from protobuf field: string serviceId = 1;
|
|
597
547
|
*/
|
|
598
548
|
serviceId: string;
|
|
599
549
|
}
|
|
@@ -602,15 +552,7 @@ export interface LockRequest {
|
|
|
602
552
|
*/
|
|
603
553
|
export interface UnlockRequest {
|
|
604
554
|
/**
|
|
605
|
-
* @generated from protobuf field: string
|
|
606
|
-
*/
|
|
607
|
-
protocolVersion: string;
|
|
608
|
-
/**
|
|
609
|
-
* @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 2;
|
|
610
|
-
*/
|
|
611
|
-
peerDescriptor?: PeerDescriptor;
|
|
612
|
-
/**
|
|
613
|
-
* @generated from protobuf field: string serviceId = 3;
|
|
555
|
+
* @generated from protobuf field: string serviceId = 1;
|
|
614
556
|
*/
|
|
615
557
|
serviceId: string;
|
|
616
558
|
}
|
|
@@ -632,26 +574,14 @@ export interface LockResponse {
|
|
|
632
574
|
*/
|
|
633
575
|
export interface DisconnectNotice {
|
|
634
576
|
/**
|
|
635
|
-
* @generated from protobuf field:
|
|
636
|
-
*/
|
|
637
|
-
protocolVersion: string;
|
|
638
|
-
/**
|
|
639
|
-
* @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 2;
|
|
640
|
-
*/
|
|
641
|
-
peerDescriptor?: PeerDescriptor;
|
|
642
|
-
/**
|
|
643
|
-
* @generated from protobuf field: dht.DisconnectMode disconnecMode = 3;
|
|
577
|
+
* @generated from protobuf field: dht.DisconnectMode disconnectMode = 1;
|
|
644
578
|
*/
|
|
645
|
-
|
|
579
|
+
disconnectMode: DisconnectMode;
|
|
646
580
|
}
|
|
647
581
|
/**
|
|
648
582
|
* @generated from protobuf message dht.DisconnectNoticeResponse
|
|
649
583
|
*/
|
|
650
584
|
export interface DisconnectNoticeResponse {
|
|
651
|
-
/**
|
|
652
|
-
* @generated from protobuf field: string protocolVersion = 1;
|
|
653
|
-
*/
|
|
654
|
-
protocolVersion: string;
|
|
655
585
|
}
|
|
656
586
|
/**
|
|
657
587
|
* @generated from protobuf message dht.FindDataRequest
|
|
@@ -661,10 +591,6 @@ export interface FindDataRequest {
|
|
|
661
591
|
* @generated from protobuf field: bytes kademliaId = 1;
|
|
662
592
|
*/
|
|
663
593
|
kademliaId: Uint8Array;
|
|
664
|
-
/**
|
|
665
|
-
* @generated from protobuf field: dht.PeerDescriptor requestor = 2;
|
|
666
|
-
*/
|
|
667
|
-
requestor?: PeerDescriptor;
|
|
668
594
|
}
|
|
669
595
|
/**
|
|
670
596
|
* @generated from protobuf message dht.FindDataResponse
|
|
@@ -802,6 +728,31 @@ class StoreDataResponse$Type extends MessageType$<StoreDataResponse> {
|
|
|
802
728
|
*/
|
|
803
729
|
export const StoreDataResponse = new StoreDataResponse$Type();
|
|
804
730
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
731
|
+
class ExternalStoreDataRequest$Type extends MessageType$<ExternalStoreDataRequest> {
|
|
732
|
+
constructor() {
|
|
733
|
+
super("dht.ExternalStoreDataRequest", [
|
|
734
|
+
{ no: 1, name: "key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
|
735
|
+
{ no: 2, name: "data", kind: "message", T: () => Any }
|
|
736
|
+
]);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* @generated MessageType for protobuf message dht.ExternalStoreDataRequest
|
|
741
|
+
*/
|
|
742
|
+
export const ExternalStoreDataRequest = new ExternalStoreDataRequest$Type();
|
|
743
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
744
|
+
class ExternalStoreDataResponse$Type extends MessageType$<ExternalStoreDataResponse> {
|
|
745
|
+
constructor() {
|
|
746
|
+
super("dht.ExternalStoreDataResponse", [
|
|
747
|
+
{ no: 1, name: "storers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }
|
|
748
|
+
]);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* @generated MessageType for protobuf message dht.ExternalStoreDataResponse
|
|
753
|
+
*/
|
|
754
|
+
export const ExternalStoreDataResponse = new ExternalStoreDataResponse$Type();
|
|
755
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
805
756
|
class MigrateDataRequest$Type extends MessageType$<MigrateDataRequest> {
|
|
806
757
|
constructor() {
|
|
807
758
|
super("dht.MigrateDataRequest", [
|
|
@@ -1012,10 +963,8 @@ export const RouteMessageWrapper = new RouteMessageWrapper$Type();
|
|
|
1012
963
|
class RouteMessageAck$Type extends MessageType$<RouteMessageAck> {
|
|
1013
964
|
constructor() {
|
|
1014
965
|
super("dht.RouteMessageAck", [
|
|
1015
|
-
{ no: 1, name: "
|
|
1016
|
-
{ no: 2, name: "
|
|
1017
|
-
{ no: 3, name: "destinationPeer", kind: "message", T: () => PeerDescriptor },
|
|
1018
|
-
{ no: 4, name: "error", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
966
|
+
{ no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
967
|
+
{ no: 2, name: "error", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1019
968
|
]);
|
|
1020
969
|
}
|
|
1021
970
|
}
|
|
@@ -1057,8 +1006,7 @@ class HandshakeRequest$Type extends MessageType$<HandshakeRequest> {
|
|
|
1057
1006
|
constructor() {
|
|
1058
1007
|
super("dht.HandshakeRequest", [
|
|
1059
1008
|
{ no: 1, name: "sourceId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
|
1060
|
-
{ no: 2, name: "
|
|
1061
|
-
{ no: 3, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor }
|
|
1009
|
+
{ no: 2, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor }
|
|
1062
1010
|
]);
|
|
1063
1011
|
}
|
|
1064
1012
|
}
|
|
@@ -1071,9 +1019,8 @@ class HandshakeResponse$Type extends MessageType$<HandshakeResponse> {
|
|
|
1071
1019
|
constructor() {
|
|
1072
1020
|
super("dht.HandshakeResponse", [
|
|
1073
1021
|
{ no: 1, name: "sourceId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
|
1074
|
-
{ no: 2, name: "
|
|
1075
|
-
{ no: 3, name: "
|
|
1076
|
-
{ no: 4, name: "responseError", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }
|
|
1022
|
+
{ no: 2, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor },
|
|
1023
|
+
{ no: 3, name: "responseError", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }
|
|
1077
1024
|
]);
|
|
1078
1025
|
}
|
|
1079
1026
|
}
|
|
@@ -1107,10 +1054,8 @@ export const Message = new Message$Type();
|
|
|
1107
1054
|
class WebSocketConnectionRequest$Type extends MessageType$<WebSocketConnectionRequest> {
|
|
1108
1055
|
constructor() {
|
|
1109
1056
|
super("dht.WebSocketConnectionRequest", [
|
|
1110
|
-
{ no: 1, name: "
|
|
1111
|
-
{ no: 2, name: "
|
|
1112
|
-
{ no: 3, name: "ip", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
1113
|
-
{ no: 4, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }
|
|
1057
|
+
{ no: 1, name: "ip", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
1058
|
+
{ no: 2, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }
|
|
1114
1059
|
]);
|
|
1115
1060
|
}
|
|
1116
1061
|
}
|
|
@@ -1122,10 +1067,8 @@ export const WebSocketConnectionRequest = new WebSocketConnectionRequest$Type();
|
|
|
1122
1067
|
class WebSocketConnectionResponse$Type extends MessageType$<WebSocketConnectionResponse> {
|
|
1123
1068
|
constructor() {
|
|
1124
1069
|
super("dht.WebSocketConnectionResponse", [
|
|
1125
|
-
{ no: 1, name: "
|
|
1126
|
-
{ no: 2, name: "
|
|
1127
|
-
{ no: 3, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
|
|
1128
|
-
{ no: 4, name: "reason", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }
|
|
1070
|
+
{ no: 1, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
|
|
1071
|
+
{ no: 2, name: "reason", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }
|
|
1129
1072
|
]);
|
|
1130
1073
|
}
|
|
1131
1074
|
}
|
|
@@ -1137,9 +1080,7 @@ export const WebSocketConnectionResponse = new WebSocketConnectionResponse$Type(
|
|
|
1137
1080
|
class WebRtcConnectionRequest$Type extends MessageType$<WebRtcConnectionRequest> {
|
|
1138
1081
|
constructor() {
|
|
1139
1082
|
super("dht.WebRtcConnectionRequest", [
|
|
1140
|
-
{ no: 1, name: "
|
|
1141
|
-
{ no: 2, name: "target", kind: "message", T: () => PeerDescriptor },
|
|
1142
|
-
{ no: 3, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1083
|
+
{ no: 1, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1143
1084
|
]);
|
|
1144
1085
|
}
|
|
1145
1086
|
}
|
|
@@ -1151,10 +1092,8 @@ export const WebRtcConnectionRequest = new WebRtcConnectionRequest$Type();
|
|
|
1151
1092
|
class RtcOffer$Type extends MessageType$<RtcOffer> {
|
|
1152
1093
|
constructor() {
|
|
1153
1094
|
super("dht.RtcOffer", [
|
|
1154
|
-
{ no: 1, name: "
|
|
1155
|
-
{ no: 2, name: "
|
|
1156
|
-
{ no: 3, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
1157
|
-
{ no: 4, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1095
|
+
{ no: 1, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
1096
|
+
{ no: 2, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1158
1097
|
]);
|
|
1159
1098
|
}
|
|
1160
1099
|
}
|
|
@@ -1166,10 +1105,8 @@ export const RtcOffer = new RtcOffer$Type();
|
|
|
1166
1105
|
class RtcAnswer$Type extends MessageType$<RtcAnswer> {
|
|
1167
1106
|
constructor() {
|
|
1168
1107
|
super("dht.RtcAnswer", [
|
|
1169
|
-
{ no: 1, name: "
|
|
1170
|
-
{ no: 2, name: "
|
|
1171
|
-
{ no: 3, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
1172
|
-
{ no: 4, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1108
|
+
{ no: 1, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
1109
|
+
{ no: 2, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1173
1110
|
]);
|
|
1174
1111
|
}
|
|
1175
1112
|
}
|
|
@@ -1183,9 +1120,7 @@ class IceCandidate$Type extends MessageType$<IceCandidate> {
|
|
|
1183
1120
|
super("dht.IceCandidate", [
|
|
1184
1121
|
{ no: 1, name: "candidate", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
1185
1122
|
{ no: 2, name: "mid", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
1186
|
-
{ no: 3, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1187
|
-
{ no: 4, name: "requester", kind: "message", T: () => PeerDescriptor },
|
|
1188
|
-
{ no: 5, name: "target", kind: "message", T: () => PeerDescriptor }
|
|
1123
|
+
{ no: 3, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1189
1124
|
]);
|
|
1190
1125
|
}
|
|
1191
1126
|
}
|
|
@@ -1197,9 +1132,7 @@ export const IceCandidate = new IceCandidate$Type();
|
|
|
1197
1132
|
class LockRequest$Type extends MessageType$<LockRequest> {
|
|
1198
1133
|
constructor() {
|
|
1199
1134
|
super("dht.LockRequest", [
|
|
1200
|
-
{ no: 1, name: "
|
|
1201
|
-
{ no: 2, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor },
|
|
1202
|
-
{ no: 3, name: "serviceId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1135
|
+
{ no: 1, name: "serviceId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1203
1136
|
]);
|
|
1204
1137
|
}
|
|
1205
1138
|
}
|
|
@@ -1211,9 +1144,7 @@ export const LockRequest = new LockRequest$Type();
|
|
|
1211
1144
|
class UnlockRequest$Type extends MessageType$<UnlockRequest> {
|
|
1212
1145
|
constructor() {
|
|
1213
1146
|
super("dht.UnlockRequest", [
|
|
1214
|
-
{ no: 1, name: "
|
|
1215
|
-
{ no: 2, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor },
|
|
1216
|
-
{ no: 3, name: "serviceId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1147
|
+
{ no: 1, name: "serviceId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1217
1148
|
]);
|
|
1218
1149
|
}
|
|
1219
1150
|
}
|
|
@@ -1238,9 +1169,7 @@ export const LockResponse = new LockResponse$Type();
|
|
|
1238
1169
|
class DisconnectNotice$Type extends MessageType$<DisconnectNotice> {
|
|
1239
1170
|
constructor() {
|
|
1240
1171
|
super("dht.DisconnectNotice", [
|
|
1241
|
-
{ no: 1, name: "
|
|
1242
|
-
{ no: 2, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor },
|
|
1243
|
-
{ no: 3, name: "disconnecMode", kind: "enum", T: () => ["dht.DisconnectMode", DisconnectMode] }
|
|
1172
|
+
{ no: 1, name: "disconnectMode", kind: "enum", T: () => ["dht.DisconnectMode", DisconnectMode] }
|
|
1244
1173
|
]);
|
|
1245
1174
|
}
|
|
1246
1175
|
}
|
|
@@ -1251,9 +1180,7 @@ export const DisconnectNotice = new DisconnectNotice$Type();
|
|
|
1251
1180
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
1252
1181
|
class DisconnectNoticeResponse$Type extends MessageType$<DisconnectNoticeResponse> {
|
|
1253
1182
|
constructor() {
|
|
1254
|
-
super("dht.DisconnectNoticeResponse", [
|
|
1255
|
-
{ no: 1, name: "protocolVersion", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1256
|
-
]);
|
|
1183
|
+
super("dht.DisconnectNoticeResponse", []);
|
|
1257
1184
|
}
|
|
1258
1185
|
}
|
|
1259
1186
|
/**
|
|
@@ -1264,8 +1191,7 @@ export const DisconnectNoticeResponse = new DisconnectNoticeResponse$Type();
|
|
|
1264
1191
|
class FindDataRequest$Type extends MessageType$<FindDataRequest> {
|
|
1265
1192
|
constructor() {
|
|
1266
1193
|
super("dht.FindDataRequest", [
|
|
1267
|
-
{ no: 1, name: "kademliaId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
|
1268
|
-
{ no: 2, name: "requestor", kind: "message", T: () => PeerDescriptor }
|
|
1194
|
+
{ no: 1, name: "kademliaId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
|
1269
1195
|
]);
|
|
1270
1196
|
}
|
|
1271
1197
|
}
|
|
@@ -1343,5 +1269,6 @@ export const ConnectionLocker = new ServiceType("dht.ConnectionLocker", [
|
|
|
1343
1269
|
* @generated ServiceType for protobuf service dht.ExternalApiService
|
|
1344
1270
|
*/
|
|
1345
1271
|
export const ExternalApiService = new ServiceType("dht.ExternalApiService", [
|
|
1346
|
-
{ name: "findData", options: {}, I: FindDataRequest, O: FindDataResponse }
|
|
1272
|
+
{ name: "findData", options: {}, I: FindDataRequest, O: FindDataResponse },
|
|
1273
|
+
{ name: "externalStoreData", options: {}, I: ExternalStoreDataRequest, O: ExternalStoreDataResponse }
|
|
1347
1274
|
]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
|
|
3
|
-
import { LatencyType, Simulator, getRandomRegion } from '@streamr/dht'
|
|
3
|
+
import { DhtNode, LatencyType, Simulator, getRandomRegion } from '@streamr/dht'
|
|
4
4
|
import { MessageID, StreamMessage, StreamMessageType, StreamPartID, StreamPartIDUtils, toStreamID, toStreamPartID } from '@streamr/protocol'
|
|
5
5
|
import { hexToBinary, utf8ToBinary, waitForEvent3 } from '@streamr/utils'
|
|
6
6
|
import fs from 'fs'
|
|
@@ -9,7 +9,7 @@ import { NetworkNode } from '../../src/NetworkNode'
|
|
|
9
9
|
import { getNodeIdFromPeerDescriptor } from '../../src/identifiers'
|
|
10
10
|
import { streamPartIdToDataKey } from '../../src/logic/EntryPointDiscovery'
|
|
11
11
|
import { createMockPeerDescriptor, createNetworkNodeWithSimulator } from '../utils/utils'
|
|
12
|
-
import {
|
|
12
|
+
import { Layer1Node } from '../../src/logic/Layer1Node'
|
|
13
13
|
import { RandomGraphNode } from '../../src/logic/RandomGraphNode'
|
|
14
14
|
|
|
15
15
|
const numNodes = 10000
|
|
@@ -90,7 +90,7 @@ const measureJoiningTime = async () => {
|
|
|
90
90
|
}, 1000)
|
|
91
91
|
// get random node from network to use as entrypoint
|
|
92
92
|
const randomNode = nodes[Math.floor(Math.random() * nodes.length)]
|
|
93
|
-
const streamSubscriber = createNetworkNodeWithSimulator(peerDescriptor, simulator, [randomNode.stack.
|
|
93
|
+
const streamSubscriber = createNetworkNodeWithSimulator(peerDescriptor, simulator, [randomNode.stack.getLayer0Node().getPeerDescriptor()])
|
|
94
94
|
currentNode = streamSubscriber
|
|
95
95
|
const start = performance.now()
|
|
96
96
|
await streamSubscriber.start()
|
|
@@ -132,13 +132,15 @@ run().then(() => {
|
|
|
132
132
|
console.log('done')
|
|
133
133
|
}).catch((err) => {
|
|
134
134
|
console.error(err)
|
|
135
|
-
const
|
|
136
|
-
const
|
|
135
|
+
const streamrNode = currentNode.stack.getStreamrNode()
|
|
136
|
+
const streamParts = streamrNode.getStreamParts()
|
|
137
|
+
const foundData = nodes[0].stack.getLayer0Node().getDataFromDht(streamPartIdToDataKey(streamParts[0]))
|
|
137
138
|
console.log(foundData)
|
|
138
|
-
|
|
139
|
-
console.log(
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
const layer0Node = currentNode.stack.getLayer0Node() as DhtNode
|
|
140
|
+
console.log(layer0Node.getKBucketPeers().length)
|
|
141
|
+
console.log(layer0Node.getNumberOfConnections())
|
|
142
|
+
const streamPartDelivery = streamrNode.getStreamPartDelivery(streamParts[0])! as { layer1Node: Layer1Node, node: RandomGraphNode }
|
|
143
|
+
console.log(streamPartDelivery.layer1Node.getKBucketPeers())
|
|
142
144
|
console.log(streamPartDelivery.node.getTargetNeighborIds())
|
|
143
145
|
console.log(nodes[nodes.length - 1])
|
|
144
146
|
if (publishInterval) {
|
|
@@ -73,14 +73,14 @@ describe('proxy and full node', () => {
|
|
|
73
73
|
|
|
74
74
|
it('proxied node can act as full node on another stream part', async () => {
|
|
75
75
|
await proxiedNode.setProxies(proxiedStreamPart, [proxyNodeDescriptor], ProxyDirection.PUBLISH, PROXIED_NODE_USER_ID, 1)
|
|
76
|
-
expect(proxiedNode.stack.
|
|
76
|
+
expect(proxiedNode.stack.getLayer0Node().hasJoined()).toBe(false)
|
|
77
77
|
|
|
78
78
|
await Promise.all([
|
|
79
79
|
waitForEvent3(proxyNode.stack.getStreamrNode()! as any, 'newMessage'),
|
|
80
80
|
proxiedNode.broadcast(createMessage(regularStreamPart1))
|
|
81
81
|
])
|
|
82
82
|
|
|
83
|
-
expect(proxiedNode.stack.
|
|
83
|
+
expect(proxiedNode.stack.getLayer0Node().hasJoined()).toBe(true)
|
|
84
84
|
|
|
85
85
|
await Promise.all([
|
|
86
86
|
waitForEvent3(proxyNode.stack.getStreamrNode()! as any, 'newMessage'),
|
|
@@ -93,7 +93,7 @@ describe('proxy and full node', () => {
|
|
|
93
93
|
|
|
94
94
|
it('proxied node can act as full node on multiple stream parts', async () => {
|
|
95
95
|
await proxiedNode.setProxies(proxiedStreamPart, [proxyNodeDescriptor], ProxyDirection.PUBLISH, PROXIED_NODE_USER_ID, 1)
|
|
96
|
-
expect(proxiedNode.stack.
|
|
96
|
+
expect(proxiedNode.stack.getLayer0Node().hasJoined()).toBe(false)
|
|
97
97
|
|
|
98
98
|
await Promise.all([
|
|
99
99
|
waitForEvent3(proxyNode.stack.getStreamrNode()! as any, 'newMessage', 5000,
|
|
@@ -110,7 +110,7 @@ describe('proxy and full node', () => {
|
|
|
110
110
|
proxiedNode.broadcast(createMessage(regularStreamPart4))
|
|
111
111
|
])
|
|
112
112
|
|
|
113
|
-
expect(proxiedNode.stack.
|
|
113
|
+
expect(proxiedNode.stack.getLayer0Node().hasJoined()).toBe(true)
|
|
114
114
|
|
|
115
115
|
await Promise.all([
|
|
116
116
|
waitForEvent3(proxyNode.stack.getStreamrNode()! as any, 'newMessage'),
|
|
@@ -5,6 +5,8 @@ import { createStreamMessage } from '../utils/utils'
|
|
|
5
5
|
import { createRandomGraphNode } from '../../src/logic/createRandomGraphNode'
|
|
6
6
|
import { StreamPartIDUtils } from '@streamr/protocol'
|
|
7
7
|
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
8
|
+
import { Layer0Node } from '../../src/logic/Layer0Node'
|
|
9
|
+
import { Layer1Node } from '../../src/logic/Layer1Node'
|
|
8
10
|
|
|
9
11
|
describe('random graph with real connections', () => {
|
|
10
12
|
|
|
@@ -15,11 +17,14 @@ describe('random graph with real connections', () => {
|
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
const streamPartId = StreamPartIDUtils.parse('random-graph#0')
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let
|
|
22
|
-
let
|
|
20
|
+
// Currently the nodes here are practically layer0 nodes acting as layer1 nodes, for the purpose of this test
|
|
21
|
+
// they are layer1 nodes as the DHT is per stream
|
|
22
|
+
// TODO refactor the test to use normal layering style (i.e. have separate objects for layer0 and layer1 nodes)
|
|
23
|
+
let epDhtNode: Layer0Node & Layer1Node
|
|
24
|
+
let dhtNode1: Layer0Node & Layer1Node
|
|
25
|
+
let dhtNode2: Layer0Node & Layer1Node
|
|
26
|
+
let dhtNode3: Layer0Node & Layer1Node
|
|
27
|
+
let dhtNode4: Layer0Node & Layer1Node
|
|
23
28
|
let randomGraphNode1: RandomGraphNode
|
|
24
29
|
let randomGraphNode2: RandomGraphNode
|
|
25
30
|
let randomGraphNode3: RandomGraphNode
|
|
@@ -42,37 +47,37 @@ describe('random graph with real connections', () => {
|
|
|
42
47
|
randomGraphNode1 = createRandomGraphNode(
|
|
43
48
|
{
|
|
44
49
|
streamPartId,
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
layer1Node: epDhtNode,
|
|
51
|
+
transport: epDhtNode.getTransport(),
|
|
47
52
|
connectionLocker: epDhtNode.getTransport() as ConnectionManager,
|
|
48
53
|
ownPeerDescriptor: epPeerDescriptor
|
|
49
54
|
}
|
|
50
55
|
)
|
|
51
56
|
randomGraphNode2 = createRandomGraphNode({
|
|
52
57
|
streamPartId,
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
layer1Node: dhtNode1,
|
|
59
|
+
transport: dhtNode1.getTransport(),
|
|
55
60
|
connectionLocker: dhtNode1.getTransport() as ConnectionManager,
|
|
56
61
|
ownPeerDescriptor: dhtNode1.getPeerDescriptor()
|
|
57
62
|
})
|
|
58
63
|
randomGraphNode3 = createRandomGraphNode({
|
|
59
64
|
streamPartId,
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
layer1Node: dhtNode2,
|
|
66
|
+
transport: dhtNode2.getTransport(),
|
|
62
67
|
connectionLocker: dhtNode2.getTransport() as ConnectionManager,
|
|
63
68
|
ownPeerDescriptor: dhtNode2.getPeerDescriptor()
|
|
64
69
|
})
|
|
65
70
|
randomGraphNode4 = createRandomGraphNode({
|
|
66
71
|
streamPartId,
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
layer1Node: dhtNode3,
|
|
73
|
+
transport: dhtNode3.getTransport(),
|
|
69
74
|
connectionLocker: dhtNode3.getTransport() as ConnectionManager,
|
|
70
75
|
ownPeerDescriptor: dhtNode3.getPeerDescriptor()
|
|
71
76
|
})
|
|
72
77
|
randomGraphNode5 = createRandomGraphNode({
|
|
73
78
|
streamPartId,
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
layer1Node: dhtNode4,
|
|
80
|
+
transport: dhtNode4.getTransport(),
|
|
76
81
|
connectionLocker: dhtNode4.getTransport() as ConnectionManager,
|
|
77
82
|
ownPeerDescriptor: dhtNode4.getPeerDescriptor()
|
|
78
83
|
})
|
|
@@ -82,7 +82,7 @@ describe('inspect', () => {
|
|
|
82
82
|
}, 200)
|
|
83
83
|
|
|
84
84
|
for (const node of inspectedNodes) {
|
|
85
|
-
const result = await inspectorNode.getStreamrNode().inspect(node.
|
|
85
|
+
const result = await inspectorNode.getStreamrNode().inspect(node.getLayer0Node().getPeerDescriptor(), streamPartId)
|
|
86
86
|
expect(result).toEqual(true)
|
|
87
87
|
}
|
|
88
88
|
}, 25000)
|