@streamr/trackerless-network 100.0.0-pretestnet.2 → 100.0.0-pretestnet.4
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 +8 -8
- package/dist/src/NetworkNode.d.ts +1 -1
- package/dist/src/NetworkNode.js +3 -3
- package/dist/src/NetworkNode.js.map +1 -1
- package/dist/src/NetworkStack.js +2 -1
- package/dist/src/NetworkStack.js.map +1 -1
- package/dist/src/logic/DeliveryRpcLocal.d.ts +1 -1
- package/dist/src/logic/EntryPointDiscovery.d.ts +1 -1
- package/dist/src/logic/EntryPointDiscovery.js +5 -5
- 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 +1 -1
- package/dist/src/logic/RandomGraphNode.d.ts +2 -1
- package/dist/src/logic/RandomGraphNode.js +7 -7
- package/dist/src/logic/RandomGraphNode.js.map +1 -1
- package/dist/src/logic/StreamrNode.d.ts +3 -2
- package/dist/src/logic/StreamrNode.js +42 -39
- package/dist/src/logic/StreamrNode.js.map +1 -1
- package/dist/src/logic/createRandomGraphNode.js +8 -7
- package/dist/src/logic/createRandomGraphNode.js.map +1 -1
- package/dist/src/logic/inspect/Inspector.d.ts +2 -2
- 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/Handshaker.d.ts +2 -1
- package/dist/src/logic/neighbor-discovery/Handshaker.js +3 -3
- package/dist/src/logic/neighbor-discovery/Handshaker.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.d.ts +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.d.ts +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js +2 -2
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js.map +1 -1
- package/dist/src/logic/proxy/ProxyClient.d.ts +1 -1
- package/dist/src/logic/proxy/ProxyClient.js +4 -4
- package/dist/src/logic/proxy/ProxyClient.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.d.ts +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js +1 -1
- 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 +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js +2 -2
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +77 -60
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +71 -58
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +112 -136
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +103 -107
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +37 -32
- package/dist/test/benchmark/first-message.js +1 -1
- package/dist/test/benchmark/first-message.js.map +1 -1
- package/dist/test/utils/utils.d.ts +1 -1
- package/dist/test/utils/utils.js +12 -9
- package/dist/test/utils/utils.js.map +1 -1
- package/karma.config.js +2 -2
- package/package.json +8 -8
- package/src/NetworkNode.ts +3 -3
- package/src/NetworkStack.ts +2 -1
- package/src/logic/DeliveryRpcLocal.ts +1 -1
- package/src/logic/EntryPointDiscovery.ts +6 -6
- package/src/logic/Layer0Node.ts +1 -1
- package/src/logic/Layer1Node.ts +1 -1
- package/src/logic/RandomGraphNode.ts +18 -12
- package/src/logic/StreamrNode.ts +31 -24
- package/src/logic/createRandomGraphNode.ts +8 -7
- package/src/logic/inspect/Inspector.ts +4 -4
- package/src/logic/neighbor-discovery/Handshaker.ts +15 -6
- package/src/logic/neighbor-discovery/NeighborUpdateManager.ts +2 -2
- package/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts +3 -3
- package/src/logic/proxy/ProxyClient.ts +6 -6
- package/src/logic/proxy/ProxyConnectionRpcLocal.ts +2 -2
- package/src/logic/proxy/ProxyConnectionRpcRemote.ts +2 -2
- package/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts +3 -3
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +113 -97
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +37 -32
- package/src/proto/packages/dht/protos/DhtRpc.ts +146 -178
- package/test/benchmark/first-message.ts +1 -1
- package/test/end-to-end/inspect.test.ts +6 -3
- package/test/end-to-end/proxy-and-full-node.test.ts +1 -0
- package/test/end-to-end/proxy-connections.test.ts +3 -1
- package/test/end-to-end/proxy-key-exchange.test.ts +1 -0
- package/test/end-to-end/random-graph-with-real-connections.test.ts +10 -10
- package/test/end-to-end/webrtc-full-node-network.test.ts +2 -1
- package/test/end-to-end/websocket-full-node-network.test.ts +3 -1
- package/test/integration/Handshakes.test.ts +1 -1
- package/test/integration/Inspect.test.ts +2 -2
- package/test/integration/NetworkStack.test.ts +4 -2
- package/test/integration/RandomGraphNode-Layer1Node-Latencies.test.ts +2 -2
- package/test/integration/RandomGraphNode-Layer1Node.test.ts +2 -2
- package/test/integration/StreamrNode.test.ts +1 -1
- package/test/integration/joining-streams-on-offline-peers.test.ts +12 -7
- package/test/integration/stream-without-default-entrypoints.test.ts +4 -3
- package/test/unit/DeliveryRpcLocal.test.ts +1 -1
- package/test/unit/EntrypointDiscovery.test.ts +3 -3
- package/test/unit/HandshakeRpcLocal.test.ts +2 -2
- package/test/unit/Handshaker.test.ts +3 -2
- package/test/unit/Inspector.test.ts +1 -1
- package/test/unit/NodeList.test.ts +1 -1
- package/test/unit/RandomGraphNode.test.ts +1 -1
- package/test/unit/StreamrNode.test.ts +1 -1
- package/test/utils/mock/MockLayer0Node.ts +1 -1
- package/test/utils/mock/Transport.ts +1 -1
- package/test/utils/utils.ts +13 -10
- package/test/integration/NetworkStackStoppedDuringStart.test.ts +0 -37
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExternalStoreDataResponse } from "./DhtRpc";
|
|
2
2
|
import { ExternalStoreDataRequest } from "./DhtRpc";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { ExternalFindDataResponse } from "./DhtRpc";
|
|
4
|
+
import { ExternalFindDataRequest } from "./DhtRpc";
|
|
5
5
|
import { DisconnectNoticeResponse } from "./DhtRpc";
|
|
6
6
|
import { DisconnectNotice } from "./DhtRpc";
|
|
7
7
|
import { UnlockRequest } from "./DhtRpc";
|
|
@@ -10,10 +10,10 @@ import { LockRequest } from "./DhtRpc";
|
|
|
10
10
|
import { IceCandidate } from "./DhtRpc";
|
|
11
11
|
import { RtcAnswer } from "./DhtRpc";
|
|
12
12
|
import { RtcOffer } from "./DhtRpc";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
13
|
+
import { WebrtcConnectionRequest } from "./DhtRpc";
|
|
14
|
+
import { WebsocketConnectionResponse } from "./DhtRpc";
|
|
15
|
+
import { WebsocketConnectionRequest } from "./DhtRpc";
|
|
16
|
+
import { FindResponse } from "./DhtRpc";
|
|
17
17
|
import { DeleteDataResponse } from "./DhtRpc";
|
|
18
18
|
import { DeleteDataRequest } from "./DhtRpc";
|
|
19
19
|
import { MigrateDataResponse } from "./DhtRpc";
|
|
@@ -30,9 +30,9 @@ import { ClosestPeersResponse } from "./DhtRpc";
|
|
|
30
30
|
import { ClosestPeersRequest } from "./DhtRpc";
|
|
31
31
|
import { ServerCallContext } from "@protobuf-ts/runtime-rpc";
|
|
32
32
|
/**
|
|
33
|
-
* @generated from protobuf service dht.
|
|
33
|
+
* @generated from protobuf service dht.DhtNodeRpc
|
|
34
34
|
*/
|
|
35
|
-
export interface
|
|
35
|
+
export interface IDhtNodeRpc<T = ServerCallContext> {
|
|
36
36
|
/**
|
|
37
37
|
* @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse);
|
|
38
38
|
*/
|
|
@@ -47,9 +47,9 @@ export interface IDhtRpcService<T = ServerCallContext> {
|
|
|
47
47
|
leaveNotice(request: LeaveNotice, context: T): Promise<Empty>;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* @generated from protobuf service dht.
|
|
50
|
+
* @generated from protobuf service dht.RouterRpc
|
|
51
51
|
*/
|
|
52
|
-
export interface
|
|
52
|
+
export interface IRouterRpc<T = ServerCallContext> {
|
|
53
53
|
/**
|
|
54
54
|
* @generated from protobuf rpc: routeMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
|
|
55
55
|
*/
|
|
@@ -58,15 +58,20 @@ export interface IRoutingService<T = ServerCallContext> {
|
|
|
58
58
|
* @generated from protobuf rpc: forwardMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
|
|
59
59
|
*/
|
|
60
60
|
forwardMessage(request: RouteMessageWrapper, context: T): Promise<RouteMessageAck>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @generated from protobuf service dht.FindRpc
|
|
64
|
+
*/
|
|
65
|
+
export interface IFindRpc<T = ServerCallContext> {
|
|
61
66
|
/**
|
|
62
|
-
* @generated from protobuf rpc:
|
|
67
|
+
* @generated from protobuf rpc: routeFindRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
|
|
63
68
|
*/
|
|
64
|
-
|
|
69
|
+
routeFindRequest(request: RouteMessageWrapper, context: T): Promise<RouteMessageAck>;
|
|
65
70
|
}
|
|
66
71
|
/**
|
|
67
|
-
* @generated from protobuf service dht.
|
|
72
|
+
* @generated from protobuf service dht.StoreRpc
|
|
68
73
|
*/
|
|
69
|
-
export interface
|
|
74
|
+
export interface IStoreRpc<T = ServerCallContext> {
|
|
70
75
|
/**
|
|
71
76
|
* @generated from protobuf rpc: storeData(dht.StoreDataRequest) returns (dht.StoreDataResponse);
|
|
72
77
|
*/
|
|
@@ -81,31 +86,31 @@ export interface IStoreService<T = ServerCallContext> {
|
|
|
81
86
|
deleteData(request: DeleteDataRequest, context: T): Promise<DeleteDataResponse>;
|
|
82
87
|
}
|
|
83
88
|
/**
|
|
84
|
-
* @generated from protobuf service dht.
|
|
89
|
+
* @generated from protobuf service dht.FindSessionRpc
|
|
85
90
|
*/
|
|
86
|
-
export interface
|
|
91
|
+
export interface IFindSessionRpc<T = ServerCallContext> {
|
|
87
92
|
/**
|
|
88
|
-
* @generated from protobuf rpc:
|
|
93
|
+
* @generated from protobuf rpc: sendFindResponse(dht.FindResponse) returns (google.protobuf.Empty);
|
|
89
94
|
*/
|
|
90
|
-
|
|
95
|
+
sendFindResponse(request: FindResponse, context: T): Promise<Empty>;
|
|
91
96
|
}
|
|
92
97
|
/**
|
|
93
|
-
* @generated from protobuf service dht.
|
|
98
|
+
* @generated from protobuf service dht.WebsocketConnectorRpc
|
|
94
99
|
*/
|
|
95
|
-
export interface
|
|
100
|
+
export interface IWebsocketConnectorRpc<T = ServerCallContext> {
|
|
96
101
|
/**
|
|
97
|
-
* @generated from protobuf rpc: requestConnection(dht.
|
|
102
|
+
* @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (dht.WebsocketConnectionResponse);
|
|
98
103
|
*/
|
|
99
|
-
requestConnection(request:
|
|
104
|
+
requestConnection(request: WebsocketConnectionRequest, context: T): Promise<WebsocketConnectionResponse>;
|
|
100
105
|
}
|
|
101
106
|
/**
|
|
102
|
-
* @generated from protobuf service dht.
|
|
107
|
+
* @generated from protobuf service dht.WebrtcConnectorRpc
|
|
103
108
|
*/
|
|
104
|
-
export interface
|
|
109
|
+
export interface IWebrtcConnectorRpc<T = ServerCallContext> {
|
|
105
110
|
/**
|
|
106
|
-
* @generated from protobuf rpc: requestConnection(dht.
|
|
111
|
+
* @generated from protobuf rpc: requestConnection(dht.WebrtcConnectionRequest) returns (google.protobuf.Empty);
|
|
107
112
|
*/
|
|
108
|
-
requestConnection(request:
|
|
113
|
+
requestConnection(request: WebrtcConnectionRequest, context: T): Promise<Empty>;
|
|
109
114
|
/**
|
|
110
115
|
* @generated from protobuf rpc: rtcOffer(dht.RtcOffer) returns (google.protobuf.Empty);
|
|
111
116
|
*/
|
|
@@ -120,9 +125,9 @@ export interface IWebRtcConnectorService<T = ServerCallContext> {
|
|
|
120
125
|
iceCandidate(request: IceCandidate, context: T): Promise<Empty>;
|
|
121
126
|
}
|
|
122
127
|
/**
|
|
123
|
-
* @generated from protobuf service dht.
|
|
128
|
+
* @generated from protobuf service dht.ConnectionLockRpc
|
|
124
129
|
*/
|
|
125
|
-
export interface
|
|
130
|
+
export interface IConnectionLockRpc<T = ServerCallContext> {
|
|
126
131
|
/**
|
|
127
132
|
* @generated from protobuf rpc: lockRequest(dht.LockRequest) returns (dht.LockResponse);
|
|
128
133
|
*/
|
|
@@ -137,13 +142,13 @@ export interface IConnectionLocker<T = ServerCallContext> {
|
|
|
137
142
|
gracefulDisconnect(request: DisconnectNotice, context: T): Promise<DisconnectNoticeResponse>;
|
|
138
143
|
}
|
|
139
144
|
/**
|
|
140
|
-
* @generated from protobuf service dht.
|
|
145
|
+
* @generated from protobuf service dht.ExternalApiRpc
|
|
141
146
|
*/
|
|
142
|
-
export interface
|
|
147
|
+
export interface IExternalApiRpc<T = ServerCallContext> {
|
|
143
148
|
/**
|
|
144
|
-
* @generated from protobuf rpc:
|
|
149
|
+
* @generated from protobuf rpc: externalFindData(dht.ExternalFindDataRequest) returns (dht.ExternalFindDataResponse);
|
|
145
150
|
*/
|
|
146
|
-
|
|
151
|
+
externalFindData(request: ExternalFindDataRequest, context: T): Promise<ExternalFindDataResponse>;
|
|
147
152
|
/**
|
|
148
153
|
* @generated from protobuf rpc: externalStoreData(dht.ExternalStoreDataRequest) returns (dht.ExternalStoreDataResponse);
|
|
149
154
|
*/
|
|
@@ -75,7 +75,7 @@ const measureJoiningTime = async () => {
|
|
|
75
75
|
}, 1000);
|
|
76
76
|
// get random node from network to use as entrypoint
|
|
77
77
|
const randomNode = nodes[Math.floor(Math.random() * nodes.length)];
|
|
78
|
-
const streamSubscriber = (0, utils_2.createNetworkNodeWithSimulator)(peerDescriptor, simulator, [randomNode.stack.getLayer0Node().
|
|
78
|
+
const streamSubscriber = (0, utils_2.createNetworkNodeWithSimulator)(peerDescriptor, simulator, [randomNode.stack.getLayer0Node().getLocalPeerDescriptor()]);
|
|
79
79
|
currentNode = streamSubscriber;
|
|
80
80
|
const start = performance.now();
|
|
81
81
|
await streamSubscriber.start();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-message.js","sourceRoot":"","sources":["../../../test/benchmark/first-message.ts"],"names":[],"mappings":";AAAA,+BAA+B;;;;;AAE/B,sCAA+E;AAC/E,gDAA4I;AAC5I,0CAAyE;AACzE,4CAAmB;AAGnB,uDAAmE;AACnE,6EAA2E;AAC3E,0CAAyF;AAIzF,MAAM,QAAQ,GAAG,KAAK,CAAA;AAEtB,IAAI,KAAoB,CAAA;AACxB,IAAI,SAAoB,CAAA;AACxB,IAAI,QAAwB,CAAA;AAC5B,MAAM,gBAAgB,GAAqB,EAAE,CAAA;AAC7C,MAAM,WAAW,GAAmC,IAAI,GAAG,EAAE,CAAA;AAC7D,IAAI,WAAwB,CAAA;AAC5B,IAAI,eAA2C,CAAA;AAC/C,IAAI,CAAC,GAAG,CAAC,CAAA;AAET,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE;IAC7B,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;IAChC,KAAK,GAAG,EAAE,CAAA;IACV,SAAS,GAAG,IAAI,eAAS,CAAC,iBAAW,CAAC,IAAI,CAAC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AAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAA;IAC5D,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAA;IAC3D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAA;IACpC,IAAI,eAAe,EAAE;QACjB,aAAa,CAAC,eAAe,CAAC,CAAA;KACjC;AACL,CAAC,CAAC,CAAA"}
|
|
@@ -9,7 +9,7 @@ import { StreamPartID } from '@streamr/protocol';
|
|
|
9
9
|
import { NodeID } from '../../src/identifiers';
|
|
10
10
|
import { Layer1Node } from '../../src/logic/Layer1Node';
|
|
11
11
|
export declare const mockConnectionLocker: ConnectionLocker;
|
|
12
|
-
export declare const createMockRandomGraphNodeAndDhtNode: (
|
|
12
|
+
export declare const createMockRandomGraphNodeAndDhtNode: (localPeerDescriptor: PeerDescriptor, entryPointDescriptor: PeerDescriptor, streamPartId: StreamPartID, simulator: Simulator) => Promise<[Layer1Node, RandomGraphNode]>;
|
|
13
13
|
export declare const createStreamMessage: (content: string, streamPartId: StreamPartID, publisherId: EthereumAddress, timestamp?: number, sequenceNumber?: number) => StreamMessage;
|
|
14
14
|
export declare const createRandomNodeId: () => NodeID;
|
|
15
15
|
export declare const createMockPeerDescriptor: (opts?: Omit<Partial<PeerDescriptor>, 'kademliaId' | 'type'>) => PeerDescriptor;
|
package/dist/test/utils/utils.js
CHANGED
|
@@ -16,21 +16,23 @@ exports.mockConnectionLocker = {
|
|
|
16
16
|
weakLockConnection: () => { },
|
|
17
17
|
weakUnlockConnection: () => { }
|
|
18
18
|
};
|
|
19
|
-
const createMockRandomGraphNodeAndDhtNode = async (
|
|
20
|
-
const mockCm = new dht_1.SimulatorTransport(
|
|
19
|
+
const createMockRandomGraphNodeAndDhtNode = async (localPeerDescriptor, entryPointDescriptor, streamPartId, simulator) => {
|
|
20
|
+
const mockCm = new dht_1.SimulatorTransport(localPeerDescriptor, simulator);
|
|
21
21
|
await mockCm.start();
|
|
22
22
|
const layer1Node = new dht_1.DhtNode({
|
|
23
23
|
transport: mockCm,
|
|
24
|
-
peerDescriptor:
|
|
24
|
+
peerDescriptor: localPeerDescriptor,
|
|
25
25
|
numberOfNodesPerKBucket: 4,
|
|
26
|
-
entryPoints: [entryPointDescriptor]
|
|
26
|
+
entryPoints: [entryPointDescriptor],
|
|
27
|
+
rpcRequestTimeout: 5000
|
|
27
28
|
});
|
|
28
29
|
const randomGraphNode = (0, createRandomGraphNode_1.createRandomGraphNode)({
|
|
29
30
|
streamPartId,
|
|
30
31
|
transport: mockCm,
|
|
31
32
|
layer1Node,
|
|
32
33
|
connectionLocker: mockCm,
|
|
33
|
-
|
|
34
|
+
localPeerDescriptor,
|
|
35
|
+
rpcRequestTimeout: 5000
|
|
34
36
|
});
|
|
35
37
|
return [layer1Node, randomGraphNode];
|
|
36
38
|
};
|
|
@@ -39,8 +41,8 @@ const createStreamMessage = (content, streamPartId, publisherId, timestamp, sequ
|
|
|
39
41
|
const messageId = {
|
|
40
42
|
streamId: protocol_1.StreamPartIDUtils.getStreamID(streamPartId),
|
|
41
43
|
streamPartition: protocol_1.StreamPartIDUtils.getStreamPartition(streamPartId),
|
|
42
|
-
sequenceNumber: sequenceNumber
|
|
43
|
-
timestamp: timestamp
|
|
44
|
+
sequenceNumber: sequenceNumber ?? 0,
|
|
45
|
+
timestamp: timestamp ?? Date.now(),
|
|
44
46
|
publisherId: (0, utils_1.hexToBinary)(publisherId),
|
|
45
47
|
messageChainId: 'messageChain0',
|
|
46
48
|
};
|
|
@@ -63,12 +65,13 @@ const createMockPeerDescriptor = (opts) => {
|
|
|
63
65
|
return {
|
|
64
66
|
...opts,
|
|
65
67
|
kademliaId: (0, utils_1.hexToBinary)((0, exports.createRandomNodeId)()),
|
|
66
|
-
type: dht_1.NodeType.NODEJS
|
|
68
|
+
type: dht_1.NodeType.NODEJS,
|
|
69
|
+
region: (0, dht_1.getRandomRegion)()
|
|
67
70
|
};
|
|
68
71
|
};
|
|
69
72
|
exports.createMockPeerDescriptor = createMockPeerDescriptor;
|
|
70
73
|
const createMockDeliveryRpcRemote = (remotePeerDescriptor) => {
|
|
71
|
-
return new DeliveryRpcRemote_1.DeliveryRpcRemote((0, exports.createMockPeerDescriptor)(), remotePeerDescriptor
|
|
74
|
+
return new DeliveryRpcRemote_1.DeliveryRpcRemote((0, exports.createMockPeerDescriptor)(), remotePeerDescriptor ?? (0, exports.createMockPeerDescriptor)(), 'mock', {});
|
|
72
75
|
};
|
|
73
76
|
exports.createMockDeliveryRpcRemote = createMockDeliveryRpcRemote;
|
|
74
77
|
const createMockHandshakeRpcRemote = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../test/utils/utils.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../test/utils/utils.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AACpC,sCAAkI;AAElI,+FAMuE;AACvE,yEAAqE;AACrE,iFAA6E;AAC7E,8FAA0F;AAC1F,uDAAsE;AACtE,0CAA2E;AAC3E,gDAAmE;AAItD,QAAA,oBAAoB,GAAqB;IAClD,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;IACxB,gBAAgB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC1B,kBAAkB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC5B,oBAAoB,EAAE,GAAG,EAAE,GAAE,CAAC;CACjC,CAAA;AAEM,MAAM,mCAAmC,GAAG,KAAK,EACpD,mBAAmC,EACnC,oBAAoC,EACpC,YAA0B,EAC1B,SAAoB,EACoB,EAAE;IAC1C,MAAM,MAAM,GAAG,IAAI,wBAAkB,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAA;IACrE,MAAM,MAAM,CAAC,KAAK,EAA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Ac,EAAE,EAAE;YAClB,eAAe,EAAE,MAAM;YACvB,WAAW,EAAE,MAAM;SACtB;KACJ,CAAC,CAAA;AACN,CAAC,CAAA;AAhBY,QAAA,8BAA8B,kCAgB1C"}
|
package/karma.config.js
CHANGED
|
@@ -12,8 +12,8 @@ module.exports = createKarmaConfig(TEST_PATHS, createWebpackConfig({
|
|
|
12
12
|
entry: './src/exports.ts',
|
|
13
13
|
libraryName: 'trackerless-network',
|
|
14
14
|
alias: {
|
|
15
|
-
[path.resolve(__dirname, '../dht/src/connection/
|
|
16
|
-
path.resolve(__dirname, '../dht/src/connection/
|
|
15
|
+
[path.resolve(__dirname, '../dht/src/connection/webrtc/NodeWebrtcConnection.ts')]:
|
|
16
|
+
path.resolve(__dirname, '../dht/src/connection/webrtc/BrowserWebrtcConnection.ts'),
|
|
17
17
|
'@streamr/dht': path.resolve('../dht/src/exports.ts'),
|
|
18
18
|
'@streamr/proto-rpc': path.resolve('../proto-rpc/src/exports.ts'),
|
|
19
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamr/trackerless-network",
|
|
3
|
-
"version": "100.0.0-pretestnet.
|
|
3
|
+
"version": "100.0.0-pretestnet.4",
|
|
4
4
|
"description": "Minimal and extendable implementation of the Streamr Network node.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@protobuf-ts/runtime": "^2.8.2",
|
|
32
32
|
"@protobuf-ts/runtime-rpc": "^2.8.2",
|
|
33
|
-
"@streamr/dht": "100.0.0-pretestnet.
|
|
34
|
-
"@streamr/proto-rpc": "100.0.0-pretestnet.
|
|
35
|
-
"@streamr/protocol": "100.0.0-pretestnet.
|
|
36
|
-
"@streamr/test-utils": "100.0.0-pretestnet.
|
|
37
|
-
"@streamr/utils": "100.0.0-pretestnet.
|
|
33
|
+
"@streamr/dht": "100.0.0-pretestnet.4",
|
|
34
|
+
"@streamr/proto-rpc": "100.0.0-pretestnet.4",
|
|
35
|
+
"@streamr/protocol": "100.0.0-pretestnet.4",
|
|
36
|
+
"@streamr/test-utils": "100.0.0-pretestnet.4",
|
|
37
|
+
"@streamr/utils": "100.0.0-pretestnet.4",
|
|
38
38
|
"eventemitter3": "^5.0.0",
|
|
39
39
|
"lodash": "^4.17.21",
|
|
40
40
|
"uuid": "^9.0.1",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@streamr/browser-test-runner": "^0.0.1",
|
|
45
|
-
"@types/lodash": "^4.14.
|
|
46
|
-
"@types/uuid": "^9.0.
|
|
45
|
+
"@types/lodash": "^4.14.201",
|
|
46
|
+
"@types/uuid": "^9.0.7",
|
|
47
47
|
"@types/yallist": "^4.0.1",
|
|
48
48
|
"commander": "^11.1.0",
|
|
49
49
|
"expect": "^29.6.2",
|
package/src/NetworkNode.ts
CHANGED
|
@@ -81,11 +81,11 @@ export class NetworkNode {
|
|
|
81
81
|
pull(this.messageListeners, cb)
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
leave(streamPartId: StreamPartID): void {
|
|
84
|
+
async leave(streamPartId: StreamPartID): Promise<void> {
|
|
85
85
|
if (this.stopped) {
|
|
86
86
|
return
|
|
87
87
|
}
|
|
88
|
-
this.stack.getStreamrNode().leaveStreamPart(streamPartId)
|
|
88
|
+
await this.stack.getStreamrNode().leaveStreamPart(streamPartId)
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
getNeighbors(streamPartId: StreamPartID): ReadonlyArray<NodeID> {
|
|
@@ -102,7 +102,7 @@ export class NetworkNode {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
getPeerDescriptor(): PeerDescriptor {
|
|
105
|
-
return this.stack.getLayer0Node().
|
|
105
|
+
return this.stack.getLayer0Node().getLocalPeerDescriptor()
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
getMetricsContext(): MetricsContext {
|
package/src/NetworkStack.ts
CHANGED
|
@@ -66,7 +66,7 @@ export class NetworkStack extends EventEmitter<NetworkStackEvents> {
|
|
|
66
66
|
await this.layer0Node!.start()
|
|
67
67
|
const connectionManager = this.layer0Node!.getTransport() as ConnectionManager
|
|
68
68
|
if ((this.options.layer0?.entryPoints !== undefined) && (this.options.layer0.entryPoints.some((entryPoint) =>
|
|
69
|
-
areEqualPeerDescriptors(entryPoint, this.layer0Node!.
|
|
69
|
+
areEqualPeerDescriptors(entryPoint, this.layer0Node!.getLocalPeerDescriptor())
|
|
70
70
|
))) {
|
|
71
71
|
await this.layer0Node?.joinDht(this.options.layer0.entryPoints)
|
|
72
72
|
} else {
|
|
@@ -107,6 +107,7 @@ export class NetworkStack extends EventEmitter<NetworkStackEvents> {
|
|
|
107
107
|
|
|
108
108
|
async stop(): Promise<void> {
|
|
109
109
|
await this.streamrNode!.destroy()
|
|
110
|
+
await this.layer0Node!.stop()
|
|
110
111
|
this.streamrNode = undefined
|
|
111
112
|
this.layer0Node = undefined
|
|
112
113
|
this.emit('stopped')
|
|
@@ -12,7 +12,7 @@ import { NodeID, getNodeIdFromPeerDescriptor } from '../identifiers'
|
|
|
12
12
|
import { StreamPartID } from '@streamr/protocol'
|
|
13
13
|
|
|
14
14
|
export interface DeliveryRpcLocalConfig {
|
|
15
|
-
|
|
15
|
+
localPeerDescriptor: PeerDescriptor
|
|
16
16
|
streamPartId: StreamPartID
|
|
17
17
|
markAndCheckDuplicate: (messageId: MessageID, previousMessageRef?: MessageRef) => boolean
|
|
18
18
|
broadcast: (message: StreamMessage, previousNode?: NodeID) => void
|
|
@@ -56,7 +56,7 @@ export const NETWORK_SPLIT_AVOIDANCE_LIMIT = 4
|
|
|
56
56
|
|
|
57
57
|
interface EntryPointDiscoveryConfig {
|
|
58
58
|
streamPartId: StreamPartID
|
|
59
|
-
|
|
59
|
+
localPeerDescriptor: PeerDescriptor
|
|
60
60
|
layer1Node: Layer1Node
|
|
61
61
|
getEntryPointData: (key: Uint8Array) => Promise<DataEntry[]>
|
|
62
62
|
storeEntryPointData: (key: Uint8Array, data: Any) => Promise<PeerDescriptor[]>
|
|
@@ -87,7 +87,7 @@ export class EntryPointDiscovery {
|
|
|
87
87
|
}
|
|
88
88
|
const discoveredEntryPoints = await this.discoverEntryPoints()
|
|
89
89
|
if (discoveredEntryPoints.length === 0) {
|
|
90
|
-
discoveredEntryPoints.push(this.config.
|
|
90
|
+
discoveredEntryPoints.push(this.config.localPeerDescriptor)
|
|
91
91
|
}
|
|
92
92
|
return {
|
|
93
93
|
discoveredEntryPoints,
|
|
@@ -109,7 +109,7 @@ export class EntryPointDiscovery {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
private async queryEntrypoints(key: Uint8Array): Promise<PeerDescriptor[]> {
|
|
112
|
-
logger.trace(`Finding data from dht node ${getNodeIdFromPeerDescriptor(this.config.
|
|
112
|
+
logger.trace(`Finding data from dht node ${getNodeIdFromPeerDescriptor(this.config.localPeerDescriptor)}`)
|
|
113
113
|
try {
|
|
114
114
|
const result = await this.config.getEntryPointData(key)
|
|
115
115
|
return parseEntryPointData(result)
|
|
@@ -133,8 +133,8 @@ export class EntryPointDiscovery {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
private async storeSelfAsEntryPoint(): Promise<void> {
|
|
136
|
-
const
|
|
137
|
-
const dataToStore = Any.pack(
|
|
136
|
+
const localPeerDescriptor = this.config.localPeerDescriptor
|
|
137
|
+
const dataToStore = Any.pack(localPeerDescriptor, PeerDescriptor)
|
|
138
138
|
try {
|
|
139
139
|
await this.config.storeEntryPointData(streamPartIdToDataKey(this.config.streamPartId), dataToStore)
|
|
140
140
|
} catch (err) {
|
|
@@ -148,7 +148,7 @@ export class EntryPointDiscovery {
|
|
|
148
148
|
try {
|
|
149
149
|
const discovered = await this.discoverEntryPoints()
|
|
150
150
|
if (discovered.length < ENTRYPOINT_STORE_LIMIT
|
|
151
|
-
|| discovered.some((peerDescriptor) => areEqualPeerDescriptors(peerDescriptor, this.config.
|
|
151
|
+
|| discovered.some((peerDescriptor) => areEqualPeerDescriptors(peerDescriptor, this.config.localPeerDescriptor))) {
|
|
152
152
|
await this.storeSelfAsEntryPoint()
|
|
153
153
|
}
|
|
154
154
|
} catch (err) {
|
package/src/logic/Layer0Node.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Any } from '../proto/google/protobuf/any'
|
|
|
4
4
|
export interface Layer0Node extends ITransport {
|
|
5
5
|
joinDht(entryPointDescriptors: PeerDescriptor[]): Promise<void>
|
|
6
6
|
hasJoined(): boolean
|
|
7
|
-
|
|
7
|
+
getLocalPeerDescriptor(): PeerDescriptor
|
|
8
8
|
getDataFromDht(key: Uint8Array): Promise<DataEntry[]>
|
|
9
9
|
storeDataToDht(key: Uint8Array, data: Any): Promise<PeerDescriptor[]>
|
|
10
10
|
deleteDataFromDht(key: Uint8Array): Promise<void>
|
package/src/logic/Layer1Node.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface Layer1Node {
|
|
|
11
11
|
on<T extends keyof Layer1NodeEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor, peers: PeerDescriptor[]) => void): void
|
|
12
12
|
once<T extends keyof Layer1NodeEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor, peers: PeerDescriptor[]) => void): void
|
|
13
13
|
off<T extends keyof Layer1NodeEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor, peers: PeerDescriptor[]) => void): void
|
|
14
|
-
removeContact: (peerDescriptor: PeerDescriptor
|
|
14
|
+
removeContact: (peerDescriptor: PeerDescriptor) => void
|
|
15
15
|
getClosestContacts: (maxCount?: number) => PeerDescriptor[]
|
|
16
16
|
getKBucketPeers: () => PeerDescriptor[]
|
|
17
17
|
getBucketSize: () => number
|
|
@@ -43,7 +43,7 @@ export interface StrictRandomGraphNodeConfig {
|
|
|
43
43
|
layer1Node: Layer1Node
|
|
44
44
|
transport: ITransport
|
|
45
45
|
connectionLocker: ConnectionLocker
|
|
46
|
-
|
|
46
|
+
localPeerDescriptor: PeerDescriptor
|
|
47
47
|
nodeViewSize: number
|
|
48
48
|
nearbyNodeView: NodeList
|
|
49
49
|
randomNodeView: NodeList
|
|
@@ -57,6 +57,7 @@ export interface StrictRandomGraphNodeConfig {
|
|
|
57
57
|
inspector: IInspector
|
|
58
58
|
temporaryConnectionRpcLocal: TemporaryConnectionRpcLocal
|
|
59
59
|
proxyConnectionRpcLocal?: ProxyConnectionRpcLocal
|
|
60
|
+
rpcRequestTimeout?: number
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
const logger = new Logger(module)
|
|
@@ -74,7 +75,7 @@ export class RandomGraphNode extends EventEmitter<Events> {
|
|
|
74
75
|
this.config = config
|
|
75
76
|
this.duplicateDetectors = new Map()
|
|
76
77
|
this.deliveryRpcLocal = new DeliveryRpcLocal({
|
|
77
|
-
|
|
78
|
+
localPeerDescriptor: this.config.localPeerDescriptor,
|
|
78
79
|
streamPartId: this.config.streamPartId,
|
|
79
80
|
rpcCommunicator: this.config.rpcCommunicator,
|
|
80
81
|
markAndCheckDuplicate: (msg: MessageID, prev?: MessageRef) => markAndCheckDuplicate(this.duplicateDetectors, msg, prev),
|
|
@@ -86,7 +87,7 @@ export class RandomGraphNode extends EventEmitter<Events> {
|
|
|
86
87
|
|| this.config.proxyConnectionRpcLocal?.getConnection(senderId )?.remote
|
|
87
88
|
// TODO: check integrity of notifier?
|
|
88
89
|
if (contact) {
|
|
89
|
-
this.config.layer1Node.removeContact(contact.getPeerDescriptor()
|
|
90
|
+
this.config.layer1Node.removeContact(contact.getPeerDescriptor())
|
|
90
91
|
this.config.targetNeighbors.remove(contact.getPeerDescriptor())
|
|
91
92
|
this.config.nearbyNodeView.remove(contact.getPeerDescriptor())
|
|
92
93
|
this.config.connectionLocker.unlockConnection(contact.getPeerDescriptor(), this.config.streamPartId)
|
|
@@ -187,10 +188,11 @@ export class RandomGraphNode extends EventEmitter<Events> {
|
|
|
187
188
|
private updateNearbyNodeView(nodes: PeerDescriptor[]) {
|
|
188
189
|
this.config.nearbyNodeView.replaceAll(Array.from(nodes).map((descriptor) =>
|
|
189
190
|
new DeliveryRpcRemote(
|
|
190
|
-
this.config.
|
|
191
|
+
this.config.localPeerDescriptor,
|
|
191
192
|
descriptor,
|
|
192
193
|
this.config.streamPartId,
|
|
193
|
-
toProtoRpcClient(new DeliveryRpcClient(this.config.rpcCommunicator.getRpcClientTransport()))
|
|
194
|
+
toProtoRpcClient(new DeliveryRpcClient(this.config.rpcCommunicator.getRpcClientTransport())),
|
|
195
|
+
this.config.rpcRequestTimeout
|
|
194
196
|
)
|
|
195
197
|
))
|
|
196
198
|
for (const descriptor of this.config.layer1Node.getKBucketPeers()) {
|
|
@@ -199,10 +201,12 @@ export class RandomGraphNode extends EventEmitter<Events> {
|
|
|
199
201
|
}
|
|
200
202
|
this.config.nearbyNodeView.add(
|
|
201
203
|
new DeliveryRpcRemote(
|
|
202
|
-
this.config.
|
|
204
|
+
this.config.localPeerDescriptor,
|
|
203
205
|
descriptor,
|
|
204
206
|
this.config.streamPartId,
|
|
205
|
-
toProtoRpcClient(new DeliveryRpcClient(this.config.rpcCommunicator.getRpcClientTransport()))
|
|
207
|
+
toProtoRpcClient(new DeliveryRpcClient(this.config.rpcCommunicator.getRpcClientTransport())),
|
|
208
|
+
this.config.rpcRequestTimeout
|
|
209
|
+
|
|
206
210
|
)
|
|
207
211
|
)
|
|
208
212
|
}
|
|
@@ -214,10 +218,11 @@ export class RandomGraphNode extends EventEmitter<Events> {
|
|
|
214
218
|
}
|
|
215
219
|
this.config.randomNodeView.replaceAll(randomNodes.map((descriptor) =>
|
|
216
220
|
new DeliveryRpcRemote(
|
|
217
|
-
this.config.
|
|
221
|
+
this.config.localPeerDescriptor,
|
|
218
222
|
descriptor,
|
|
219
223
|
this.config.streamPartId,
|
|
220
|
-
toProtoRpcClient(new DeliveryRpcClient(this.config.rpcCommunicator.getRpcClientTransport()))
|
|
224
|
+
toProtoRpcClient(new DeliveryRpcClient(this.config.rpcCommunicator.getRpcClientTransport())),
|
|
225
|
+
this.config.rpcRequestTimeout
|
|
221
226
|
)
|
|
222
227
|
))
|
|
223
228
|
if (this.config.targetNeighbors.size() < this.config.numOfTargetNeighbors) {
|
|
@@ -232,10 +237,11 @@ export class RandomGraphNode extends EventEmitter<Events> {
|
|
|
232
237
|
}
|
|
233
238
|
this.config.randomNodeView.replaceAll(randomNodes.map((descriptor) =>
|
|
234
239
|
new DeliveryRpcRemote(
|
|
235
|
-
this.config.
|
|
240
|
+
this.config.localPeerDescriptor,
|
|
236
241
|
descriptor,
|
|
237
242
|
this.config.streamPartId,
|
|
238
|
-
toProtoRpcClient(new DeliveryRpcClient(this.config.rpcCommunicator.getRpcClientTransport()))
|
|
243
|
+
toProtoRpcClient(new DeliveryRpcClient(this.config.rpcCommunicator.getRpcClientTransport())),
|
|
244
|
+
this.config.rpcRequestTimeout
|
|
239
245
|
)
|
|
240
246
|
))
|
|
241
247
|
}
|
|
@@ -307,7 +313,7 @@ export class RandomGraphNode extends EventEmitter<Events> {
|
|
|
307
313
|
}
|
|
308
314
|
|
|
309
315
|
getOwnNodeId(): NodeID {
|
|
310
|
-
return getNodeIdFromPeerDescriptor(this.config.
|
|
316
|
+
return getNodeIdFromPeerDescriptor(this.config.localPeerDescriptor)
|
|
311
317
|
}
|
|
312
318
|
|
|
313
319
|
getNumberOfOutgoingHandshakes(): number {
|