@streamr/trackerless-network 100.0.0-testnet-two.1 → 100.0.0-testnet-two.2
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.d.ts +3 -4
- package/dist/src/NetworkNode.js.map +1 -1
- package/dist/src/exports.d.ts +0 -1
- package/dist/src/exports.js.map +1 -1
- package/dist/src/logic/DeliveryRpcLocal.d.ts +4 -5
- package/dist/src/logic/DeliveryRpcLocal.js +3 -3
- package/dist/src/logic/DeliveryRpcLocal.js.map +1 -1
- package/dist/src/logic/DeliveryRpcRemote.d.ts +2 -1
- package/dist/src/logic/DeliveryRpcRemote.js +2 -2
- package/dist/src/logic/DeliveryRpcRemote.js.map +1 -1
- package/dist/src/logic/EntryPointDiscovery.d.ts +5 -5
- package/dist/src/logic/EntryPointDiscovery.js +4 -5
- package/dist/src/logic/EntryPointDiscovery.js.map +1 -1
- package/dist/src/logic/Layer0Node.d.ts +4 -4
- package/dist/src/logic/NodeList.d.ts +12 -13
- package/dist/src/logic/NodeList.js +4 -4
- package/dist/src/logic/NodeList.js.map +1 -1
- package/dist/src/logic/RandomGraphNode.d.ts +6 -7
- package/dist/src/logic/RandomGraphNode.js +9 -9
- package/dist/src/logic/RandomGraphNode.js.map +1 -1
- package/dist/src/logic/StreamrNode.d.ts +3 -4
- package/dist/src/logic/StreamrNode.js +2 -3
- package/dist/src/logic/StreamrNode.js.map +1 -1
- package/dist/src/logic/createRandomGraphNode.js +1 -3
- package/dist/src/logic/createRandomGraphNode.js.map +1 -1
- package/dist/src/logic/inspect/InspectSession.d.ts +3 -3
- package/dist/src/logic/inspect/InspectSession.js.map +1 -1
- package/dist/src/logic/inspect/Inspector.d.ts +3 -4
- package/dist/src/logic/inspect/Inspector.js +3 -3
- package/dist/src/logic/inspect/Inspector.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.d.ts +4 -5
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js +10 -10
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.d.ts +3 -3
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js +7 -8
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/Handshaker.d.ts +3 -4
- package/dist/src/logic/neighbor-discovery/Handshaker.js +12 -12
- package/dist/src/logic/neighbor-discovery/Handshaker.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborFinder.d.ts +3 -3
- package/dist/src/logic/neighbor-discovery/NeighborFinder.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js +4 -4
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js +5 -5
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.d.ts +2 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.js +3 -4
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.js.map +1 -1
- package/dist/src/logic/propagation/Propagation.d.ts +4 -4
- package/dist/src/logic/propagation/Propagation.js.map +1 -1
- package/dist/src/logic/propagation/PropagationTaskStore.d.ts +2 -2
- package/dist/src/logic/proxy/ProxyClient.d.ts +3 -4
- package/dist/src/logic/proxy/ProxyClient.js +8 -9
- package/dist/src/logic/proxy/ProxyClient.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.d.ts +6 -7
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js +4 -4
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.d.ts +0 -2
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js +3 -3
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js +1 -2
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js.map +1 -1
- package/dist/test/benchmark/first-message.js +2 -3
- package/dist/test/benchmark/first-message.js.map +1 -1
- package/dist/test/utils/utils.d.ts +2 -3
- 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 +3 -4
- package/src/exports.ts +0 -1
- package/src/logic/DeliveryRpcLocal.ts +4 -5
- package/src/logic/DeliveryRpcRemote.ts +3 -2
- package/src/logic/EntryPointDiscovery.ts +11 -9
- package/src/logic/Layer0Node.ts +4 -4
- package/src/logic/NodeList.ts +15 -16
- package/src/logic/RandomGraphNode.ts +16 -17
- package/src/logic/StreamrNode.ts +6 -5
- package/src/logic/createRandomGraphNode.ts +2 -4
- package/src/logic/inspect/InspectSession.ts +4 -4
- package/src/logic/inspect/Inspector.ts +4 -6
- package/src/logic/neighbor-discovery/HandshakeRpcLocal.ts +17 -10
- package/src/logic/neighbor-discovery/HandshakeRpcRemote.ts +11 -10
- package/src/logic/neighbor-discovery/Handshaker.ts +14 -15
- package/src/logic/neighbor-discovery/NeighborFinder.ts +4 -4
- package/src/logic/neighbor-discovery/NeighborUpdateManager.ts +2 -4
- package/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts +1 -3
- package/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.ts +4 -4
- package/src/logic/propagation/Propagation.ts +6 -6
- package/src/logic/propagation/PropagationTaskStore.ts +2 -2
- package/src/logic/proxy/ProxyClient.ts +20 -21
- package/src/logic/proxy/ProxyConnectionRpcLocal.ts +10 -12
- package/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts +1 -5
- package/src/logic/temporary-connection/TemporaryConnectionRpcRemote.ts +1 -2
- package/test/benchmark/first-message.ts +2 -3
- package/test/end-to-end/proxy-connections.test.ts +2 -2
- package/test/end-to-end/webrtc-full-node-network.test.ts +1 -2
- package/test/end-to-end/websocket-full-node-network.test.ts +1 -1
- package/test/integration/DeliveryRpcRemote.test.ts +2 -5
- package/test/integration/HandshakeRpcRemote.test.ts +2 -2
- package/test/integration/Handshakes.test.ts +2 -6
- package/test/integration/NeighborUpdateRpcRemote.test.ts +1 -2
- package/test/unit/HandshakeRpcLocal.test.ts +9 -11
- package/test/unit/Handshaker.test.ts +1 -2
- package/test/unit/InspectSession.test.ts +3 -3
- package/test/unit/Inspector.test.ts +1 -2
- package/test/unit/NeighborFinder.test.ts +2 -2
- package/test/unit/NodeList.test.ts +12 -13
- package/test/unit/Propagation.test.ts +9 -9
- package/test/unit/ProxyConnectionRpcRemote.test.ts +0 -2
- package/test/unit/RandomGraphNode.test.ts +1 -1
- package/test/utils/mock/MockHandshaker.ts +3 -3
- package/test/utils/utils.ts +15 -7
- package/dist/src/identifiers.d.ts +0 -4
- package/dist/src/identifiers.js +0 -9
- package/dist/src/identifiers.js.map +0 -1
- package/src/identifiers.ts +0 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NeighborUpdateRpcLocal = void 0;
|
|
4
|
-
const
|
|
4
|
+
const dht_1 = require("@streamr/dht");
|
|
5
5
|
const NetworkRpc_client_1 = require("../../proto/packages/trackerless-network/protos/NetworkRpc.client");
|
|
6
6
|
const DeliveryRpcRemote_1 = require("../DeliveryRpcRemote");
|
|
7
7
|
class NeighborUpdateRpcLocal {
|
|
@@ -11,15 +11,15 @@ class NeighborUpdateRpcLocal {
|
|
|
11
11
|
// INeighborUpdateRpc server method
|
|
12
12
|
async neighborUpdate(message, context) {
|
|
13
13
|
const senderPeerDescriptor = context.incomingSourceDescriptor;
|
|
14
|
-
const senderId = (0,
|
|
14
|
+
const senderId = (0, dht_1.getNodeIdFromPeerDescriptor)(senderPeerDescriptor);
|
|
15
15
|
if (this.config.targetNeighbors.hasNodeById(senderId)) {
|
|
16
16
|
const newPeerDescriptors = message.neighborDescriptors
|
|
17
17
|
.filter((peerDescriptor) => {
|
|
18
|
-
const nodeId = (0,
|
|
19
|
-
const ownNodeId = (0,
|
|
18
|
+
const nodeId = (0, dht_1.getNodeIdFromPeerDescriptor)(peerDescriptor);
|
|
19
|
+
const ownNodeId = (0, dht_1.getNodeIdFromPeerDescriptor)(this.config.localPeerDescriptor);
|
|
20
20
|
return nodeId !== ownNodeId && !this.config.targetNeighbors.getIds().includes(nodeId);
|
|
21
21
|
});
|
|
22
|
-
newPeerDescriptors.forEach((peerDescriptor) => this.config.nearbyNodeView.add(new DeliveryRpcRemote_1.DeliveryRpcRemote(this.config.localPeerDescriptor, peerDescriptor, this.config.
|
|
22
|
+
newPeerDescriptors.forEach((peerDescriptor) => this.config.nearbyNodeView.add(new DeliveryRpcRemote_1.DeliveryRpcRemote(this.config.localPeerDescriptor, peerDescriptor, this.config.rpcCommunicator, NetworkRpc_client_1.DeliveryRpcClient)));
|
|
23
23
|
this.config.neighborFinder.start();
|
|
24
24
|
const response = {
|
|
25
25
|
streamPartId: this.config.streamPartId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeighborUpdateRpcLocal.js","sourceRoot":"","sources":["../../../../src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"NeighborUpdateRpcLocal.js","sourceRoot":"","sources":["../../../../src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts"],"names":[],"mappings":";;;AACA,sCAAoH;AAEpH,yGAAqG;AAGrG,4DAAwD;AAaxD,MAAa,sBAAsB;IAI/B,YAAY,MAAoC;QAC5C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;IAED,mCAAmC;IACnC,KAAK,CAAC,cAAc,CAAC,OAAuB,EA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,QAAQ,GAAmB;gBAC7B,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;gBACtC,mBAAmB,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC;gBACzG,QAAQ,EAAE,IAAI;aACjB,CAAA;YACD,OAAO,QAAQ,CAAA;SAClB;IACL,CAAC;CACJ;AA3CD,wDA2CC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { PeerDescriptor, RpcRemote } from '@streamr/dht';
|
|
2
2
|
import { NeighborUpdateRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client';
|
|
3
|
+
import { StreamPartID } from '@streamr/protocol';
|
|
3
4
|
interface UpdateNeighborsResponse {
|
|
4
5
|
peerDescriptors: PeerDescriptor[];
|
|
5
6
|
removeMe: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare class NeighborUpdateRpcRemote extends RpcRemote<NeighborUpdateRpcClient> {
|
|
8
|
-
updateNeighbors(neighbors: PeerDescriptor[]): Promise<UpdateNeighborsResponse>;
|
|
9
|
+
updateNeighbors(streamPartId: StreamPartID, neighbors: PeerDescriptor[]): Promise<UpdateNeighborsResponse>;
|
|
9
10
|
}
|
|
10
11
|
export {};
|
|
@@ -3,12 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NeighborUpdateRpcRemote = void 0;
|
|
4
4
|
const dht_1 = require("@streamr/dht");
|
|
5
5
|
const utils_1 = require("@streamr/utils");
|
|
6
|
-
const identifiers_1 = require("../../identifiers");
|
|
7
6
|
const logger = new utils_1.Logger(module);
|
|
8
7
|
class NeighborUpdateRpcRemote extends dht_1.RpcRemote {
|
|
9
|
-
async updateNeighbors(neighbors) {
|
|
8
|
+
async updateNeighbors(streamPartId, neighbors) {
|
|
10
9
|
const request = {
|
|
11
|
-
streamPartId
|
|
10
|
+
streamPartId,
|
|
12
11
|
neighborDescriptors: neighbors,
|
|
13
12
|
removeMe: false
|
|
14
13
|
};
|
|
@@ -20,7 +19,7 @@ class NeighborUpdateRpcRemote extends dht_1.RpcRemote {
|
|
|
20
19
|
};
|
|
21
20
|
}
|
|
22
21
|
catch (err) {
|
|
23
|
-
logger.debug(`updateNeighbors to ${(0,
|
|
22
|
+
logger.debug(`updateNeighbors to ${(0, dht_1.getNodeIdFromPeerDescriptor)(this.getPeerDescriptor())} failed: ${err}`);
|
|
24
23
|
return {
|
|
25
24
|
peerDescriptors: [],
|
|
26
25
|
removeMe: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeighborUpdateRpcRemote.js","sourceRoot":"","sources":["../../../../src/logic/neighbor-discovery/NeighborUpdateRpcRemote.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"NeighborUpdateRpcRemote.js","sourceRoot":"","sources":["../../../../src/logic/neighbor-discovery/NeighborUpdateRpcRemote.ts"],"names":[],"mappings":";;;AAAA,sCAAqF;AACrF,0CAAuC;AAKvC,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAOjC,MAAa,uBAAwB,SAAQ,eAAkC;IAE3E,KAAK,CAAC,eAAe,CAAC,YAA0B,EAAE,SAA2B;QACzE,MAAM,OAAO,GAAmB;YAC5B,YAAY;YACZ,mBAAmB,EAAE,SAAS;YAC9B,QAAQ,EAAE,KAAK;SAClB,CAAA;QACD,IAAI;YACA,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAA;YACzF,OAAO;gBACH,eAAe,EAAE,QAAQ,CAAC,mBAAmB;gBAC7C,QAAQ,EAAE,QAAQ,CAAC,QAAQ;aAC9B,CAAA;SACJ;QAAC,OAAO,GAAQ,EAAE;YACf,MAAM,CAAC,KAAK,CAAC,sBAAsB,IAAA,iCAA2B,EAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,YAAY,GAAG,EAAE,CAAC,CAAA;YAC1G,OAAO;gBACH,eAAe,EAAE,EAAE;gBACnB,QAAQ,EAAE,IAAI;aACjB,CAAA;SACJ;IACL,CAAC;CACJ;AAtBD,0DAsBC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DhtAddress } from '@streamr/dht';
|
|
2
2
|
import { StreamMessage } from '../../proto/packages/trackerless-network/protos/NetworkRpc';
|
|
3
|
-
type SendToNeighborFn = (neighborId:
|
|
3
|
+
type SendToNeighborFn = (neighborId: DhtAddress, msg: StreamMessage) => Promise<void>;
|
|
4
4
|
interface ConstructorOptions {
|
|
5
5
|
sendToNeighbor: SendToNeighborFn;
|
|
6
6
|
minPropagationTargets: number;
|
|
@@ -22,11 +22,11 @@ export declare class Propagation {
|
|
|
22
22
|
/**
|
|
23
23
|
* Node should invoke this when it learns about a new message
|
|
24
24
|
*/
|
|
25
|
-
feedUnseenMessage(message: StreamMessage, targets:
|
|
25
|
+
feedUnseenMessage(message: StreamMessage, targets: DhtAddress[], source: DhtAddress | null): void;
|
|
26
26
|
/**
|
|
27
27
|
* Node should invoke this when it learns about a new node stream assignment
|
|
28
28
|
*/
|
|
29
|
-
onNeighborJoined(neighborId:
|
|
29
|
+
onNeighborJoined(neighborId: DhtAddress): void;
|
|
30
30
|
private sendAndAwaitThenMark;
|
|
31
31
|
}
|
|
32
32
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Propagation.js","sourceRoot":"","sources":["../../../../src/logic/propagation/Propagation.ts"],"names":[],"mappings":";;;AAEA,iEAA8E;AAW9E,MAAM,oBAAoB,GAAG,GAAG,CAAA;AAChC,MAAM,WAAW,GAAG,EAAE,GAAG,IAAI,CAAA;AAE7B;;;;;;GAMG;AAEH,MAAa,WAAW;IAKpB,YAAY,EACR,cAAc,EACd,qBAAqB,EACrB,GAAG,GAAG,WAAW,EACjB,WAAW,GAAG,oBAAoB,EACjB;QACjB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAA;QACpC,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAA;QAClD,IAAI,CAAC,eAAe,GAAG,IAAI,2CAAoB,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IACrE,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,OAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"Propagation.js","sourceRoot":"","sources":["../../../../src/logic/propagation/Propagation.ts"],"names":[],"mappings":";;;AAEA,iEAA8E;AAW9E,MAAM,oBAAoB,GAAG,GAAG,CAAA;AAChC,MAAM,WAAW,GAAG,EAAE,GAAG,IAAI,CAAA;AAE7B;;;;;;GAMG;AAEH,MAAa,WAAW;IAKpB,YAAY,EACR,cAAc,EACd,qBAAqB,EACrB,GAAG,GAAG,WAAW,EACjB,WAAW,GAAG,oBAAoB,EACjB;QACjB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAA;QACpC,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAA;QAClD,IAAI,CAAC,eAAe,GAAG,IAAI,2CAAoB,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IACrE,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,OAAsB,EAAE,OAAqB,EAAE,MAAyB;QACtF,MAAM,IAAI,GAAG;YACT,OAAO;YACP,MAAM;YACN,gBAAgB,EAAE,IAAI,GAAG,EAAc;SAC1C,CAAA;QACD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAC9B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC1B,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;SAC1C;IACL,CAAC;IAED;;OAEG;IACH,gBAAgB,CAAC,UAAsB;QACnC,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,CAAA;QACxC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACtB,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;SAC9C;IACL,CAAC;IAEO,oBAAoB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAmB,EAAE,UAAsB;QACvG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,UAAU,KAAK,MAAM,EAAE;YAC5D,mEAAmE;YACnE,CAAC,KAAK,IAAI,EAAE;gBACR,IAAI;oBACA,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;iBACjD;gBAAC,MAAM;oBACJ,OAAM;iBACT;gBACD,qGAAqG;gBACrG,4FAA4F;gBAC5F,0DAA0D;gBAC1D,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;gBAChC,IAAI,gBAAgB,CAAC,IAAI,IAAI,IAAI,CAAC,qBAAqB,EAAE;oBACrD,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,SAAU,CAAC,CAAA;iBAClD;YACL,CAAC,CAAC,EAAE,CAAA;SACP;IACL,CAAC;CACJ;AA5DD,kCA4DC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DhtAddress } from '@streamr/dht';
|
|
2
2
|
import { MessageRef, StreamMessage } from '../../proto/packages/trackerless-network/protos/NetworkRpc';
|
|
3
3
|
export interface PropagationTask {
|
|
4
4
|
message: StreamMessage;
|
|
5
5
|
source: string | null;
|
|
6
|
-
handledNeighbors: Set<
|
|
6
|
+
handledNeighbors: Set<DhtAddress>;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Keeps track of propagation tasks for the needs of message propagation logic.
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { ConnectionLocker, ITransport, PeerDescriptor } from '@streamr/dht';
|
|
2
|
+
import { ConnectionLocker, DhtAddress, ITransport, PeerDescriptor } from '@streamr/dht';
|
|
3
3
|
import { StreamPartID } from '@streamr/protocol';
|
|
4
4
|
import { EthereumAddress } from '@streamr/utils';
|
|
5
5
|
import { EventEmitter } from 'eventemitter3';
|
|
6
|
-
import { NodeID } from '../../identifiers';
|
|
7
6
|
import { ProxyDirection, StreamMessage } from '../../proto/packages/trackerless-network/protos/NetworkRpc';
|
|
8
7
|
export declare const retry: <T>(task: () => Promise<T>, description: string, abortSignal: AbortSignal, delay?: number) => Promise<T>;
|
|
9
8
|
interface ProxyClientConfig {
|
|
@@ -36,8 +35,8 @@ export declare class ProxyClient extends EventEmitter<Events> {
|
|
|
36
35
|
private closeRandomConnections;
|
|
37
36
|
private closeConnection;
|
|
38
37
|
private removeConnection;
|
|
39
|
-
broadcast(msg: StreamMessage, previousNode?:
|
|
40
|
-
hasConnection(nodeId:
|
|
38
|
+
broadcast(msg: StreamMessage, previousNode?: DhtAddress): void;
|
|
39
|
+
hasConnection(nodeId: DhtAddress, direction: ProxyDirection): boolean;
|
|
41
40
|
getDirection(): ProxyDirection;
|
|
42
41
|
private onNodeDisconnected;
|
|
43
42
|
start(): Promise<void>;
|
|
@@ -5,7 +5,6 @@ const dht_1 = require("@streamr/dht");
|
|
|
5
5
|
const utils_1 = require("@streamr/utils");
|
|
6
6
|
const eventemitter3_1 = require("eventemitter3");
|
|
7
7
|
const lodash_1 = require("lodash");
|
|
8
|
-
const identifiers_1 = require("../../identifiers");
|
|
9
8
|
const NetworkRpc_1 = require("../../proto/packages/trackerless-network/protos/NetworkRpc");
|
|
10
9
|
const NetworkRpc_client_1 = require("../../proto/packages/trackerless-network/protos/NetworkRpc.client");
|
|
11
10
|
const NodeList_1 = require("../NodeList");
|
|
@@ -42,7 +41,7 @@ class ProxyClient extends eventemitter3_1.EventEmitter {
|
|
|
42
41
|
this.config = config;
|
|
43
42
|
this.rpcCommunicator = new dht_1.ListeningRpcCommunicator((0, formStreamPartDeliveryServiceId_1.formStreamPartDeliveryServiceId)(config.streamPartId), config.transport);
|
|
44
43
|
// TODO use config option or named constant?
|
|
45
|
-
this.targetNeighbors = new NodeList_1.NodeList((0,
|
|
44
|
+
this.targetNeighbors = new NodeList_1.NodeList((0, dht_1.getNodeIdFromPeerDescriptor)(this.config.localPeerDescriptor), 1000);
|
|
46
45
|
this.deliveryRpcLocal = new DeliveryRpcLocal_1.DeliveryRpcLocal({
|
|
47
46
|
localPeerDescriptor: this.config.localPeerDescriptor,
|
|
48
47
|
streamPartId: this.config.streamPartId,
|
|
@@ -84,7 +83,7 @@ class ProxyClient extends eventemitter3_1.EventEmitter {
|
|
|
84
83
|
}
|
|
85
84
|
const nodesIds = new Map();
|
|
86
85
|
nodes.forEach((peerDescriptor) => {
|
|
87
|
-
nodesIds.set((0,
|
|
86
|
+
nodesIds.set((0, dht_1.getNodeIdFromPeerDescriptor)(peerDescriptor), peerDescriptor);
|
|
88
87
|
});
|
|
89
88
|
this.definition = {
|
|
90
89
|
nodes: nodesIds,
|
|
@@ -118,12 +117,12 @@ class ProxyClient extends eventemitter3_1.EventEmitter {
|
|
|
118
117
|
}
|
|
119
118
|
async attemptConnection(nodeId, direction, userId) {
|
|
120
119
|
const peerDescriptor = this.definition.nodes.get(nodeId);
|
|
121
|
-
const rpcRemote = new ProxyConnectionRpcRemote_1.ProxyConnectionRpcRemote(this.config.localPeerDescriptor, peerDescriptor, this.
|
|
120
|
+
const rpcRemote = new ProxyConnectionRpcRemote_1.ProxyConnectionRpcRemote(this.config.localPeerDescriptor, peerDescriptor, this.rpcCommunicator, NetworkRpc_client_1.ProxyConnectionRpcClient);
|
|
122
121
|
const accepted = await rpcRemote.requestConnection(direction, userId);
|
|
123
122
|
if (accepted) {
|
|
124
123
|
this.config.connectionLocker.lockConnection(peerDescriptor, SERVICE_ID);
|
|
125
124
|
this.connections.set(nodeId, direction);
|
|
126
|
-
const remote = new DeliveryRpcRemote_1.DeliveryRpcRemote(this.config.localPeerDescriptor, peerDescriptor, this.
|
|
125
|
+
const remote = new DeliveryRpcRemote_1.DeliveryRpcRemote(this.config.localPeerDescriptor, peerDescriptor, this.rpcCommunicator, NetworkRpc_client_1.DeliveryRpcClient);
|
|
127
126
|
this.targetNeighbors.add(remote);
|
|
128
127
|
this.propagation.onNeighborJoined(nodeId);
|
|
129
128
|
logger.info('Open proxy connection', {
|
|
@@ -148,7 +147,7 @@ class ProxyClient extends eventemitter3_1.EventEmitter {
|
|
|
148
147
|
nodeId
|
|
149
148
|
});
|
|
150
149
|
const server = this.targetNeighbors.get(nodeId);
|
|
151
|
-
server?.leaveStreamPartNotice(false);
|
|
150
|
+
server?.leaveStreamPartNotice(this.config.streamPartId, false);
|
|
152
151
|
this.removeConnection(nodeId);
|
|
153
152
|
}
|
|
154
153
|
}
|
|
@@ -170,7 +169,7 @@ class ProxyClient extends eventemitter3_1.EventEmitter {
|
|
|
170
169
|
return this.definition.direction;
|
|
171
170
|
}
|
|
172
171
|
async onNodeDisconnected(peerDescriptor) {
|
|
173
|
-
const nodeId = (0,
|
|
172
|
+
const nodeId = (0, dht_1.getNodeIdFromPeerDescriptor)(peerDescriptor);
|
|
174
173
|
if (this.connections.has(nodeId)) {
|
|
175
174
|
this.config.connectionLocker.unlockConnection(peerDescriptor, SERVICE_ID);
|
|
176
175
|
this.removeConnection(nodeId);
|
|
@@ -184,9 +183,9 @@ class ProxyClient extends eventemitter3_1.EventEmitter {
|
|
|
184
183
|
(peerDescriptor) => this.onNodeDisconnected(peerDescriptor), this.abortController.signal);
|
|
185
184
|
}
|
|
186
185
|
stop() {
|
|
187
|
-
this.targetNeighbors.getAll().
|
|
186
|
+
this.targetNeighbors.getAll().forEach((remote) => {
|
|
188
187
|
this.config.connectionLocker.unlockConnection(remote.getPeerDescriptor(), SERVICE_ID);
|
|
189
|
-
remote.leaveStreamPartNotice(false);
|
|
188
|
+
remote.leaveStreamPartNotice(this.config.streamPartId, false);
|
|
190
189
|
});
|
|
191
190
|
this.targetNeighbors.stop();
|
|
192
191
|
this.rpcCommunicator.destroy();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProxyClient.js","sourceRoot":"","sources":["../../../../src/logic/proxy/ProxyClient.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"ProxyClient.js","sourceRoot":"","sources":["../../../../src/logic/proxy/ProxyClient.ts"],"names":[],"mappings":";;;AAAA,sCAOqB;AAErB,0CAAuF;AACvF,iDAA4C;AAC5C,mCAAmC;AACnC,2FAMmE;AACnE,yGAA+H;AAE/H,0CAAsC;AACtC,4DAAwD;AACxD,0DAAsD;AACtD,4DAAwD;AACxD,oCAAgD;AAChD,yEAAqE;AACrE,wFAAoF;AAEpF,4CAA4C;AACrC,MAAM,KAAK,GAAG,KAAK,EAAK,IAAsB,EAAE,WAAmB,EAAE,WAAwB,EAAE,KAAK,GAAG,KAAK,EAAc,EAAE;IAC/H,iDAAiD;IACjD,OAAO,IAAI,EAAE;QACT,IAAI;YACA,MAAM,MAAM,GAAG,MAAM,IAAI,EAAE,CAAA;YAC3B,OAAO,MAAM,CAAA;SAChB;QAAC,OAAO,CAAM,EAAE;YACb,MAAM,CAAC,IAAI,CAAC,UAAU,WAAW,yBAAyB,EAAE;gBACxD,SAAS,EAAE,KAAK;aACnB,CAAC,CAAA;SACL;QACD,MAAM,IAAA,YAAI,EAAC,KAAK,EAAE,WAAW,CAAC,CAAA;KACjC;AACL,CAAC,CAAA;AAbY,QAAA,KAAK,SAajB;AAqBD,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAEjC,MAAM,UAAU,GAAG,qBAAqB,CAAA;AAExC,MAAa,WAAY,SAAQ,4BAAoB;IAYjD,YAAY,MAAyB;QACjC,KAAK,EAAE,CAAA;QARM,uBAAkB,GAA0C,IAAI,GAAG,EAAE,CAAA;QAErE,gBAAW,GAAoC,IAAI,GAAG,EAAE,CAAA;QAOrE,IAAI,CAAC,MAAM,GAA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;QACnC,IAAA,+BAAuB,EACnB,IAAI,CAAC,MAAM,CAAC,SAAgB,EAC5B,cAAc;QACd,mDAAmD;QACnD,CAAC,cAA8B,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,EAC3E,IAAI,CAAC,eAAe,CAAC,MAAM,CAC9B,CAAA;IACL,CAAC;IAED,IAAI;QACA,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC7C,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,MAAM,CAAC,iBAAiB,EAAE,EAAE,UAAU,CAAC,CAAA;YACrF,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,CAAA;QACjE,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAA;QAC3B,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAA;QAC9B,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAA;QACxB,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAA;IAChC,CAAC;CAEJ;AA9MD,kCA8MC"}
|
|
@@ -2,11 +2,10 @@ import { ServerCallContext } from '@protobuf-ts/runtime-rpc';
|
|
|
2
2
|
import { ProxyConnectionRequest, ProxyConnectionResponse, ProxyDirection, StreamMessage } from '../../proto/packages/trackerless-network/protos/NetworkRpc';
|
|
3
3
|
import { IProxyConnectionRpc } from '../../proto/packages/trackerless-network/protos/NetworkRpc.server';
|
|
4
4
|
import { DeliveryRpcRemote } from '../DeliveryRpcRemote';
|
|
5
|
-
import { ListeningRpcCommunicator, PeerDescriptor } from '@streamr/dht';
|
|
5
|
+
import { DhtAddress, ListeningRpcCommunicator, PeerDescriptor } from '@streamr/dht';
|
|
6
6
|
import { EventEmitter } from 'eventemitter3';
|
|
7
7
|
import { EthereumAddress } from '@streamr/utils';
|
|
8
8
|
import { StreamPartID } from '@streamr/protocol';
|
|
9
|
-
import { NodeID } from '../../identifiers';
|
|
10
9
|
interface ProxyConnection {
|
|
11
10
|
direction: ProxyDirection;
|
|
12
11
|
userId: EthereumAddress;
|
|
@@ -18,17 +17,17 @@ interface ProxyConnectionRpcLocalConfig {
|
|
|
18
17
|
rpcCommunicator: ListeningRpcCommunicator;
|
|
19
18
|
}
|
|
20
19
|
export interface Events {
|
|
21
|
-
newConnection: (nodeId:
|
|
20
|
+
newConnection: (nodeId: DhtAddress) => void;
|
|
22
21
|
}
|
|
23
22
|
export declare class ProxyConnectionRpcLocal extends EventEmitter<Events> implements IProxyConnectionRpc {
|
|
24
23
|
private readonly config;
|
|
25
24
|
private readonly connections;
|
|
26
25
|
constructor(config: ProxyConnectionRpcLocalConfig);
|
|
27
|
-
getConnection(nodeId:
|
|
28
|
-
hasConnection(nodeId:
|
|
29
|
-
removeConnection(nodeId:
|
|
26
|
+
getConnection(nodeId: DhtAddress): ProxyConnection | undefined;
|
|
27
|
+
hasConnection(nodeId: DhtAddress): boolean;
|
|
28
|
+
removeConnection(nodeId: DhtAddress): void;
|
|
30
29
|
stop(): void;
|
|
31
|
-
getPropagationTargets(msg: StreamMessage):
|
|
30
|
+
getPropagationTargets(msg: StreamMessage): DhtAddress[];
|
|
32
31
|
private getNodeIdsForUserId;
|
|
33
32
|
private getSubscribers;
|
|
34
33
|
requestConnection(request: ProxyConnectionRequest, context: ServerCallContext): Promise<ProxyConnectionResponse>;
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ProxyConnectionRpcLocal = void 0;
|
|
4
4
|
const NetworkRpc_1 = require("../../proto/packages/trackerless-network/protos/NetworkRpc");
|
|
5
5
|
const DeliveryRpcRemote_1 = require("../DeliveryRpcRemote");
|
|
6
|
+
const dht_1 = require("@streamr/dht");
|
|
6
7
|
const NetworkRpc_client_1 = require("../../proto/packages/trackerless-network/protos/NetworkRpc.client");
|
|
7
8
|
const eventemitter3_1 = require("eventemitter3");
|
|
8
9
|
const utils_1 = require("@streamr/utils");
|
|
9
|
-
const identifiers_1 = require("../../identifiers");
|
|
10
10
|
const logger = new utils_1.Logger(module);
|
|
11
11
|
class ProxyConnectionRpcLocal extends eventemitter3_1.EventEmitter {
|
|
12
12
|
constructor(config) {
|
|
@@ -25,7 +25,7 @@ class ProxyConnectionRpcLocal extends eventemitter3_1.EventEmitter {
|
|
|
25
25
|
this.connections.delete(nodeId);
|
|
26
26
|
}
|
|
27
27
|
stop() {
|
|
28
|
-
this.connections.forEach((connection) => connection.remote.leaveStreamPartNotice(false));
|
|
28
|
+
this.connections.forEach((connection) => connection.remote.leaveStreamPartNotice(this.config.streamPartId, false));
|
|
29
29
|
this.connections.clear();
|
|
30
30
|
this.removeAllListeners();
|
|
31
31
|
}
|
|
@@ -53,11 +53,11 @@ class ProxyConnectionRpcLocal extends eventemitter3_1.EventEmitter {
|
|
|
53
53
|
// IProxyConnectionRpc server method
|
|
54
54
|
async requestConnection(request, context) {
|
|
55
55
|
const senderPeerDescriptor = context.incomingSourceDescriptor;
|
|
56
|
-
const senderId = (0,
|
|
56
|
+
const senderId = (0, dht_1.getNodeIdFromPeerDescriptor)(senderPeerDescriptor);
|
|
57
57
|
this.connections.set(senderId, {
|
|
58
58
|
direction: request.direction,
|
|
59
59
|
userId: (0, utils_1.toEthereumAddress)((0, utils_1.binaryToHex)(request.userId, true)),
|
|
60
|
-
remote: new DeliveryRpcRemote_1.DeliveryRpcRemote(this.config.localPeerDescriptor, senderPeerDescriptor, this.config.
|
|
60
|
+
remote: new DeliveryRpcRemote_1.DeliveryRpcRemote(this.config.localPeerDescriptor, senderPeerDescriptor, this.config.rpcCommunicator, NetworkRpc_client_1.DeliveryRpcClient)
|
|
61
61
|
});
|
|
62
62
|
const response = {
|
|
63
63
|
accepted: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProxyConnectionRpcLocal.js","sourceRoot":"","sources":["../../../../src/logic/proxy/ProxyConnectionRpcLocal.ts"],"names":[],"mappings":";;;AACA,2FAOmE;AAEnE,4DAAwD;
|
|
1
|
+
{"version":3,"file":"ProxyConnectionRpcLocal.js","sourceRoot":"","sources":["../../../../src/logic/proxy/ProxyConnectionRpcLocal.ts"],"names":[],"mappings":";;;AACA,2FAOmE;AAEnE,4DAAwD;AACxD,sCAAgI;AAChI,yGAAqG;AACrG,iDAA4C;AAC5C,0CAAwF;AAGxF,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAkBjC,MAAa,uBAAwB,SAAQ,4BAAoB;IAK7D,YAAY,MAAqC;QAC7C,KAAK,EAAE,CAAA;QAHM,gBAAW,GAAqC,IAAI,GAAG,EAAE,CAAA;QAItE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,iBAAiB,CAAC,mCAAsB,EAAE,oCAAuB,EAAE,mBAAmB,EAC9G,CAAC,GAA2B,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAA;IACvF,CAAC;IAED,aAAa,CAAC,MAAkB;QAC5B,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IACvC,CAAC;IAED,aAAa,CAAC,MAAkB;QAC5B,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IACvC,CAAC;IAED,gBAAgB,CAAC,MAAkB;QAC/B,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACnC,CAAC;IAED,IAAI;QACA,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAA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A;QAClF,MAAM,QAAQ,GAAG,IAAA,iCAA2B,EAAC,oBAAoB,CAAC,CAAA;QAClE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE;YAC3B,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,MAAM,EAAE,IAAA,yBAAiB,EAAC,IAAA,mBAAW,EAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC5D,MAAM,EAAE,IAAI,qCAAiB,CACzB,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAC/B,oBAAoB,EACpB,IAAI,CAAC,MAAM,CAAC,eAAe,EAC3B,qCAAiB,CACpB;SACJ,CAAC,CAAA;QACF,MAAM,QAAQ,GAA4B;YACtC,QAAQ,EAAE,IAAI;SACjB,CAAA;QACD,MAAM,CAAC,KAAK,CAAC,oCAAoC,QAAQ,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAA;QAC3F,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAA;QACpC,OAAO,QAAQ,CAAA;IACnB,CAAC;CACJ;AAzED,0DAyEC"}
|
|
@@ -4,9 +4,7 @@ import { ITemporaryConnectionRpc } from '../../proto/packages/trackerless-networ
|
|
|
4
4
|
import { ListeningRpcCommunicator } from '@streamr/dht';
|
|
5
5
|
import { NodeList } from '../NodeList';
|
|
6
6
|
import { PeerDescriptor } from '../../proto/packages/dht/protos/DhtRpc';
|
|
7
|
-
import { StreamPartID } from '@streamr/protocol';
|
|
8
7
|
interface TemporaryConnectionRpcLocalConfig {
|
|
9
|
-
streamPartId: StreamPartID;
|
|
10
8
|
rpcCommunicator: ListeningRpcCommunicator;
|
|
11
9
|
localPeerDescriptor: PeerDescriptor;
|
|
12
10
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TemporaryConnectionRpcLocal = void 0;
|
|
4
|
+
const dht_1 = require("@streamr/dht");
|
|
4
5
|
const NetworkRpc_client_1 = require("../../proto/packages/trackerless-network/protos/NetworkRpc.client");
|
|
5
6
|
const NodeList_1 = require("../NodeList");
|
|
6
7
|
const DeliveryRpcRemote_1 = require("../DeliveryRpcRemote");
|
|
7
|
-
const identifiers_1 = require("../../identifiers");
|
|
8
8
|
class TemporaryConnectionRpcLocal {
|
|
9
9
|
constructor(config) {
|
|
10
10
|
this.config = config;
|
|
11
11
|
// TODO use config option or named constant?
|
|
12
|
-
this.temporaryNodes = new NodeList_1.NodeList((0,
|
|
12
|
+
this.temporaryNodes = new NodeList_1.NodeList((0, dht_1.getNodeIdFromPeerDescriptor)(config.localPeerDescriptor), 10);
|
|
13
13
|
}
|
|
14
14
|
getNodes() {
|
|
15
15
|
return this.temporaryNodes;
|
|
@@ -19,7 +19,7 @@ class TemporaryConnectionRpcLocal {
|
|
|
19
19
|
}
|
|
20
20
|
async openConnection(_request, context) {
|
|
21
21
|
const sender = context.incomingSourceDescriptor;
|
|
22
|
-
const remote = new DeliveryRpcRemote_1.DeliveryRpcRemote(this.config.localPeerDescriptor, sender, this.config.
|
|
22
|
+
const remote = new DeliveryRpcRemote_1.DeliveryRpcRemote(this.config.localPeerDescriptor, sender, this.config.rpcCommunicator, NetworkRpc_client_1.DeliveryRpcClient);
|
|
23
23
|
this.temporaryNodes.add(remote);
|
|
24
24
|
return {
|
|
25
25
|
accepted: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemporaryConnectionRpcLocal.js","sourceRoot":"","sources":["../../../../src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"TemporaryConnectionRpcLocal.js","sourceRoot":"","sources":["../../../../src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts"],"names":[],"mappings":";;;AAGA,sCAAoG;AACpG,yGAAqG;AACrG,0CAAsC;AACtC,4DAAwD;AAQxD,MAAa,2BAA2B;IAKpC,YAAY,MAAyC;QACjD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,4CAA4C;QAC5C,IAAI,CAAC,cAAc,GAAG,IAAI,mBAAQ,CAAC,IAAA,iCAA2B,EAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,EAAE,CAAC,CAAA;IACnG,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,cAAc,CAAA;IAC9B,CAAC;IAED,UAAU,CAAC,cAA8B;QACrC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;IAC9C,CAAC;IAED,KAAK,CAAC,cAAc,CAChB,QAAoC,EACpC,OAA0B;QAE1B,MAAM,MAAM,GAAI,OAA0B,CAAC,wBAAyB,CAAA;QACpE,MAAM,MAAM,GAAG,IAAI,qCAAiB,CAChC,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAC/B,MAAM,EACN,IAAI,CAAC,MAAM,CAAC,eAAe,EAC3B,qCAAiB,CACpB,CAAA;QACD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QAC/B,OAAO;YACH,QAAQ,EAAE,IAAI;SACjB,CAAA;IACL,CAAC;CACJ;AAnCD,kEAmCC"}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TemporaryConnectionRpcRemote = void 0;
|
|
4
4
|
const dht_1 = require("@streamr/dht");
|
|
5
5
|
const utils_1 = require("@streamr/utils");
|
|
6
|
-
const identifiers_1 = require("../../identifiers");
|
|
7
6
|
const logger = new utils_1.Logger(module);
|
|
8
7
|
class TemporaryConnectionRpcRemote extends dht_1.RpcRemote {
|
|
9
8
|
async openConnection() {
|
|
@@ -12,7 +11,7 @@ class TemporaryConnectionRpcRemote extends dht_1.RpcRemote {
|
|
|
12
11
|
return response.accepted;
|
|
13
12
|
}
|
|
14
13
|
catch (err) {
|
|
15
|
-
logger.debug(`temporaryConnection to ${(0,
|
|
14
|
+
logger.debug(`temporaryConnection to ${(0, dht_1.getNodeIdFromPeerDescriptor)(this.getPeerDescriptor())} failed: ${err}`);
|
|
16
15
|
return false;
|
|
17
16
|
}
|
|
18
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemporaryConnectionRpcRemote.js","sourceRoot":"","sources":["../../../../src/logic/temporary-connection/TemporaryConnectionRpcRemote.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"TemporaryConnectionRpcRemote.js","sourceRoot":"","sources":["../../../../src/logic/temporary-connection/TemporaryConnectionRpcRemote.ts"],"names":[],"mappings":";;;AAAA,sCAAqE;AACrE,0CAAuC;AAGvC,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAEjC,MAAa,4BAA6B,SAAQ,eAAuC;IAErF,KAAK,CAAC,cAAc;QAChB,IAAI;YACA,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAA;YACpF,OAAO,QAAQ,CAAC,QAAQ,CAAA;SAC3B;QAAC,OAAO,GAAQ,EAAE;YACf,MAAM,CAAC,KAAK,CAAC,0BAA0B,IAAA,iCAA2B,EAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,YAAY,GAAG,EAAE,CAAC,CAAA;YAC9G,OAAO,KAAK,CAAA;SACf;IACL,CAAC;CACJ;AAXD,oEAWC"}
|
|
@@ -8,7 +8,6 @@ const dht_1 = require("@streamr/dht");
|
|
|
8
8
|
const protocol_1 = require("@streamr/protocol");
|
|
9
9
|
const utils_1 = require("@streamr/utils");
|
|
10
10
|
const fs_1 = __importDefault(require("fs"));
|
|
11
|
-
const identifiers_1 = require("../../src/identifiers");
|
|
12
11
|
const EntryPointDiscovery_1 = require("../../src/logic/EntryPointDiscovery");
|
|
13
12
|
const utils_2 = require("../utils/utils");
|
|
14
13
|
const numNodes = 10000;
|
|
@@ -46,7 +45,7 @@ const prepareStream = async (streamId) => {
|
|
|
46
45
|
streamParts.set(streamPartId, streamPublisher);
|
|
47
46
|
};
|
|
48
47
|
const shutdownNetwork = async () => {
|
|
49
|
-
publishIntervals.
|
|
48
|
+
publishIntervals.forEach((interval) => clearInterval(interval));
|
|
50
49
|
await Promise.all([
|
|
51
50
|
...nodes.map((node) => node.stop())
|
|
52
51
|
]);
|
|
@@ -56,7 +55,7 @@ const measureJoiningTime = async () => {
|
|
|
56
55
|
const peerDescriptor = (0, utils_2.createMockPeerDescriptor)({
|
|
57
56
|
region: (0, dht_1.getRandomRegion)()
|
|
58
57
|
});
|
|
59
|
-
console.log('starting node with id ', (0,
|
|
58
|
+
console.log('starting node with id ', (0, dht_1.getNodeIdFromPeerDescriptor)(peerDescriptor));
|
|
60
59
|
// start publishing ons stream
|
|
61
60
|
const stream = Array.from(streamParts.keys())[Math.floor(Math.random() * streamParts.size)];
|
|
62
61
|
console.log(stream);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-message.js","sourceRoot":"","sources":["../../../test/benchmark/first-message.ts"],"names":[],"mappings":";AAAA,+BAA+B;;;;;AAE/B,
|
|
1
|
+
{"version":3,"file":"first-message.js","sourceRoot":"","sources":["../../../test/benchmark/first-message.ts"],"names":[],"mappings":";AAAA,+BAA+B;;;;;AAE/B,sCAA4G;AAC5G,gDAA4I;AAC5I,0CAAyE;AACzE,4CAAmB;AAGnB,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,GA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C,CAAA;IACtG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACtB,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,CAAC,aAAa,EAAa,CAAA;IAC/D,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,6BAA6B,EAAE,CAAC,MAAM,CAAC,CAAA;IAC9D,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,sBAAsB,EAAE,CAAC,CAAA;IAChD,MAAM,kBAAkB,GAAG,WAAW,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAuD,CAAA;IAClI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,UAAU,CAAC,6BAA6B,EAAE,CAAC,CAAA;IAC1E,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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConnectionLocker, PeerDescriptor, Simulator } from '@streamr/dht';
|
|
1
|
+
import { ConnectionLocker, DhtAddress, PeerDescriptor, Simulator } from '@streamr/dht';
|
|
2
2
|
import { RandomGraphNode } from '../../src/logic/RandomGraphNode';
|
|
3
3
|
import { StreamMessage } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc';
|
|
4
4
|
import { DeliveryRpcRemote } from '../../src/logic/DeliveryRpcRemote';
|
|
@@ -6,12 +6,11 @@ import { HandshakeRpcRemote } from '../../src/logic/neighbor-discovery/Handshake
|
|
|
6
6
|
import { NetworkNode } from '../../src/NetworkNode';
|
|
7
7
|
import { EthereumAddress } from '@streamr/utils';
|
|
8
8
|
import { StreamPartID } from '@streamr/protocol';
|
|
9
|
-
import { NodeID } from '../../src/identifiers';
|
|
10
9
|
import { Layer1Node } from '../../src/logic/Layer1Node';
|
|
11
10
|
export declare const mockConnectionLocker: ConnectionLocker;
|
|
12
11
|
export declare const createMockRandomGraphNodeAndDhtNode: (localPeerDescriptor: PeerDescriptor, entryPointDescriptor: PeerDescriptor, streamPartId: StreamPartID, simulator: Simulator) => Promise<[Layer1Node, RandomGraphNode]>;
|
|
13
12
|
export declare const createStreamMessage: (content: string, streamPartId: StreamPartID, publisherId: EthereumAddress, timestamp?: number, sequenceNumber?: number) => StreamMessage;
|
|
14
|
-
export declare const createRandomNodeId: () =>
|
|
13
|
+
export declare const createRandomNodeId: () => DhtAddress;
|
|
15
14
|
export declare const createMockPeerDescriptor: (opts?: Omit<Partial<PeerDescriptor>, 'nodeId' | 'type'>) => PeerDescriptor;
|
|
16
15
|
export declare const createMockDeliveryRpcRemote: (remotePeerDescriptor?: PeerDescriptor) => DeliveryRpcRemote;
|
|
17
16
|
export declare const createMockHandshakeRpcRemote: () => HandshakeRpcRemote;
|
package/dist/test/utils/utils.js
CHANGED
|
@@ -61,24 +61,24 @@ const createStreamMessage = (content, streamPartId, publisherId, timestamp, sequ
|
|
|
61
61
|
};
|
|
62
62
|
exports.createStreamMessage = createStreamMessage;
|
|
63
63
|
const createRandomNodeId = () => {
|
|
64
|
-
return (0, crypto_1.randomBytes)(10)
|
|
64
|
+
return (0, dht_1.getDhtAddressFromRaw)((0, crypto_1.randomBytes)(10));
|
|
65
65
|
};
|
|
66
66
|
exports.createRandomNodeId = createRandomNodeId;
|
|
67
67
|
const createMockPeerDescriptor = (opts) => {
|
|
68
68
|
return {
|
|
69
69
|
...opts,
|
|
70
|
-
nodeId: (0,
|
|
70
|
+
nodeId: (0, dht_1.getRawFromDhtAddress)((0, exports.createRandomNodeId)()),
|
|
71
71
|
type: dht_1.NodeType.NODEJS,
|
|
72
72
|
region: (0, dht_1.getRandomRegion)()
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
75
|
exports.createMockPeerDescriptor = createMockPeerDescriptor;
|
|
76
76
|
const createMockDeliveryRpcRemote = (remotePeerDescriptor) => {
|
|
77
|
-
return new DeliveryRpcRemote_1.DeliveryRpcRemote((0, exports.createMockPeerDescriptor)(), remotePeerDescriptor ?? (0, exports.createMockPeerDescriptor)(),
|
|
77
|
+
return new DeliveryRpcRemote_1.DeliveryRpcRemote((0, exports.createMockPeerDescriptor)(), remotePeerDescriptor ?? (0, exports.createMockPeerDescriptor)(), new proto_rpc_1.RpcCommunicator(), NetworkRpc_client_1.DeliveryRpcClient);
|
|
78
78
|
};
|
|
79
79
|
exports.createMockDeliveryRpcRemote = createMockDeliveryRpcRemote;
|
|
80
80
|
const createMockHandshakeRpcRemote = () => {
|
|
81
|
-
return new HandshakeRpcRemote_1.HandshakeRpcRemote((0, exports.createMockPeerDescriptor)(), (0, exports.createMockPeerDescriptor)(),
|
|
81
|
+
return new HandshakeRpcRemote_1.HandshakeRpcRemote((0, exports.createMockPeerDescriptor)(), (0, exports.createMockPeerDescriptor)(), new proto_rpc_1.RpcCommunicator(), NetworkRpc_client_1.HandshakeRpcClient);
|
|
82
82
|
};
|
|
83
83
|
exports.createMockHandshakeRpcRemote = createMockHandshakeRpcRemote;
|
|
84
84
|
const createNetworkNodeWithSimulator = async (peerDescriptor, simulator, entryPoints) => {
|
|
@@ -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,sCAWqB;AAErB,+FAMuE;AACvE,yEAAqE;AACrE,iFAA6E;AAC7E,8FAA0F;AAC1F,uDAAsE;AACtE,0CAA2E;AAC3E,gDAAmE;AAEnE,6GAA6H;AAC7H,kDAAoD;AAEvC,QAAA,oBAAoB,GAAqB;IAClD,cAAc,EAAE,GAAG,EA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GAAE,EAC1B,IAAI,2BAAe,EAAE,EACrB,sCAAkB,CACrB,CAAA;AACL,CAAC,CAAA;AAPY,QAAA,4BAA4B,gCAOxC;AAEM,MAAM,8BAA8B,GAAG,KAAK,EAC/C,cAA8B,EAC9B,SAAoB,EACpB,WAA6B,EACT,EAAE;IACtB,MAAM,SAAS,GAAG,IAAI,wBAAkB,CAAC,cAAc,EAAE,SAAS,CAAC,CAAA;IACnE,MAAM,SAAS,CAAC,KAAK,EAAE,CAAA;IACvB,OAAO,IAAA,+BAAiB,EAAC;QACrB,MAAM,EAAE;YACJ,cAAc;YACd,WAAW;YACX,SAAS;YACT,cAAc,EAAE,EAAE;YAClB,eAAe,EAAE,MAAM;YACvB,WAAW,EAAE,MAAM;SACtB;KACJ,CAAC,CAAA;AACN,CAAC,CAAA;AAjBY,QAAA,8BAA8B,kCAiB1C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamr/trackerless-network",
|
|
3
|
-
"version": "100.0.0-testnet-two.
|
|
3
|
+
"version": "100.0.0-testnet-two.2",
|
|
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-testnet-two.
|
|
34
|
-
"@streamr/proto-rpc": "100.0.0-testnet-two.
|
|
35
|
-
"@streamr/protocol": "100.0.0-testnet-two.
|
|
36
|
-
"@streamr/test-utils": "100.0.0-testnet-two.
|
|
37
|
-
"@streamr/utils": "100.0.0-testnet-two.
|
|
33
|
+
"@streamr/dht": "100.0.0-testnet-two.2",
|
|
34
|
+
"@streamr/proto-rpc": "100.0.0-testnet-two.2",
|
|
35
|
+
"@streamr/protocol": "100.0.0-testnet-two.2",
|
|
36
|
+
"@streamr/test-utils": "100.0.0-testnet-two.2",
|
|
37
|
+
"@streamr/utils": "100.0.0-testnet-two.2",
|
|
38
38
|
"eventemitter3": "^5.0.0",
|
|
39
39
|
"lodash": "^4.17.21",
|
|
40
40
|
"uuid": "^9.0.1",
|
package/src/NetworkNode.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { StreamMessage, StreamPartID } from '@streamr/protocol'
|
|
2
|
-
import { PeerDescriptor } from '@streamr/dht'
|
|
2
|
+
import { DhtAddress, PeerDescriptor } from '@streamr/dht'
|
|
3
3
|
import { StreamMessageTranslator } from './logic/protocol-integration/stream-message/StreamMessageTranslator'
|
|
4
4
|
import { NetworkOptions, NetworkStack } from './NetworkStack'
|
|
5
5
|
import { EthereumAddress, Logger, MetricsContext } from '@streamr/utils'
|
|
6
6
|
import { ProxyDirection } from './proto/packages/trackerless-network/protos/NetworkRpc'
|
|
7
|
-
import { NodeID } from './identifiers'
|
|
8
7
|
import { pull } from 'lodash'
|
|
9
8
|
|
|
10
9
|
export const createNetworkNode = (opts: NetworkOptions): NetworkNode => {
|
|
@@ -88,7 +87,7 @@ export class NetworkNode {
|
|
|
88
87
|
await this.stack.getStreamrNode().leaveStreamPart(streamPartId)
|
|
89
88
|
}
|
|
90
89
|
|
|
91
|
-
getNeighbors(streamPartId: StreamPartID): ReadonlyArray<
|
|
90
|
+
getNeighbors(streamPartId: StreamPartID): ReadonlyArray<DhtAddress> {
|
|
92
91
|
return this.stack.getStreamrNode().getNeighbors(streamPartId)
|
|
93
92
|
}
|
|
94
93
|
|
|
@@ -109,7 +108,7 @@ export class NetworkNode {
|
|
|
109
108
|
return this.stack.getMetricsContext()
|
|
110
109
|
}
|
|
111
110
|
|
|
112
|
-
getNodeId():
|
|
111
|
+
getNodeId(): DhtAddress {
|
|
113
112
|
return this.stack.getStreamrNode().getNodeId()
|
|
114
113
|
}
|
|
115
114
|
|