@streamr/trackerless-network 100.0.0-testnet-three.6 → 100.1.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 +7 -7
- package/dist/src/NetworkNode.js +11 -11
- package/dist/src/NetworkNode.js.map +1 -1
- package/dist/src/NetworkStack.d.ts +6 -6
- package/dist/src/NetworkStack.js +22 -20
- package/dist/src/NetworkStack.js.map +1 -1
- package/dist/src/exports.d.ts +3 -3
- package/dist/src/exports.js +7 -1
- package/dist/src/exports.js.map +1 -1
- package/dist/src/logic/{StreamrNode.d.ts → ContentDeliveryManager.d.ts} +6 -6
- package/dist/src/logic/{StreamrNode.js → ContentDeliveryManager.js} +16 -13
- package/dist/src/logic/ContentDeliveryManager.js.map +1 -0
- package/dist/src/logic/{DeliveryRpcLocal.d.ts → ContentDeliveryRpcLocal.d.ts} +4 -4
- package/dist/src/logic/{DeliveryRpcLocal.js → ContentDeliveryRpcLocal.js} +4 -4
- package/dist/src/logic/ContentDeliveryRpcLocal.js.map +1 -0
- package/dist/src/logic/{DeliveryRpcRemote.d.ts → ContentDeliveryRpcRemote.d.ts} +2 -2
- package/dist/src/logic/{DeliveryRpcRemote.js → ContentDeliveryRpcRemote.js} +4 -4
- package/dist/src/logic/ContentDeliveryRpcRemote.js.map +1 -0
- package/dist/src/logic/EntryPointDiscovery.d.ts +1 -1
- package/dist/src/logic/EntryPointDiscovery.js +3 -3
- package/dist/src/logic/EntryPointDiscovery.js.map +1 -1
- package/dist/src/logic/Layer0Node.d.ts +1 -1
- package/dist/src/logic/Layer1Node.d.ts +7 -1
- package/dist/src/logic/NodeList.d.ts +11 -10
- package/dist/src/logic/NodeList.js +7 -2
- package/dist/src/logic/NodeList.js.map +1 -1
- package/dist/src/logic/RandomGraphNode.d.ts +4 -1
- package/dist/src/logic/RandomGraphNode.js +36 -14
- package/dist/src/logic/RandomGraphNode.js.map +1 -1
- package/dist/src/logic/createRandomGraphNode.d.ts +1 -1
- package/dist/src/logic/createRandomGraphNode.js +16 -7
- package/dist/src/logic/createRandomGraphNode.js.map +1 -1
- package/dist/src/logic/formStreamPartDeliveryServiceId.d.ts +1 -1
- package/dist/src/logic/formStreamPartDeliveryServiceId.js +4 -3
- package/dist/src/logic/formStreamPartDeliveryServiceId.js.map +1 -1
- package/dist/src/logic/inspect/Inspector.js +2 -2
- package/dist/src/logic/inspect/Inspector.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.d.ts +3 -4
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js +6 -11
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js +2 -2
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/Handshaker.d.ts +4 -3
- package/dist/src/logic/neighbor-discovery/Handshaker.js +35 -16
- package/dist/src/logic/neighbor-discovery/Handshaker.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborFinder.d.ts +3 -0
- package/dist/src/logic/neighbor-discovery/NeighborFinder.js +7 -1
- package/dist/src/logic/neighbor-discovery/NeighborFinder.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.d.ts +1 -2
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js +0 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.d.ts +1 -2
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js +2 -3
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.js +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.js.map +1 -1
- package/dist/src/logic/protocol-integration/stream-message/GroupKeyResponseTranslator.js.map +1 -1
- package/dist/src/logic/protocol-integration/stream-message/StreamMessageTranslator.js +64 -52
- package/dist/src/logic/protocol-integration/stream-message/StreamMessageTranslator.js.map +1 -1
- package/dist/src/logic/protocol-integration/stream-message/oldStreamMessageBinaryUtils.d.ts +5 -1
- package/dist/src/logic/protocol-integration/stream-message/oldStreamMessageBinaryUtils.js +19 -1
- package/dist/src/logic/protocol-integration/stream-message/oldStreamMessageBinaryUtils.js.map +1 -1
- package/dist/src/logic/proxy/ProxyClient.d.ts +1 -1
- package/dist/src/logic/proxy/ProxyClient.js +8 -8
- package/dist/src/logic/proxy/ProxyClient.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.d.ts +2 -2
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js +5 -5
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcRemote.js +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcRemote.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.d.ts +5 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js +7 -2
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js +2 -2
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js.map +1 -1
- package/dist/src/proto/google/protobuf/any.d.ts +11 -4
- package/dist/src/proto/google/protobuf/any.js.map +1 -1
- package/dist/src/proto/google/protobuf/empty.d.ts +0 -1
- package/dist/src/proto/google/protobuf/empty.js.map +1 -1
- package/dist/src/proto/google/protobuf/timestamp.d.ts +9 -3
- package/dist/src/proto/google/protobuf/timestamp.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +16 -6
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +11 -4
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +98 -87
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +45 -49
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +10 -4
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.d.ts +4 -4
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.js +7 -7
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.js.map +1 -1
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.d.ts +62 -26
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js +31 -14
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js.map +1 -1
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.server.d.ts +2 -2
- package/dist/test/benchmark/first-message.js +5 -5
- package/dist/test/benchmark/first-message.js.map +1 -1
- package/dist/test/utils/utils.d.ts +2 -2
- package/dist/test/utils/utils.js +18 -11
- package/dist/test/utils/utils.js.map +1 -1
- package/karma.config.js +2 -0
- package/package.json +7 -7
- package/protos/NetworkRpc.proto +19 -11
- package/src/NetworkNode.ts +11 -11
- package/src/NetworkStack.ts +30 -25
- package/src/exports.ts +7 -3
- package/src/logic/{StreamrNode.ts → ContentDeliveryManager.ts} +21 -17
- package/src/logic/{DeliveryRpcLocal.ts → ContentDeliveryRpcLocal.ts} +5 -5
- package/src/logic/{DeliveryRpcRemote.ts → ContentDeliveryRpcRemote.ts} +2 -2
- package/src/logic/EntryPointDiscovery.ts +4 -4
- package/src/logic/Layer0Node.ts +1 -1
- package/src/logic/Layer1Node.ts +16 -1
- package/src/logic/NodeList.ts +20 -14
- package/src/logic/RandomGraphNode.ts +89 -27
- package/src/logic/createRandomGraphNode.ts +18 -9
- package/src/logic/formStreamPartDeliveryServiceId.ts +2 -1
- package/src/logic/inspect/Inspector.ts +2 -2
- package/src/logic/neighbor-discovery/HandshakeRpcLocal.ts +10 -15
- package/src/logic/neighbor-discovery/HandshakeRpcRemote.ts +2 -2
- package/src/logic/neighbor-discovery/Handshaker.ts +41 -22
- package/src/logic/neighbor-discovery/NeighborFinder.ts +10 -1
- package/src/logic/neighbor-discovery/NeighborUpdateManager.ts +1 -3
- package/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts +5 -7
- package/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.ts +1 -1
- package/src/logic/protocol-integration/stream-message/GroupKeyResponseTranslator.ts +0 -1
- package/src/logic/protocol-integration/stream-message/StreamMessageTranslator.ts +74 -71
- package/src/logic/protocol-integration/stream-message/oldStreamMessageBinaryUtils.ts +28 -2
- package/src/logic/proxy/ProxyClient.ts +11 -11
- package/src/logic/proxy/ProxyConnectionRpcLocal.ts +9 -11
- package/src/logic/proxy/ProxyConnectionRpcRemote.ts +1 -1
- package/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts +14 -6
- package/src/logic/temporary-connection/TemporaryConnectionRpcRemote.ts +2 -2
- package/src/proto/google/protobuf/any.ts +11 -4
- package/src/proto/google/protobuf/empty.ts +0 -1
- package/src/proto/google/protobuf/timestamp.ts +9 -3
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +22 -9
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +10 -4
- package/src/proto/packages/dht/protos/DhtRpc.ts +122 -100
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.client.ts +8 -8
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.server.ts +2 -2
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.ts +79 -37
- package/test/benchmark/StreamPartIdDataKeyDistribution.test.ts +60 -0
- package/test/benchmark/first-message.ts +5 -5
- package/test/end-to-end/inspect.test.ts +6 -6
- package/test/end-to-end/proxy-and-full-node.test.ts +19 -19
- package/test/end-to-end/proxy-connections.test.ts +7 -7
- package/test/end-to-end/proxy-key-exchange.test.ts +16 -13
- package/test/end-to-end/webrtc-full-node-network.test.ts +8 -8
- package/test/end-to-end/websocket-full-node-network.test.ts +9 -9
- package/test/integration/ContentDeliveryManager.test.ts +135 -0
- package/test/integration/{DeliveryRpcRemote.test.ts → ContentDeliveryRpcRemote.test.ts} +6 -6
- package/test/integration/Handshakes.test.ts +7 -3
- package/test/integration/Inspect.test.ts +2 -2
- package/test/integration/NetworkRpc.test.ts +3 -3
- package/test/integration/NetworkStack.test.ts +7 -7
- package/test/integration/NodeInfoRpc.test.ts +10 -10
- package/test/integration/joining-streams-on-offline-peers.test.ts +3 -3
- package/test/integration/stream-without-default-entrypoints.test.ts +1 -1
- package/test/integration/streamEntryPointReplacing.test.ts +10 -8
- package/test/unit/ContentDeliveryManager.test.ts +96 -0
- package/test/unit/{DeliveryRpcLocal.test.ts → ContentDeliveryRpcLocal.test.ts} +4 -4
- package/test/unit/EntrypointDiscovery.test.ts +4 -4
- package/test/unit/HandshakeRpcLocal.test.ts +31 -15
- package/test/unit/Handshaker.test.ts +8 -3
- package/test/unit/NeighborFinder.test.ts +5 -2
- package/test/unit/NeighborUpdateRpcLocal.test.ts +8 -12
- package/test/unit/NetworkNode.test.ts +6 -6
- package/test/unit/NodeList.test.ts +6 -6
- package/test/unit/Propagation.test.ts +10 -7
- package/test/unit/RandomGraphNode.test.ts +3 -3
- package/test/unit/StreamMessageTranslator.test.ts +3 -4
- package/test/unit/StreamPartIDDataKey.test.ts +12 -0
- package/test/unit/TemporaryConnectionRpcLocal.test.ts +7 -1
- package/test/utils/mock/MockLayer0Node.ts +1 -1
- package/test/utils/mock/MockLayer1Node.ts +3 -0
- package/test/utils/utils.ts +19 -13
- package/dist/src/logic/DeliveryRpcLocal.js.map +0 -1
- package/dist/src/logic/DeliveryRpcRemote.js.map +0 -1
- package/dist/src/logic/StreamrNode.js.map +0 -1
- package/test/integration/StreamrNode.test.ts +0 -131
- package/test/unit/GroupKeyRequestTranslator.test.ts +0 -36
- package/test/unit/StreamrNode.test.ts +0 -98
|
@@ -52,45 +52,70 @@ export interface MessageRef {
|
|
|
52
52
|
*/
|
|
53
53
|
export interface StreamMessage {
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @generated from protobuf field: ContentType contentType = 2;
|
|
55
|
+
* this is a required field but in generated NetworkRpc.ts it is incorrectly annotated as optional (NET-1082)
|
|
56
|
+
*
|
|
57
|
+
* @generated from protobuf field: MessageID messageId = 1;
|
|
60
58
|
*/
|
|
61
|
-
|
|
59
|
+
messageId?: MessageID;
|
|
62
60
|
/**
|
|
63
|
-
* @generated from protobuf field:
|
|
61
|
+
* @generated from protobuf field: optional MessageRef previousMessageRef = 2;
|
|
64
62
|
*/
|
|
65
|
-
|
|
63
|
+
previousMessageRef?: MessageRef;
|
|
66
64
|
/**
|
|
67
|
-
* @generated from protobuf field: bytes
|
|
65
|
+
* @generated from protobuf field: bytes signature = 3;
|
|
68
66
|
*/
|
|
69
|
-
|
|
67
|
+
signature: Uint8Array;
|
|
70
68
|
/**
|
|
71
|
-
* @generated from protobuf field: SignatureType signatureType =
|
|
69
|
+
* @generated from protobuf field: SignatureType signatureType = 4;
|
|
72
70
|
*/
|
|
73
71
|
signatureType: SignatureType;
|
|
74
72
|
/**
|
|
75
|
-
* @generated from protobuf
|
|
73
|
+
* @generated from protobuf oneof: body
|
|
74
|
+
*/
|
|
75
|
+
body: {
|
|
76
|
+
oneofKind: "contentMessage";
|
|
77
|
+
/**
|
|
78
|
+
* @generated from protobuf field: ContentMessage contentMessage = 5;
|
|
79
|
+
*/
|
|
80
|
+
contentMessage: ContentMessage;
|
|
81
|
+
} | {
|
|
82
|
+
oneofKind: "groupKeyRequest";
|
|
83
|
+
/**
|
|
84
|
+
* @generated from protobuf field: GroupKeyRequest groupKeyRequest = 6;
|
|
85
|
+
*/
|
|
86
|
+
groupKeyRequest: GroupKeyRequest;
|
|
87
|
+
} | {
|
|
88
|
+
oneofKind: "groupKeyResponse";
|
|
89
|
+
/**
|
|
90
|
+
* @generated from protobuf field: GroupKeyResponse groupKeyResponse = 7;
|
|
91
|
+
*/
|
|
92
|
+
groupKeyResponse: GroupKeyResponse;
|
|
93
|
+
} | {
|
|
94
|
+
oneofKind: undefined;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @generated from protobuf message ContentMessage
|
|
99
|
+
*/
|
|
100
|
+
export interface ContentMessage {
|
|
101
|
+
/**
|
|
102
|
+
* @generated from protobuf field: bytes content = 1;
|
|
76
103
|
*/
|
|
77
|
-
|
|
104
|
+
content: Uint8Array;
|
|
78
105
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* @generated from protobuf field: MessageID messageId = 7;
|
|
106
|
+
* @generated from protobuf field: ContentType contentType = 2;
|
|
82
107
|
*/
|
|
83
|
-
|
|
108
|
+
contentType: ContentType;
|
|
84
109
|
/**
|
|
85
|
-
* @generated from protobuf field:
|
|
110
|
+
* @generated from protobuf field: EncryptionType encryptionType = 3;
|
|
86
111
|
*/
|
|
87
|
-
|
|
112
|
+
encryptionType: EncryptionType;
|
|
88
113
|
/**
|
|
89
|
-
* @generated from protobuf field: optional string groupKeyId =
|
|
114
|
+
* @generated from protobuf field: optional string groupKeyId = 4;
|
|
90
115
|
*/
|
|
91
116
|
groupKeyId?: string;
|
|
92
117
|
/**
|
|
93
|
-
* @generated from protobuf field: optional GroupKey newGroupKey =
|
|
118
|
+
* @generated from protobuf field: optional GroupKey newGroupKey = 5;
|
|
94
119
|
*/
|
|
95
120
|
newGroupKey?: GroupKey;
|
|
96
121
|
}
|
|
@@ -291,9 +316,9 @@ export interface StreamPartitionInfo {
|
|
|
291
316
|
*/
|
|
292
317
|
controlLayerNeighbors: PeerDescriptor[];
|
|
293
318
|
/**
|
|
294
|
-
* @generated from protobuf field: repeated dht.PeerDescriptor
|
|
319
|
+
* @generated from protobuf field: repeated dht.PeerDescriptor contentDeliveryLayerNeighbors = 3;
|
|
295
320
|
*/
|
|
296
|
-
|
|
321
|
+
contentDeliveryLayerNeighbors: PeerDescriptor[];
|
|
297
322
|
}
|
|
298
323
|
/**
|
|
299
324
|
* @generated from protobuf message ControlLayerInfo
|
|
@@ -388,7 +413,11 @@ export enum SignatureType {
|
|
|
388
413
|
/**
|
|
389
414
|
* @generated from protobuf enum value: SECP256K1 = 1;
|
|
390
415
|
*/
|
|
391
|
-
SECP256K1 = 1
|
|
416
|
+
SECP256K1 = 1,
|
|
417
|
+
/**
|
|
418
|
+
* @generated from protobuf enum value: ERC_1271 = 2;
|
|
419
|
+
*/
|
|
420
|
+
ERC_1271 = 2
|
|
392
421
|
}
|
|
393
422
|
/**
|
|
394
423
|
* @generated from protobuf enum ProxyDirection
|
|
@@ -437,16 +466,13 @@ export const MessageRef = new MessageRef$Type();
|
|
|
437
466
|
class StreamMessage$Type extends MessageType<StreamMessage> {
|
|
438
467
|
constructor() {
|
|
439
468
|
super("StreamMessage", [
|
|
440
|
-
{ no: 1, name: "
|
|
441
|
-
{ no: 2, name: "
|
|
442
|
-
{ no: 3, name: "
|
|
443
|
-
{ no: 4, name: "
|
|
444
|
-
{ no: 5, name: "
|
|
445
|
-
{ no: 6, name: "
|
|
446
|
-
{ no: 7, name: "
|
|
447
|
-
{ no: 8, name: "previousMessageRef", kind: "message", T: () => MessageRef },
|
|
448
|
-
{ no: 9, name: "groupKeyId", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ },
|
|
449
|
-
{ no: 10, name: "newGroupKey", kind: "message", T: () => GroupKey }
|
|
469
|
+
{ no: 1, name: "messageId", kind: "message", T: () => MessageID },
|
|
470
|
+
{ no: 2, name: "previousMessageRef", kind: "message", T: () => MessageRef },
|
|
471
|
+
{ no: 3, name: "signature", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
|
472
|
+
{ no: 4, name: "signatureType", kind: "enum", T: () => ["SignatureType", SignatureType] },
|
|
473
|
+
{ no: 5, name: "contentMessage", kind: "message", oneof: "body", T: () => ContentMessage },
|
|
474
|
+
{ no: 6, name: "groupKeyRequest", kind: "message", oneof: "body", T: () => GroupKeyRequest },
|
|
475
|
+
{ no: 7, name: "groupKeyResponse", kind: "message", oneof: "body", T: () => GroupKeyResponse }
|
|
450
476
|
]);
|
|
451
477
|
}
|
|
452
478
|
}
|
|
@@ -455,6 +481,22 @@ class StreamMessage$Type extends MessageType<StreamMessage> {
|
|
|
455
481
|
*/
|
|
456
482
|
export const StreamMessage = new StreamMessage$Type();
|
|
457
483
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
484
|
+
class ContentMessage$Type extends MessageType<ContentMessage> {
|
|
485
|
+
constructor() {
|
|
486
|
+
super("ContentMessage", [
|
|
487
|
+
{ no: 1, name: "content", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
|
488
|
+
{ no: 2, name: "contentType", kind: "enum", T: () => ["ContentType", ContentType] },
|
|
489
|
+
{ no: 3, name: "encryptionType", kind: "enum", T: () => ["EncryptionType", EncryptionType] },
|
|
490
|
+
{ no: 4, name: "groupKeyId", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ },
|
|
491
|
+
{ no: 5, name: "newGroupKey", kind: "message", T: () => GroupKey }
|
|
492
|
+
]);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* @generated MessageType for protobuf message ContentMessage
|
|
497
|
+
*/
|
|
498
|
+
export const ContentMessage = new ContentMessage$Type();
|
|
499
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
458
500
|
class GroupKeyRequest$Type extends MessageType<GroupKeyRequest> {
|
|
459
501
|
constructor() {
|
|
460
502
|
super("GroupKeyRequest", [
|
|
@@ -640,7 +682,7 @@ class StreamPartitionInfo$Type extends MessageType<StreamPartitionInfo> {
|
|
|
640
682
|
super("StreamPartitionInfo", [
|
|
641
683
|
{ no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
642
684
|
{ no: 2, name: "controlLayerNeighbors", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor },
|
|
643
|
-
{ no: 3, name: "
|
|
685
|
+
{ no: 3, name: "contentDeliveryLayerNeighbors", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }
|
|
644
686
|
]);
|
|
645
687
|
}
|
|
646
688
|
}
|
|
@@ -687,9 +729,9 @@ class NodeInfoResponse$Type extends MessageType<NodeInfoResponse> {
|
|
|
687
729
|
*/
|
|
688
730
|
export const NodeInfoResponse = new NodeInfoResponse$Type();
|
|
689
731
|
/**
|
|
690
|
-
* @generated ServiceType for protobuf service
|
|
732
|
+
* @generated ServiceType for protobuf service ContentDeliveryRpc
|
|
691
733
|
*/
|
|
692
|
-
export const
|
|
734
|
+
export const ContentDeliveryRpc = new ServiceType("ContentDeliveryRpc", [
|
|
693
735
|
{ name: "sendStreamMessage", options: {}, I: StreamMessage, O: Empty },
|
|
694
736
|
{ name: "leaveStreamPartNotice", options: {}, I: LeaveStreamPartNotice, O: Empty }
|
|
695
737
|
]);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
|
|
3
|
+
import { groupBy, range } from 'lodash'
|
|
4
|
+
import { streamPartIdToDataKey } from '../../src/logic/EntryPointDiscovery'
|
|
5
|
+
import { StreamPartIDUtils } from '@streamr/protocol'
|
|
6
|
+
import { DhtAddress } from '@streamr/dht'
|
|
7
|
+
|
|
8
|
+
describe('StreamPartIdDataKeyDistribution', () => {
|
|
9
|
+
|
|
10
|
+
it('partitions are well distributed', () => {
|
|
11
|
+
|
|
12
|
+
const streamId = 'stream'
|
|
13
|
+
const dataKeys = range(100).map((i) => {
|
|
14
|
+
const streamPartId = StreamPartIDUtils.parse(streamId + '#' + i)
|
|
15
|
+
return streamPartIdToDataKey(streamPartId)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const byInitials = groupBy(dataKeys, (dataKey: DhtAddress) => dataKey[0])
|
|
19
|
+
expect(Object.keys(byInitials).length).toEqual(16)
|
|
20
|
+
console.log(Object.values(byInitials).map((a) => a.length))
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('streamIds are well distributed', () => {
|
|
24
|
+
const dataKeys = range(10000).map(() => {
|
|
25
|
+
const streamPartId = StreamPartIDUtils.parse(Math.random().toString(32).substr(2, 32) + '#0')
|
|
26
|
+
return streamPartIdToDataKey(streamPartId)
|
|
27
|
+
})
|
|
28
|
+
const byInitials = groupBy(dataKeys, (dataKey: DhtAddress) => dataKey[0])
|
|
29
|
+
expect(Object.keys(byInitials).length).toEqual(16)
|
|
30
|
+
console.log(Object.values(byInitials).map((a) => a.length))
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('streamPartIds are well distributed', () => {
|
|
34
|
+
const streamIds = range(10000).map(() => Math.random().toString(32).substr(2, 32))
|
|
35
|
+
const dataKeys: DhtAddress[] = []
|
|
36
|
+
streamIds.forEach((streamId) => {
|
|
37
|
+
range(100).forEach((i) => {
|
|
38
|
+
const streamPartId = StreamPartIDUtils.parse(streamId + '#' + i)
|
|
39
|
+
dataKeys.push(streamPartIdToDataKey(streamPartId))
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const byInitials = groupBy(dataKeys, (dataKey: DhtAddress) => dataKey[0])
|
|
44
|
+
expect(Object.keys(byInitials).length).toEqual(16)
|
|
45
|
+
console.log(Object.values(byInitials).map((a) => a.length))
|
|
46
|
+
|
|
47
|
+
const byTwoInitials = groupBy(dataKeys, (dataKey: DhtAddress) => dataKey[0] + dataKey[1])
|
|
48
|
+
expect(Object.keys(byTwoInitials).length).toEqual(16 * 16)
|
|
49
|
+
console.log(Object.values(byTwoInitials).map((a) => a.length))
|
|
50
|
+
|
|
51
|
+
const byThreeInitials = groupBy(dataKeys, (dataKey: DhtAddress) => dataKey[0] + dataKey[1] + dataKey[2])
|
|
52
|
+
expect(Object.keys(byThreeInitials).length).toEqual(16 * 16 * 16)
|
|
53
|
+
console.log(Object.values(byThreeInitials).map((a) => a.length))
|
|
54
|
+
|
|
55
|
+
const byFourInitials = groupBy(dataKeys, (dataKey: DhtAddress) => dataKey[0] + dataKey[1] + dataKey[2] + dataKey[3])
|
|
56
|
+
expect(Object.keys(byFourInitials).length).toEqual(16 * 16 * 16 * 16)
|
|
57
|
+
console.log(Object.values(byFourInitials).map((a) => a.length))
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
})
|
|
@@ -119,7 +119,7 @@ const measureJoiningTime = async () => {
|
|
|
119
119
|
await streamSubscriber.start()
|
|
120
120
|
|
|
121
121
|
await Promise.all([
|
|
122
|
-
waitForEvent3(streamSubscriber.stack.
|
|
122
|
+
waitForEvent3(streamSubscriber.stack.getContentDeliveryManager() as any, 'newMessage', 60000),
|
|
123
123
|
streamSubscriber.join(stream)
|
|
124
124
|
])
|
|
125
125
|
|
|
@@ -153,14 +153,14 @@ run().then(() => {
|
|
|
153
153
|
console.log('done')
|
|
154
154
|
}).catch((err) => {
|
|
155
155
|
console.error(err)
|
|
156
|
-
const
|
|
157
|
-
const streamParts =
|
|
158
|
-
const foundData = nodes[0].stack.getLayer0Node().
|
|
156
|
+
const contentDeliveryManager = currentNode.stack.getContentDeliveryManager()
|
|
157
|
+
const streamParts = contentDeliveryManager.getStreamParts()
|
|
158
|
+
const foundData = nodes[0].stack.getLayer0Node().fetchDataFromDht(streamPartIdToDataKey(streamParts[0]))
|
|
159
159
|
console.log(foundData)
|
|
160
160
|
const layer0Node = currentNode.stack.getLayer0Node() as DhtNode
|
|
161
161
|
console.log(layer0Node.getNeighbors().length)
|
|
162
162
|
console.log(layer0Node.getConnectionCount())
|
|
163
|
-
const streamPartDelivery =
|
|
163
|
+
const streamPartDelivery = contentDeliveryManager.getStreamPartDelivery(streamParts[0])! as { layer1Node: Layer1Node, node: RandomGraphNode }
|
|
164
164
|
console.log(streamPartDelivery.layer1Node.getNeighbors())
|
|
165
165
|
console.log(streamPartDelivery.node.getNeighbors())
|
|
166
166
|
console.log(nodes[nodes.length - 1])
|
|
@@ -96,14 +96,14 @@ describe('inspect', () => {
|
|
|
96
96
|
await inspectedNode.start()
|
|
97
97
|
await inspectorNode.start()
|
|
98
98
|
|
|
99
|
-
publisherNode.stack.
|
|
100
|
-
inspectedNode.stack.
|
|
101
|
-
inspectorNode.stack.
|
|
99
|
+
publisherNode.stack.getContentDeliveryManager().joinStreamPart(STREAM_PART_ID)
|
|
100
|
+
inspectedNode.stack.getContentDeliveryManager().joinStreamPart(STREAM_PART_ID)
|
|
101
|
+
inspectorNode.stack.getContentDeliveryManager().joinStreamPart(STREAM_PART_ID)
|
|
102
102
|
|
|
103
103
|
await waitForCondition(() =>
|
|
104
|
-
publisherNode.stack.
|
|
105
|
-
&& inspectedNode.stack.
|
|
106
|
-
&& inspectorNode.stack.
|
|
104
|
+
publisherNode.stack.getContentDeliveryManager().getNeighbors(STREAM_PART_ID).length === 2
|
|
105
|
+
&& inspectedNode.stack.getContentDeliveryManager().getNeighbors(STREAM_PART_ID).length === 2
|
|
106
|
+
&& inspectorNode.stack.getContentDeliveryManager().getNeighbors(STREAM_PART_ID).length === 2
|
|
107
107
|
)
|
|
108
108
|
}, 30000)
|
|
109
109
|
|
|
@@ -65,11 +65,11 @@ describe('proxy and full node', () => {
|
|
|
65
65
|
}
|
|
66
66
|
})
|
|
67
67
|
await proxyNode.start()
|
|
68
|
-
proxyNode.stack.
|
|
69
|
-
proxyNode.stack.
|
|
70
|
-
proxyNode.stack.
|
|
71
|
-
proxyNode.stack.
|
|
72
|
-
proxyNode.stack.
|
|
68
|
+
proxyNode.stack.getContentDeliveryManager().joinStreamPart(proxiedStreamPart)
|
|
69
|
+
proxyNode.stack.getContentDeliveryManager().joinStreamPart(regularStreamPart1)
|
|
70
|
+
proxyNode.stack.getContentDeliveryManager().joinStreamPart(regularStreamPart2)
|
|
71
|
+
proxyNode.stack.getContentDeliveryManager().joinStreamPart(regularStreamPart3)
|
|
72
|
+
proxyNode.stack.getContentDeliveryManager().joinStreamPart(regularStreamPart4)
|
|
73
73
|
|
|
74
74
|
proxiedNode = createNetworkNode({
|
|
75
75
|
layer0: {
|
|
@@ -90,19 +90,19 @@ describe('proxy and full node', () => {
|
|
|
90
90
|
expect(proxiedNode.stack.getLayer0Node().hasJoined()).toBe(false)
|
|
91
91
|
|
|
92
92
|
await Promise.all([
|
|
93
|
-
waitForEvent3(proxyNode.stack.
|
|
93
|
+
waitForEvent3(proxyNode.stack.getContentDeliveryManager() as any, 'newMessage'),
|
|
94
94
|
proxiedNode.broadcast(createMessage(regularStreamPart1))
|
|
95
95
|
])
|
|
96
96
|
|
|
97
97
|
expect(proxiedNode.stack.getLayer0Node().hasJoined()).toBe(true)
|
|
98
98
|
|
|
99
99
|
await Promise.all([
|
|
100
|
-
waitForEvent3(proxyNode.stack.
|
|
100
|
+
waitForEvent3(proxyNode.stack.getContentDeliveryManager() as any, 'newMessage'),
|
|
101
101
|
proxiedNode.broadcast(createMessage(proxiedStreamPart))
|
|
102
102
|
])
|
|
103
103
|
|
|
104
|
-
expect(proxiedNode.stack.
|
|
105
|
-
expect(proxiedNode.stack.
|
|
104
|
+
expect(proxiedNode.stack.getContentDeliveryManager().getStreamPartDelivery(proxiedStreamPart)!.proxied).toBe(true)
|
|
105
|
+
expect(proxiedNode.stack.getContentDeliveryManager().getStreamPartDelivery(regularStreamPart1)!.proxied).toBe(false)
|
|
106
106
|
})
|
|
107
107
|
|
|
108
108
|
it('proxied node can act as full node on multiple stream parts', async () => {
|
|
@@ -110,13 +110,13 @@ describe('proxy and full node', () => {
|
|
|
110
110
|
expect(proxiedNode.stack.getLayer0Node().hasJoined()).toBe(false)
|
|
111
111
|
|
|
112
112
|
await Promise.all([
|
|
113
|
-
waitForEvent3(proxyNode.stack.
|
|
113
|
+
waitForEvent3(proxyNode.stack.getContentDeliveryManager() as any, 'newMessage', 5000,
|
|
114
114
|
(streamMessage: InternalStreamMessage) => streamMessage.messageId!.streamId === StreamPartIDUtils.getStreamID(regularStreamPart1)),
|
|
115
|
-
waitForEvent3(proxyNode.stack.
|
|
115
|
+
waitForEvent3(proxyNode.stack.getContentDeliveryManager() as any, 'newMessage', 5000,
|
|
116
116
|
(streamMessage: InternalStreamMessage) => streamMessage.messageId!.streamId === StreamPartIDUtils.getStreamID(regularStreamPart2)),
|
|
117
|
-
waitForEvent3(proxyNode.stack.
|
|
117
|
+
waitForEvent3(proxyNode.stack.getContentDeliveryManager() as any, 'newMessage', 5000,
|
|
118
118
|
(streamMessage: InternalStreamMessage) => streamMessage.messageId!.streamId === StreamPartIDUtils.getStreamID(regularStreamPart3)),
|
|
119
|
-
waitForEvent3(proxyNode.stack.
|
|
119
|
+
waitForEvent3(proxyNode.stack.getContentDeliveryManager() as any, 'newMessage', 5000,
|
|
120
120
|
(streamMessage: InternalStreamMessage) => streamMessage.messageId!.streamId === StreamPartIDUtils.getStreamID(regularStreamPart4)),
|
|
121
121
|
proxiedNode.broadcast(createMessage(regularStreamPart1)),
|
|
122
122
|
proxiedNode.broadcast(createMessage(regularStreamPart2)),
|
|
@@ -127,15 +127,15 @@ describe('proxy and full node', () => {
|
|
|
127
127
|
expect(proxiedNode.stack.getLayer0Node().hasJoined()).toBe(true)
|
|
128
128
|
|
|
129
129
|
await Promise.all([
|
|
130
|
-
waitForEvent3(proxyNode.stack.
|
|
130
|
+
waitForEvent3(proxyNode.stack.getContentDeliveryManager() as any, 'newMessage'),
|
|
131
131
|
proxiedNode.broadcast(createMessage(proxiedStreamPart))
|
|
132
132
|
])
|
|
133
133
|
|
|
134
|
-
expect(proxiedNode.stack.
|
|
135
|
-
expect(proxiedNode.stack.
|
|
136
|
-
expect(proxiedNode.stack.
|
|
137
|
-
expect(proxiedNode.stack.
|
|
138
|
-
expect(proxiedNode.stack.
|
|
134
|
+
expect(proxiedNode.stack.getContentDeliveryManager().getStreamPartDelivery(proxiedStreamPart)!.proxied).toBe(true)
|
|
135
|
+
expect(proxiedNode.stack.getContentDeliveryManager().getStreamPartDelivery(regularStreamPart1)!.proxied).toBe(false)
|
|
136
|
+
expect(proxiedNode.stack.getContentDeliveryManager().getStreamPartDelivery(regularStreamPart2)!.proxied).toBe(false)
|
|
137
|
+
expect(proxiedNode.stack.getContentDeliveryManager().getStreamPartDelivery(regularStreamPart3)!.proxied).toBe(false)
|
|
138
|
+
expect(proxiedNode.stack.getContentDeliveryManager().getStreamPartDelivery(regularStreamPart4)!.proxied).toBe(false)
|
|
139
139
|
})
|
|
140
140
|
|
|
141
141
|
})
|
|
@@ -46,14 +46,14 @@ describe('Proxy connections', () => {
|
|
|
46
46
|
let proxiedNode: NetworkNode
|
|
47
47
|
|
|
48
48
|
const hasConnectionFromProxy = (proxyNode: NetworkNode): boolean => {
|
|
49
|
-
const delivery = proxyNode.stack.
|
|
49
|
+
const delivery = proxyNode.stack.getContentDeliveryManager().getStreamPartDelivery(STREAM_PART_ID)
|
|
50
50
|
return (delivery !== undefined)
|
|
51
51
|
? ((delivery as { node: RandomGraphNode }).node).hasProxyConnection(proxiedNode.getNodeId())
|
|
52
52
|
: false
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const hasConnectionToProxy = (proxyNodeId: DhtAddress, direction: ProxyDirection): boolean => {
|
|
56
|
-
const client = (proxiedNode.stack.
|
|
56
|
+
const client = (proxiedNode.stack.getContentDeliveryManager().getStreamPartDelivery(STREAM_PART_ID) as { client: ProxyClient }).client
|
|
57
57
|
return client.hasConnection(proxyNodeId, direction)
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -77,7 +77,7 @@ describe('Proxy connections', () => {
|
|
|
77
77
|
})
|
|
78
78
|
await proxyNode1.start()
|
|
79
79
|
proxyNode1.setStreamPartEntryPoints(STREAM_PART_ID, [proxyNodeDescriptor1])
|
|
80
|
-
proxyNode1.stack.
|
|
80
|
+
proxyNode1.stack.getContentDeliveryManager().joinStreamPart(STREAM_PART_ID)
|
|
81
81
|
proxyNode2 = createNetworkNode({
|
|
82
82
|
layer0: {
|
|
83
83
|
entryPoints: [proxyNodeDescriptor1],
|
|
@@ -90,7 +90,7 @@ describe('Proxy connections', () => {
|
|
|
90
90
|
})
|
|
91
91
|
await proxyNode2.start()
|
|
92
92
|
proxyNode2.setStreamPartEntryPoints(STREAM_PART_ID, [proxyNodeDescriptor1])
|
|
93
|
-
proxyNode2.stack.
|
|
93
|
+
proxyNode2.stack.getContentDeliveryManager().joinStreamPart(STREAM_PART_ID)
|
|
94
94
|
proxiedNode = createNetworkNode({
|
|
95
95
|
layer0: {
|
|
96
96
|
entryPoints: [proxyNode1.getPeerDescriptor()],
|
|
@@ -109,7 +109,7 @@ describe('Proxy connections', () => {
|
|
|
109
109
|
it('happy path publishing', async () => {
|
|
110
110
|
await proxiedNode.setProxies(STREAM_PART_ID, [proxyNode1.getPeerDescriptor()], ProxyDirection.PUBLISH, PROXIED_NODE_USER_ID, 1)
|
|
111
111
|
await Promise.all([
|
|
112
|
-
waitForEvent3(proxyNode1.stack.
|
|
112
|
+
waitForEvent3(proxyNode1.stack.getContentDeliveryManager() as any, 'newMessage'),
|
|
113
113
|
proxiedNode.broadcast(MESSAGE)
|
|
114
114
|
])
|
|
115
115
|
})
|
|
@@ -117,7 +117,7 @@ describe('Proxy connections', () => {
|
|
|
117
117
|
it('happy path subscribing', async () => {
|
|
118
118
|
await proxiedNode.setProxies(STREAM_PART_ID, [proxyNode1.getPeerDescriptor()], ProxyDirection.SUBSCRIBE, PROXIED_NODE_USER_ID, 1)
|
|
119
119
|
await Promise.all([
|
|
120
|
-
waitForEvent3(proxiedNode.stack.
|
|
120
|
+
waitForEvent3(proxiedNode.stack.getContentDeliveryManager() as any, 'newMessage'),
|
|
121
121
|
proxyNode1.broadcast(MESSAGE)
|
|
122
122
|
])
|
|
123
123
|
})
|
|
@@ -196,7 +196,7 @@ describe('Proxy connections', () => {
|
|
|
196
196
|
await proxyNode1.leave(STREAM_PART_ID)
|
|
197
197
|
await waitForCondition(() => hasConnectionToProxy(proxyNode1.getNodeId(), ProxyDirection.SUBSCRIBE))
|
|
198
198
|
expect(hasConnectionFromProxy(proxyNode1)).toBe(false)
|
|
199
|
-
proxyNode1.stack.
|
|
199
|
+
proxyNode1.stack.getContentDeliveryManager().joinStreamPart(STREAM_PART_ID)
|
|
200
200
|
await waitForCondition(() => hasConnectionToProxy(proxyNode1.getNodeId(), ProxyDirection.SUBSCRIBE), 25000)
|
|
201
201
|
// TODO why wait is needed?
|
|
202
202
|
await wait(100)
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ContentType,
|
|
3
3
|
EncryptionType,
|
|
4
|
-
GroupKeyRequest,
|
|
5
|
-
GroupKeyResponse,
|
|
6
4
|
MessageID,
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
GroupKeyRequest as OldGroupKeyRequest,
|
|
6
|
+
GroupKeyResponse as OldGroupKeyResponse,
|
|
7
|
+
SignatureType,
|
|
9
8
|
StreamMessage,
|
|
10
9
|
StreamMessageType,
|
|
11
10
|
StreamPartIDUtils
|
|
12
11
|
} from '@streamr/protocol'
|
|
13
12
|
import { hexToBinary, toEthereumAddress, waitForEvent3 } from '@streamr/utils'
|
|
14
13
|
import { NetworkNode, createNetworkNode } from '../../src/NetworkNode'
|
|
14
|
+
import {
|
|
15
|
+
convertGroupKeyRequestToBytes,
|
|
16
|
+
convertGroupKeyResponseToBytes
|
|
17
|
+
} from '../../src/logic/protocol-integration/stream-message/oldStreamMessageBinaryUtils'
|
|
15
18
|
import { ProxyDirection } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
16
19
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
17
20
|
|
|
@@ -44,7 +47,7 @@ describe('proxy group key exchange', () => {
|
|
|
44
47
|
})
|
|
45
48
|
await proxyNode.start()
|
|
46
49
|
proxyNode.setStreamPartEntryPoints(STREAM_PART_ID, [proxyNodeDescriptor])
|
|
47
|
-
proxyNode.stack.
|
|
50
|
+
proxyNode.stack.getContentDeliveryManager().joinStreamPart(STREAM_PART_ID)
|
|
48
51
|
publisher = createNetworkNode({
|
|
49
52
|
layer0: {
|
|
50
53
|
entryPoints: [proxyNodeDescriptor],
|
|
@@ -72,7 +75,7 @@ describe('proxy group key exchange', () => {
|
|
|
72
75
|
await publisher.setProxies(STREAM_PART_ID, [proxyNodeDescriptor], ProxyDirection.PUBLISH, publisherUserId)
|
|
73
76
|
await subscriber.setProxies(STREAM_PART_ID, [proxyNodeDescriptor], ProxyDirection.SUBSCRIBE, subscriberUserId)
|
|
74
77
|
|
|
75
|
-
const groupKeyRequest = new
|
|
78
|
+
const groupKeyRequest = new OldGroupKeyRequest({
|
|
76
79
|
recipient: publisherUserId,
|
|
77
80
|
requestId: 'requestId',
|
|
78
81
|
rsaPublicKey: 'mockKey',
|
|
@@ -90,15 +93,15 @@ describe('proxy group key exchange', () => {
|
|
|
90
93
|
'0'
|
|
91
94
|
),
|
|
92
95
|
messageType: StreamMessageType.GROUP_KEY_REQUEST,
|
|
93
|
-
contentType: ContentType.
|
|
96
|
+
contentType: ContentType.BINARY,
|
|
94
97
|
encryptionType: EncryptionType.NONE,
|
|
95
|
-
content:
|
|
98
|
+
content: convertGroupKeyRequestToBytes(groupKeyRequest),
|
|
96
99
|
signatureType: SignatureType.SECP256K1,
|
|
97
100
|
signature: hexToBinary('1234')
|
|
98
101
|
})
|
|
99
102
|
|
|
100
103
|
await Promise.all([
|
|
101
|
-
waitForEvent3(publisher.stack.
|
|
104
|
+
waitForEvent3(publisher.stack.getContentDeliveryManager() as any, 'newMessage'),
|
|
102
105
|
subscriber.broadcast(request)
|
|
103
106
|
])
|
|
104
107
|
})
|
|
@@ -107,7 +110,7 @@ describe('proxy group key exchange', () => {
|
|
|
107
110
|
await publisher.setProxies(STREAM_PART_ID, [proxyNodeDescriptor], ProxyDirection.PUBLISH, publisherUserId)
|
|
108
111
|
await subscriber.setProxies(STREAM_PART_ID, [proxyNodeDescriptor], ProxyDirection.SUBSCRIBE, subscriberUserId)
|
|
109
112
|
|
|
110
|
-
const groupKeyResponse = new
|
|
113
|
+
const groupKeyResponse = new OldGroupKeyResponse({
|
|
111
114
|
recipient: publisherUserId,
|
|
112
115
|
requestId: 'requestId',
|
|
113
116
|
encryptedGroupKeys: []
|
|
@@ -122,15 +125,15 @@ describe('proxy group key exchange', () => {
|
|
|
122
125
|
'0'
|
|
123
126
|
),
|
|
124
127
|
messageType: StreamMessageType.GROUP_KEY_RESPONSE,
|
|
125
|
-
contentType: ContentType.
|
|
128
|
+
contentType: ContentType.BINARY,
|
|
126
129
|
encryptionType: EncryptionType.NONE,
|
|
127
|
-
content:
|
|
130
|
+
content: convertGroupKeyResponseToBytes(groupKeyResponse),
|
|
128
131
|
signatureType: SignatureType.SECP256K1,
|
|
129
132
|
signature: hexToBinary('1234')
|
|
130
133
|
})
|
|
131
134
|
|
|
132
135
|
await Promise.all([
|
|
133
|
-
waitForEvent3(subscriber.stack.
|
|
136
|
+
waitForEvent3(subscriber.stack.getContentDeliveryManager() as any, 'newMessage'),
|
|
134
137
|
publisher.broadcast(response)
|
|
135
138
|
])
|
|
136
139
|
})
|
|
@@ -33,8 +33,8 @@ describe('Full node network with WebRTC connections', () => {
|
|
|
33
33
|
}
|
|
34
34
|
})
|
|
35
35
|
await entryPoint.start()
|
|
36
|
-
entryPoint.
|
|
37
|
-
entryPoint.
|
|
36
|
+
entryPoint.getContentDeliveryManager().setStreamPartEntryPoints(streamPartId, [epPeerDescriptor])
|
|
37
|
+
entryPoint.getContentDeliveryManager().joinStreamPart(streamPartId)
|
|
38
38
|
|
|
39
39
|
await Promise.all(range(NUM_OF_NODES).map(async () => {
|
|
40
40
|
const peerDescriptor = createMockPeerDescriptor()
|
|
@@ -46,8 +46,8 @@ describe('Full node network with WebRTC connections', () => {
|
|
|
46
46
|
})
|
|
47
47
|
nodes.push(node)
|
|
48
48
|
await node.start()
|
|
49
|
-
node.
|
|
50
|
-
node.
|
|
49
|
+
node.getContentDeliveryManager().setStreamPartEntryPoints(streamPartId, [epPeerDescriptor])
|
|
50
|
+
node.getContentDeliveryManager().joinStreamPart(streamPartId)
|
|
51
51
|
}))
|
|
52
52
|
|
|
53
53
|
}, 90000)
|
|
@@ -62,15 +62,15 @@ describe('Full node network with WebRTC connections', () => {
|
|
|
62
62
|
it('happy path', async () => {
|
|
63
63
|
await Promise.all(nodes.map((node) =>
|
|
64
64
|
waitForCondition(() => {
|
|
65
|
-
return node.
|
|
65
|
+
return node.getContentDeliveryManager().getNeighbors(streamPartId).length >= 3
|
|
66
66
|
}
|
|
67
67
|
, 30000)
|
|
68
68
|
))
|
|
69
69
|
let receivedMessageCount = 0
|
|
70
70
|
const successIds: string[] = []
|
|
71
71
|
nodes.forEach((node) => {
|
|
72
|
-
node.
|
|
73
|
-
successIds.push(getNodeIdFromPeerDescriptor(node.
|
|
72
|
+
node.getContentDeliveryManager().on('newMessage', () => {
|
|
73
|
+
successIds.push(getNodeIdFromPeerDescriptor(node.getContentDeliveryManager().getPeerDescriptor()))
|
|
74
74
|
receivedMessageCount += 1
|
|
75
75
|
})
|
|
76
76
|
})
|
|
@@ -79,7 +79,7 @@ describe('Full node network with WebRTC connections', () => {
|
|
|
79
79
|
streamPartId,
|
|
80
80
|
randomEthereumAddress()
|
|
81
81
|
)
|
|
82
|
-
entryPoint.
|
|
82
|
+
entryPoint.getContentDeliveryManager().broadcast(msg)
|
|
83
83
|
await waitForCondition(() => receivedMessageCount === NUM_OF_NODES)
|
|
84
84
|
}, 120000)
|
|
85
85
|
|
|
@@ -8,7 +8,7 @@ import { getNodeIdFromPeerDescriptor } from '@streamr/dht'
|
|
|
8
8
|
|
|
9
9
|
describe('Full node network with WebSocket connections only', () => {
|
|
10
10
|
|
|
11
|
-
const NUM_OF_NODES =
|
|
11
|
+
const NUM_OF_NODES = 20
|
|
12
12
|
const epPeerDescriptor = createMockPeerDescriptor({
|
|
13
13
|
websocket: { host: '127.0.0.1', port: 15555, tls: false }
|
|
14
14
|
})
|
|
@@ -30,8 +30,8 @@ describe('Full node network with WebSocket connections only', () => {
|
|
|
30
30
|
}
|
|
31
31
|
})
|
|
32
32
|
await entryPoint.start()
|
|
33
|
-
entryPoint.
|
|
34
|
-
entryPoint.
|
|
33
|
+
entryPoint.getContentDeliveryManager().setStreamPartEntryPoints(streamPartId, [epPeerDescriptor])
|
|
34
|
+
entryPoint.getContentDeliveryManager().joinStreamPart(streamPartId)
|
|
35
35
|
|
|
36
36
|
await Promise.all(range(NUM_OF_NODES).map(async (i) => {
|
|
37
37
|
const node = new NetworkStack({
|
|
@@ -44,8 +44,8 @@ describe('Full node network with WebSocket connections only', () => {
|
|
|
44
44
|
})
|
|
45
45
|
nodes.push(node)
|
|
46
46
|
await node.start()
|
|
47
|
-
node.
|
|
48
|
-
node.
|
|
47
|
+
node.getContentDeliveryManager().setStreamPartEntryPoints(streamPartId, [epPeerDescriptor])
|
|
48
|
+
node.getContentDeliveryManager().joinStreamPart(streamPartId)
|
|
49
49
|
}))
|
|
50
50
|
|
|
51
51
|
}, 120000)
|
|
@@ -60,15 +60,15 @@ describe('Full node network with WebSocket connections only', () => {
|
|
|
60
60
|
it('happy path', async () => {
|
|
61
61
|
await Promise.all(nodes.map((node) =>
|
|
62
62
|
waitForCondition(() => {
|
|
63
|
-
return node.
|
|
63
|
+
return node.getContentDeliveryManager().getNeighbors(streamPartId).length >= 4
|
|
64
64
|
}
|
|
65
65
|
, 30000)
|
|
66
66
|
))
|
|
67
67
|
let receivedMessageCount = 0
|
|
68
68
|
const successIds: string[] = []
|
|
69
69
|
nodes.forEach((node) => {
|
|
70
|
-
node.
|
|
71
|
-
successIds.push(getNodeIdFromPeerDescriptor(node.
|
|
70
|
+
node.getContentDeliveryManager().on('newMessage', () => {
|
|
71
|
+
successIds.push(getNodeIdFromPeerDescriptor(node.getContentDeliveryManager().getPeerDescriptor()))
|
|
72
72
|
receivedMessageCount += 1
|
|
73
73
|
})
|
|
74
74
|
})
|
|
@@ -78,7 +78,7 @@ describe('Full node network with WebSocket connections only', () => {
|
|
|
78
78
|
streamPartId,
|
|
79
79
|
randomEthereumAddress()
|
|
80
80
|
)
|
|
81
|
-
entryPoint.
|
|
81
|
+
entryPoint.getContentDeliveryManager().broadcast(msg)
|
|
82
82
|
await waitForCondition(() => receivedMessageCount === NUM_OF_NODES)
|
|
83
83
|
}, 220000)
|
|
84
84
|
|