@streamr/trackerless-network 100.0.0-pretestnet.4 → 100.0.0-rc.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/README.md +57 -0
- package/dist/package.json +11 -11
- package/dist/src/NetworkNode.d.ts +6 -5
- package/dist/src/NetworkNode.js +9 -2
- package/dist/src/NetworkNode.js.map +1 -1
- package/dist/src/NetworkStack.d.ts +13 -9
- package/dist/src/NetworkStack.js +80 -12
- package/dist/src/NetworkStack.js.map +1 -1
- package/dist/src/exports.d.ts +4 -3
- package/dist/src/exports.js +12 -1
- package/dist/src/exports.js.map +1 -1
- package/dist/src/logic/DeliveryRpcLocal.d.ts +4 -5
- package/dist/src/logic/DeliveryRpcLocal.js +6 -5
- package/dist/src/logic/DeliveryRpcLocal.js.map +1 -1
- package/dist/src/logic/DeliveryRpcRemote.d.ts +5 -4
- package/dist/src/logic/DeliveryRpcRemote.js +4 -3
- package/dist/src/logic/DeliveryRpcRemote.js.map +1 -1
- package/dist/src/logic/DuplicateMessageDetector.d.ts +3 -3
- package/dist/src/logic/DuplicateMessageDetector.js +10 -6
- package/dist/src/logic/DuplicateMessageDetector.js.map +1 -1
- package/dist/src/logic/EntryPointDiscovery.d.ts +8 -5
- package/dist/src/logic/EntryPointDiscovery.js +24 -15
- package/dist/src/logic/EntryPointDiscovery.js.map +1 -1
- package/dist/src/logic/Layer0Node.d.ts +6 -4
- package/dist/src/logic/Layer1Node.d.ts +12 -6
- package/dist/src/logic/NodeList.d.ts +13 -15
- package/dist/src/logic/NodeList.js +18 -15
- package/dist/src/logic/NodeList.js.map +1 -1
- package/dist/src/logic/RandomGraphNode.d.ts +26 -22
- package/dist/src/logic/RandomGraphNode.js +82 -52
- package/dist/src/logic/RandomGraphNode.js.map +1 -1
- package/dist/src/logic/StreamrNode.d.ts +6 -6
- package/dist/src/logic/StreamrNode.js +53 -37
- package/dist/src/logic/StreamrNode.js.map +1 -1
- package/dist/src/logic/createRandomGraphNode.d.ts +2 -2
- package/dist/src/logic/createRandomGraphNode.js +33 -21
- package/dist/src/logic/createRandomGraphNode.js.map +1 -1
- package/dist/src/logic/formStreamPartDeliveryServiceId.d.ts +2 -1
- package/dist/src/logic/formStreamPartDeliveryServiceId.js.map +1 -1
- package/dist/src/logic/inspect/InspectSession.d.ts +4 -3
- package/dist/src/logic/inspect/InspectSession.js +6 -2
- package/dist/src/logic/inspect/InspectSession.js.map +1 -1
- package/dist/src/logic/inspect/Inspector.d.ts +11 -16
- package/dist/src/logic/inspect/Inspector.js +21 -9
- package/dist/src/logic/inspect/Inspector.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.d.ts +7 -9
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js +55 -32
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.d.ts +8 -6
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js +25 -16
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/Handshaker.d.ts +9 -15
- package/dist/src/logic/neighbor-discovery/Handshaker.js +68 -44
- package/dist/src/logic/neighbor-discovery/Handshaker.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborFinder.d.ts +8 -10
- package/dist/src/logic/neighbor-discovery/NeighborFinder.js +12 -2
- package/dist/src/logic/neighbor-discovery/NeighborFinder.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.d.ts +7 -10
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js +11 -9
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.d.ts +8 -4
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js +33 -24
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.d.ts +5 -4
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.js +4 -5
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.js.map +1 -1
- package/dist/src/logic/node-info/NodeInfoClient.d.ts +9 -0
- package/dist/src/logic/node-info/NodeInfoClient.js +21 -0
- package/dist/src/logic/node-info/NodeInfoClient.js.map +1 -0
- package/dist/src/logic/node-info/NodeInfoRpcLocal.d.ts +12 -0
- package/dist/src/logic/node-info/NodeInfoRpcLocal.js +22 -0
- package/dist/src/logic/node-info/NodeInfoRpcLocal.js.map +1 -0
- package/dist/src/logic/node-info/NodeInfoRpcRemote.d.ts +6 -0
- package/dist/src/logic/node-info/NodeInfoRpcRemote.js +11 -0
- package/dist/src/logic/node-info/NodeInfoRpcRemote.js.map +1 -0
- package/dist/src/logic/propagation/FifoMapWithTTL.js +7 -3
- package/dist/src/logic/propagation/FifoMapWithTTL.js.map +1 -1
- package/dist/src/logic/propagation/Propagation.d.ts +4 -4
- package/dist/src/logic/propagation/Propagation.js +4 -0
- package/dist/src/logic/propagation/Propagation.js.map +1 -1
- package/dist/src/logic/propagation/PropagationTaskStore.d.ts +2 -2
- package/dist/src/logic/propagation/PropagationTaskStore.js +1 -0
- package/dist/src/logic/propagation/PropagationTaskStore.js.map +1 -1
- package/dist/src/logic/protocol-integration/stream-message/GroupKeyRequestTranslator.js +1 -1
- package/dist/src/logic/protocol-integration/stream-message/GroupKeyRequestTranslator.js.map +1 -1
- package/dist/src/logic/protocol-integration/stream-message/GroupKeyResponseTranslator.js +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 +87 -53
- package/dist/src/logic/protocol-integration/stream-message/StreamMessageTranslator.js.map +1 -1
- package/dist/src/logic/protocol-integration/stream-message/oldStreamMessageBinaryUtils.d.ts +7 -0
- package/dist/src/logic/protocol-integration/stream-message/oldStreamMessageBinaryUtils.js +32 -0
- package/dist/src/logic/protocol-integration/stream-message/oldStreamMessageBinaryUtils.js.map +1 -0
- package/dist/src/logic/proxy/ProxyClient.d.ts +8 -6
- package/dist/src/logic/proxy/ProxyClient.js +40 -28
- 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 +8 -8
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcRemote.d.ts +3 -3
- 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 +9 -4
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js +21 -6
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.d.ts +4 -3
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js +13 -3
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js.map +1 -1
- package/dist/src/logic/utils.js.map +1 -1
- package/dist/src/proto/google/protobuf/any.js +8 -8
- package/dist/src/proto/google/protobuf/any.js.map +1 -1
- package/dist/src/proto/google/protobuf/empty.js +2 -4
- package/dist/src/proto/google/protobuf/empty.js.map +1 -1
- package/dist/src/proto/google/protobuf/timestamp.js +10 -10
- package/dist/src/proto/google/protobuf/timestamp.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +36 -49
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +54 -52
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +184 -234
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +118 -168
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +20 -29
- package/dist/src/proto/packages/proto-rpc/protos/ProtoRpc.js +1 -1
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.d.ts +42 -5
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.js +52 -19
- 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 +193 -28
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js +129 -20
- 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 +20 -3
- package/dist/test/benchmark/first-message.js +14 -15
- package/dist/test/benchmark/first-message.js.map +1 -1
- package/dist/test/utils/utils.d.ts +2 -4
- package/dist/test/utils/utils.js +20 -19
- package/dist/test/utils/utils.js.map +1 -1
- package/jest.config.js +3 -38
- package/package.json +11 -11
- package/protos/NetworkRpc.proto +57 -12
- package/src/NetworkNode.ts +13 -6
- package/src/NetworkStack.ts +94 -16
- package/src/exports.ts +11 -3
- package/src/logic/DeliveryRpcLocal.ts +7 -8
- package/src/logic/DeliveryRpcRemote.ts +7 -5
- package/src/logic/DuplicateMessageDetector.ts +7 -7
- package/src/logic/EntryPointDiscovery.ts +26 -19
- package/src/logic/Layer0Node.ts +6 -4
- package/src/logic/Layer1Node.ts +21 -6
- package/src/logic/NodeList.ts +25 -26
- package/src/logic/RandomGraphNode.ts +148 -78
- package/src/logic/StreamrNode.ts +58 -41
- package/src/logic/createRandomGraphNode.ts +37 -25
- package/src/logic/formStreamPartDeliveryServiceId.ts +2 -1
- package/src/logic/inspect/InspectSession.ts +8 -4
- package/src/logic/inspect/Inspector.ts +34 -24
- package/src/logic/neighbor-discovery/HandshakeRpcLocal.ts +72 -38
- package/src/logic/neighbor-discovery/HandshakeRpcRemote.ts +32 -20
- package/src/logic/neighbor-discovery/Handshaker.ts +90 -75
- package/src/logic/neighbor-discovery/NeighborFinder.ts +18 -13
- package/src/logic/neighbor-discovery/NeighborUpdateManager.ts +19 -20
- package/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts +43 -33
- package/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.ts +6 -6
- package/src/logic/node-info/NodeInfoClient.ts +23 -0
- package/src/logic/node-info/NodeInfoRpcLocal.ts +28 -0
- package/src/logic/node-info/NodeInfoRpcRemote.ts +11 -0
- package/src/logic/propagation/Propagation.ts +7 -6
- package/src/logic/propagation/PropagationTaskStore.ts +2 -2
- package/src/logic/protocol-integration/stream-message/GroupKeyRequestTranslator.ts +1 -1
- package/src/logic/protocol-integration/stream-message/GroupKeyResponseTranslator.ts +1 -2
- package/src/logic/protocol-integration/stream-message/StreamMessageTranslator.ts +95 -69
- package/src/logic/protocol-integration/stream-message/oldStreamMessageBinaryUtils.ts +37 -0
- package/src/logic/proxy/ProxyClient.ts +60 -40
- package/src/logic/proxy/ProxyConnectionRpcLocal.ts +15 -19
- package/src/logic/proxy/ProxyConnectionRpcRemote.ts +3 -3
- package/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts +30 -10
- package/src/logic/temporary-connection/TemporaryConnectionRpcRemote.ts +14 -4
- package/src/proto/google/protobuf/any.ts +4 -4
- package/src/proto/google/protobuf/empty.ts +2 -4
- package/src/proto/google/protobuf/timestamp.ts +4 -4
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +50 -66
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +21 -30
- package/src/proto/packages/dht/protos/DhtRpc.ts +242 -316
- package/src/proto/packages/proto-rpc/protos/ProtoRpc.ts +1 -1
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.client.ts +49 -7
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.server.ts +21 -4
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.ts +251 -44
- package/test/benchmark/StreamPartIdDataKeyDistribution.test.ts +60 -0
- package/test/benchmark/first-message.ts +38 -17
- package/test/end-to-end/inspect.test.ts +16 -4
- package/test/end-to-end/proxy-and-full-node.test.ts +26 -13
- package/test/end-to-end/proxy-connections.test.ts +23 -11
- package/test/end-to-end/proxy-key-exchange.test.ts +25 -15
- package/test/end-to-end/random-graph-with-real-connections.test.ts +35 -32
- package/test/end-to-end/webrtc-full-node-network.test.ts +11 -12
- package/test/end-to-end/websocket-full-node-network.test.ts +12 -12
- package/test/integration/DeliveryRpcRemote.test.ts +6 -9
- package/test/integration/HandshakeRpcRemote.test.ts +6 -8
- package/test/integration/Handshakes.test.ts +29 -27
- package/test/integration/Inspect.test.ts +0 -2
- package/test/integration/NeighborUpdateRpcRemote.test.ts +6 -7
- package/test/integration/NetworkNode.test.ts +27 -12
- package/test/integration/NetworkRpc.test.ts +3 -5
- package/test/integration/NetworkStack.test.ts +2 -2
- package/test/integration/NodeInfoRpc.test.ts +104 -0
- package/test/integration/Propagation.test.ts +3 -3
- package/test/integration/RandomGraphNode-Layer1Node-Latencies.test.ts +24 -25
- package/test/integration/RandomGraphNode-Layer1Node.test.ts +26 -24
- package/test/integration/StreamrNode.test.ts +4 -16
- package/test/integration/joining-streams-on-offline-peers.test.ts +7 -31
- package/test/integration/stream-without-default-entrypoints.test.ts +22 -23
- package/test/integration/streamEntryPointReplacing.test.ts +94 -0
- package/test/unit/DeliveryRpcLocal.test.ts +2 -1
- package/test/unit/EntrypointDiscovery.test.ts +11 -8
- package/test/unit/GroupKeyResponseTranslator.test.ts +1 -1
- package/test/unit/HandshakeRpcLocal.test.ts +80 -28
- package/test/unit/Handshaker.test.ts +14 -9
- package/test/unit/InspectSession.test.ts +5 -6
- package/test/unit/Inspector.test.ts +3 -4
- package/test/unit/NeighborFinder.test.ts +12 -9
- package/test/unit/NeighborUpdateRpcLocal.test.ts +139 -0
- package/test/unit/NodeList.test.ts +77 -80
- package/test/unit/Propagation.test.ts +21 -16
- package/test/unit/ProxyConnectionRpcRemote.test.ts +18 -12
- package/test/unit/RandomGraphNode.test.ts +23 -20
- package/test/unit/StreamMessageTranslator.test.ts +10 -8
- package/test/unit/StreamPartIDDataKey.test.ts +12 -0
- package/test/unit/StreamrNode.test.ts +2 -0
- package/test/unit/TemporaryConnectionRpcLocal.test.ts +38 -0
- package/test/unit/oldStreamMessageBinaryUtils.test.ts +39 -0
- package/test/utils/mock/MockHandshaker.ts +6 -5
- package/test/utils/mock/MockLayer0Node.ts +7 -2
- package/test/utils/mock/MockLayer1Node.ts +5 -2
- package/test/utils/mock/MockNeighborFinder.ts +3 -2
- package/test/utils/mock/MockNeighborUpdateManager.ts +3 -2
- package/test/utils/mock/Transport.ts +1 -1
- package/test/utils/utils.ts +40 -25
- package/tsconfig.jest.json +5 -4
- package/tsconfig.node.json +2 -2
- 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
- package/test/unit/GroupKeyRequestTranslator.test.ts +0 -36
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProxyClient = exports.retry = void 0;
|
|
4
4
|
const dht_1 = require("@streamr/dht");
|
|
5
|
-
const proto_rpc_1 = require("@streamr/proto-rpc");
|
|
6
5
|
const utils_1 = require("@streamr/utils");
|
|
7
6
|
const eventemitter3_1 = require("eventemitter3");
|
|
8
7
|
const lodash_1 = require("lodash");
|
|
9
|
-
const identifiers_1 = require("../../identifiers");
|
|
10
8
|
const NetworkRpc_1 = require("../../proto/packages/trackerless-network/protos/NetworkRpc");
|
|
11
9
|
const NetworkRpc_client_1 = require("../../proto/packages/trackerless-network/protos/NetworkRpc.client");
|
|
12
10
|
const NodeList_1 = require("../NodeList");
|
|
@@ -16,6 +14,7 @@ const Propagation_1 = require("../propagation/Propagation");
|
|
|
16
14
|
const utils_2 = require("../utils");
|
|
17
15
|
const ProxyConnectionRpcRemote_1 = require("./ProxyConnectionRpcRemote");
|
|
18
16
|
const formStreamPartDeliveryServiceId_1 = require("../formStreamPartDeliveryServiceId");
|
|
17
|
+
// TODO use config option or named constant?
|
|
19
18
|
const retry = async (task, description, abortSignal, delay = 10000) => {
|
|
20
19
|
// eslint-disable-next-line no-constant-condition
|
|
21
20
|
while (true) {
|
|
@@ -35,21 +34,30 @@ exports.retry = retry;
|
|
|
35
34
|
const logger = new utils_1.Logger(module);
|
|
36
35
|
const SERVICE_ID = 'system/proxy-client';
|
|
37
36
|
class ProxyClient extends eventemitter3_1.EventEmitter {
|
|
37
|
+
rpcCommunicator;
|
|
38
|
+
deliveryRpcLocal;
|
|
39
|
+
config;
|
|
40
|
+
duplicateDetectors = new Map();
|
|
41
|
+
definition;
|
|
42
|
+
connections = new Map();
|
|
43
|
+
propagation;
|
|
44
|
+
neighbors;
|
|
45
|
+
abortController;
|
|
38
46
|
constructor(config) {
|
|
39
47
|
super();
|
|
40
|
-
this.duplicateDetectors = new Map();
|
|
41
|
-
this.connections = new Map();
|
|
42
48
|
this.config = config;
|
|
43
49
|
this.rpcCommunicator = new dht_1.ListeningRpcCommunicator((0, formStreamPartDeliveryServiceId_1.formStreamPartDeliveryServiceId)(config.streamPartId), config.transport);
|
|
44
|
-
|
|
50
|
+
// TODO use config option or named constant?
|
|
51
|
+
this.neighbors = new NodeList_1.NodeList((0, dht_1.getNodeIdFromPeerDescriptor)(this.config.localPeerDescriptor), 1000);
|
|
45
52
|
this.deliveryRpcLocal = new DeliveryRpcLocal_1.DeliveryRpcLocal({
|
|
46
53
|
localPeerDescriptor: this.config.localPeerDescriptor,
|
|
47
54
|
streamPartId: this.config.streamPartId,
|
|
48
55
|
markAndCheckDuplicate: (msg, prev) => (0, utils_2.markAndCheckDuplicate)(this.duplicateDetectors, msg, prev),
|
|
49
56
|
broadcast: (message, previousNode) => this.broadcast(message, previousNode),
|
|
50
57
|
onLeaveNotice: (senderId) => {
|
|
51
|
-
const contact = this.
|
|
58
|
+
const contact = this.neighbors.get(senderId);
|
|
52
59
|
if (contact) {
|
|
60
|
+
// TODO should we catch possible promise rejection?
|
|
53
61
|
setImmediate(() => this.onNodeDisconnected(contact.getPeerDescriptor()));
|
|
54
62
|
}
|
|
55
63
|
},
|
|
@@ -57,9 +65,10 @@ class ProxyClient extends eventemitter3_1.EventEmitter {
|
|
|
57
65
|
markForInspection: () => { }
|
|
58
66
|
});
|
|
59
67
|
this.propagation = new Propagation_1.Propagation({
|
|
68
|
+
// TODO use config option or named constant?
|
|
60
69
|
minPropagationTargets: config.minPropagationTargets ?? 2,
|
|
61
70
|
sendToNeighbor: async (neighborId, msg) => {
|
|
62
|
-
const remote = this.
|
|
71
|
+
const remote = this.neighbors.get(neighborId);
|
|
63
72
|
if (remote) {
|
|
64
73
|
await remote.sendStreamMessage(msg);
|
|
65
74
|
}
|
|
@@ -77,11 +86,11 @@ class ProxyClient extends eventemitter3_1.EventEmitter {
|
|
|
77
86
|
async setProxies(nodes, direction, userId, connectionCount) {
|
|
78
87
|
logger.trace('Setting proxies', { streamPartId: this.config.streamPartId, peerDescriptors: nodes, direction, userId, connectionCount });
|
|
79
88
|
if (connectionCount !== undefined && connectionCount > nodes.length) {
|
|
80
|
-
throw Error('Cannot set connectionCount above the size of the configured array of nodes');
|
|
89
|
+
throw new Error('Cannot set connectionCount above the size of the configured array of nodes');
|
|
81
90
|
}
|
|
82
91
|
const nodesIds = new Map();
|
|
83
92
|
nodes.forEach((peerDescriptor) => {
|
|
84
|
-
nodesIds.set((0,
|
|
93
|
+
nodesIds.set((0, dht_1.getNodeIdFromPeerDescriptor)(peerDescriptor), peerDescriptor);
|
|
85
94
|
});
|
|
86
95
|
this.definition = {
|
|
87
96
|
nodes: nodesIds,
|
|
@@ -106,7 +115,7 @@ class ProxyClient extends eventemitter3_1.EventEmitter {
|
|
|
106
115
|
getInvalidConnections() {
|
|
107
116
|
return Array.from(this.connections.keys()).filter((id) => {
|
|
108
117
|
return !this.definition.nodes.has(id)
|
|
109
|
-
|| this.definition.direction !== this.connections.get(id);
|
|
118
|
+
|| this.definition.direction !== this.connections.get(id).direction;
|
|
110
119
|
});
|
|
111
120
|
}
|
|
112
121
|
async openRandomConnections(connectionCount) {
|
|
@@ -115,14 +124,13 @@ class ProxyClient extends eventemitter3_1.EventEmitter {
|
|
|
115
124
|
}
|
|
116
125
|
async attemptConnection(nodeId, direction, userId) {
|
|
117
126
|
const peerDescriptor = this.definition.nodes.get(nodeId);
|
|
118
|
-
const
|
|
119
|
-
const rpcRemote = new ProxyConnectionRpcRemote_1.ProxyConnectionRpcRemote(this.config.localPeerDescriptor, peerDescriptor, this.config.streamPartId, client);
|
|
127
|
+
const rpcRemote = new ProxyConnectionRpcRemote_1.ProxyConnectionRpcRemote(this.config.localPeerDescriptor, peerDescriptor, this.rpcCommunicator, NetworkRpc_client_1.ProxyConnectionRpcClient);
|
|
120
128
|
const accepted = await rpcRemote.requestConnection(direction, userId);
|
|
121
129
|
if (accepted) {
|
|
122
130
|
this.config.connectionLocker.lockConnection(peerDescriptor, SERVICE_ID);
|
|
123
|
-
this.connections.set(nodeId, direction);
|
|
124
|
-
const remote = new DeliveryRpcRemote_1.DeliveryRpcRemote(this.config.localPeerDescriptor, peerDescriptor, this.
|
|
125
|
-
this.
|
|
131
|
+
this.connections.set(nodeId, { peerDescriptor, direction });
|
|
132
|
+
const remote = new DeliveryRpcRemote_1.DeliveryRpcRemote(this.config.localPeerDescriptor, peerDescriptor, this.rpcCommunicator, NetworkRpc_client_1.DeliveryRpcClient);
|
|
133
|
+
this.neighbors.add(remote);
|
|
126
134
|
this.propagation.onNeighborJoined(nodeId);
|
|
127
135
|
logger.info('Open proxy connection', {
|
|
128
136
|
nodeId,
|
|
@@ -145,46 +153,50 @@ class ProxyClient extends eventemitter3_1.EventEmitter {
|
|
|
145
153
|
logger.info('Close proxy connection', {
|
|
146
154
|
nodeId
|
|
147
155
|
});
|
|
148
|
-
const server = this.
|
|
149
|
-
server?.leaveStreamPartNotice();
|
|
150
|
-
this.removeConnection(nodeId);
|
|
156
|
+
const server = this.neighbors.get(nodeId);
|
|
157
|
+
server?.leaveStreamPartNotice(this.config.streamPartId, false);
|
|
158
|
+
this.removeConnection(this.connections.get(nodeId).peerDescriptor);
|
|
151
159
|
}
|
|
152
160
|
}
|
|
153
|
-
removeConnection(
|
|
161
|
+
removeConnection(peerDescriptor) {
|
|
162
|
+
const nodeId = (0, dht_1.getNodeIdFromPeerDescriptor)(peerDescriptor);
|
|
154
163
|
this.connections.delete(nodeId);
|
|
155
|
-
this.
|
|
164
|
+
this.neighbors.remove(nodeId);
|
|
165
|
+
this.config.connectionLocker.unlockConnection(peerDescriptor, SERVICE_ID);
|
|
156
166
|
}
|
|
157
167
|
broadcast(msg, previousNode) {
|
|
158
168
|
if (!previousNode) {
|
|
159
169
|
(0, utils_2.markAndCheckDuplicate)(this.duplicateDetectors, msg.messageId, msg.previousMessageRef);
|
|
160
170
|
}
|
|
161
171
|
this.emit('message', msg);
|
|
162
|
-
this.propagation.feedUnseenMessage(msg, this.
|
|
172
|
+
this.propagation.feedUnseenMessage(msg, this.neighbors.getIds(), previousNode ?? null);
|
|
163
173
|
}
|
|
164
174
|
hasConnection(nodeId, direction) {
|
|
165
|
-
return this.connections.has(nodeId) && this.connections.get(nodeId) === direction;
|
|
175
|
+
return this.connections.has(nodeId) && this.connections.get(nodeId).direction === direction;
|
|
166
176
|
}
|
|
167
177
|
getDirection() {
|
|
168
178
|
return this.definition.direction;
|
|
169
179
|
}
|
|
170
180
|
async onNodeDisconnected(peerDescriptor) {
|
|
171
|
-
const nodeId = (0,
|
|
181
|
+
const nodeId = (0, dht_1.getNodeIdFromPeerDescriptor)(peerDescriptor);
|
|
172
182
|
if (this.connections.has(nodeId)) {
|
|
173
183
|
this.config.connectionLocker.unlockConnection(peerDescriptor, SERVICE_ID);
|
|
174
|
-
this.removeConnection(
|
|
184
|
+
this.removeConnection(peerDescriptor);
|
|
175
185
|
await (0, exports.retry)(() => this.updateConnections(), 'updating proxy connections', this.abortController.signal);
|
|
176
186
|
}
|
|
177
187
|
}
|
|
178
188
|
async start() {
|
|
179
189
|
this.registerDefaultServerMethods();
|
|
180
|
-
(0, utils_1.addManagedEventListener)(this.config.transport, 'disconnected',
|
|
190
|
+
(0, utils_1.addManagedEventListener)(this.config.transport, 'disconnected',
|
|
191
|
+
// TODO should we catch possible promise rejection?
|
|
192
|
+
(peerDescriptor) => this.onNodeDisconnected(peerDescriptor), this.abortController.signal);
|
|
181
193
|
}
|
|
182
194
|
stop() {
|
|
183
|
-
this.
|
|
195
|
+
this.neighbors.getAll().forEach((remote) => {
|
|
184
196
|
this.config.connectionLocker.unlockConnection(remote.getPeerDescriptor(), SERVICE_ID);
|
|
185
|
-
remote.leaveStreamPartNotice();
|
|
197
|
+
remote.leaveStreamPartNotice(this.config.streamPartId, false);
|
|
186
198
|
});
|
|
187
|
-
this.
|
|
199
|
+
this.neighbors.stop();
|
|
188
200
|
this.rpcCommunicator.destroy();
|
|
189
201
|
this.connections.clear();
|
|
190
202
|
this.abortController.abort();
|
|
@@ -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,EA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AE,CAAA;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,SAAS,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YACvC,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,SAAS,CAAC,IAAI,EAAE,CAAA;QACrB,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;AAhND,kCAgNC"}
|
|
@@ -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,16 +3,16 @@ 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
|
|
6
|
+
const dht_1 = require("@streamr/dht");
|
|
7
7
|
const NetworkRpc_client_1 = require("../../proto/packages/trackerless-network/protos/NetworkRpc.client");
|
|
8
8
|
const eventemitter3_1 = require("eventemitter3");
|
|
9
9
|
const utils_1 = require("@streamr/utils");
|
|
10
|
-
const identifiers_1 = require("../../identifiers");
|
|
11
10
|
const logger = new utils_1.Logger(module);
|
|
12
11
|
class ProxyConnectionRpcLocal extends eventemitter3_1.EventEmitter {
|
|
12
|
+
config;
|
|
13
|
+
connections = new Map();
|
|
13
14
|
constructor(config) {
|
|
14
15
|
super();
|
|
15
|
-
this.connections = new Map();
|
|
16
16
|
this.config = config;
|
|
17
17
|
this.config.rpcCommunicator.registerRpcMethod(NetworkRpc_1.ProxyConnectionRequest, NetworkRpc_1.ProxyConnectionResponse, 'requestConnection', (msg, context) => this.requestConnection(msg, context));
|
|
18
18
|
}
|
|
@@ -26,14 +26,14 @@ class ProxyConnectionRpcLocal extends eventemitter3_1.EventEmitter {
|
|
|
26
26
|
this.connections.delete(nodeId);
|
|
27
27
|
}
|
|
28
28
|
stop() {
|
|
29
|
-
this.connections.forEach((connection) => connection.remote.leaveStreamPartNotice());
|
|
29
|
+
this.connections.forEach((connection) => connection.remote.leaveStreamPartNotice(this.config.streamPartId, false));
|
|
30
30
|
this.connections.clear();
|
|
31
31
|
this.removeAllListeners();
|
|
32
32
|
}
|
|
33
33
|
getPropagationTargets(msg) {
|
|
34
|
-
if (msg.
|
|
34
|
+
if (msg.body.oneofKind === 'groupKeyRequest') {
|
|
35
35
|
try {
|
|
36
|
-
const recipientId =
|
|
36
|
+
const recipientId = msg.body.groupKeyRequest.recipientId;
|
|
37
37
|
return this.getNodeIdsForUserId((0, utils_1.toEthereumAddress)((0, utils_1.binaryToHex)(recipientId, true)));
|
|
38
38
|
}
|
|
39
39
|
catch (err) {
|
|
@@ -54,11 +54,11 @@ class ProxyConnectionRpcLocal extends eventemitter3_1.EventEmitter {
|
|
|
54
54
|
// IProxyConnectionRpc server method
|
|
55
55
|
async requestConnection(request, context) {
|
|
56
56
|
const senderPeerDescriptor = context.incomingSourceDescriptor;
|
|
57
|
-
const senderId = (0,
|
|
57
|
+
const senderId = (0, dht_1.getNodeIdFromPeerDescriptor)(senderPeerDescriptor);
|
|
58
58
|
this.connections.set(senderId, {
|
|
59
59
|
direction: request.direction,
|
|
60
60
|
userId: (0, utils_1.toEthereumAddress)((0, utils_1.binaryToHex)(request.userId, true)),
|
|
61
|
-
remote: new DeliveryRpcRemote_1.DeliveryRpcRemote(this.config.localPeerDescriptor, senderPeerDescriptor, this.config.
|
|
61
|
+
remote: new DeliveryRpcRemote_1.DeliveryRpcRemote(this.config.localPeerDescriptor, senderPeerDescriptor, this.config.rpcCommunicator, NetworkRpc_client_1.DeliveryRpcClient)
|
|
62
62
|
});
|
|
63
63
|
const response = {
|
|
64
64
|
accepted: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProxyConnectionRpcLocal.js","sourceRoot":"","sources":["../../../../src/logic/proxy/ProxyConnectionRpcLocal.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"ProxyConnectionRpcLocal.js","sourceRoot":"","sources":["../../../../src/logic/proxy/ProxyConnectionRpcLocal.ts"],"names":[],"mappings":";;;AACA,2FAKmE;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;IAE5C,MAAM,CAA+B;IACrC,WAAW,GAAqC,IAAI,GAAG,EAAE,CAAA;IAE1E,YAAY,MAAqC;QAC7C,KAAK,EAAE,CAAA;QACP,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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A;IACnB,CAAC;CACJ;AAzED,0DAyEC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RpcRemote } from '@streamr/dht';
|
|
2
2
|
import { EthereumAddress } from '@streamr/utils';
|
|
3
3
|
import { ProxyDirection } from '../../proto/packages/trackerless-network/protos/NetworkRpc';
|
|
4
|
-
import {
|
|
5
|
-
export declare class ProxyConnectionRpcRemote extends
|
|
4
|
+
import { ProxyConnectionRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client';
|
|
5
|
+
export declare class ProxyConnectionRpcRemote extends RpcRemote<ProxyConnectionRpcClient> {
|
|
6
6
|
requestConnection(direction: ProxyDirection, userId: EthereumAddress): Promise<boolean>;
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@ exports.ProxyConnectionRpcRemote = void 0;
|
|
|
4
4
|
const dht_1 = require("@streamr/dht");
|
|
5
5
|
const utils_1 = require("@streamr/utils");
|
|
6
6
|
const logger = new utils_1.Logger(module);
|
|
7
|
-
class ProxyConnectionRpcRemote extends dht_1.
|
|
7
|
+
class ProxyConnectionRpcRemote extends dht_1.RpcRemote {
|
|
8
8
|
async requestConnection(direction, userId) {
|
|
9
9
|
const request = {
|
|
10
10
|
direction,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProxyConnectionRpcRemote.js","sourceRoot":"","sources":["../../../../src/logic/proxy/ProxyConnectionRpcRemote.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"ProxyConnectionRpcRemote.js","sourceRoot":"","sources":["../../../../src/logic/proxy/ProxyConnectionRpcRemote.ts"],"names":[],"mappings":";;;AAAA,sCAAqE;AACrE,0CAAqE;AAIrE,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAEjC,MAAa,wBAAyB,SAAQ,eAAmC;IAE7E,KAAK,CAAC,iBAAiB,CAAC,SAAyB,EAAE,MAAuB;QACtE,MAAM,OAAO,GAA2B;YACpC,SAAS;YACT,MAAM,EAAE,IAAA,mBAAW,EAAC,MAAM,CAAC;SAC9B,CAAA;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC;YACnC,OAAO,EAAE,iCAA2B;SACvC,CAAC,CAAA;QACF,IAAI,CAAC;YACD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YACtE,OAAO,GAAG,CAAC,QAAQ,CAAA;QACvB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,CAAC,KAAK,CAAC,6CAA6C,GAAG,EAAE,CAAC,CAAA;YAChE,OAAO,KAAK,CAAA;QAChB,CAAC;IACL,CAAC;CACJ;AAlBD,4DAkBC"}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { ServerCallContext } from '@protobuf-ts/runtime-rpc';
|
|
2
|
-
import { TemporaryConnectionRequest, TemporaryConnectionResponse } from '../../proto/packages/trackerless-network/protos/NetworkRpc';
|
|
2
|
+
import { CloseTemporaryConnection, TemporaryConnectionRequest, TemporaryConnectionResponse } from '../../proto/packages/trackerless-network/protos/NetworkRpc';
|
|
3
3
|
import { ITemporaryConnectionRpc } from '../../proto/packages/trackerless-network/protos/NetworkRpc.server';
|
|
4
|
-
import { ListeningRpcCommunicator } from '@streamr/dht';
|
|
4
|
+
import { ConnectionLocker, DhtAddress, ListeningRpcCommunicator } from '@streamr/dht';
|
|
5
5
|
import { NodeList } from '../NodeList';
|
|
6
6
|
import { PeerDescriptor } from '../../proto/packages/dht/protos/DhtRpc';
|
|
7
|
+
import { Empty } from '../../proto/google/protobuf/empty';
|
|
7
8
|
import { StreamPartID } from '@streamr/protocol';
|
|
8
9
|
interface TemporaryConnectionRpcLocalConfig {
|
|
9
|
-
streamPartId: StreamPartID;
|
|
10
10
|
rpcCommunicator: ListeningRpcCommunicator;
|
|
11
11
|
localPeerDescriptor: PeerDescriptor;
|
|
12
|
+
streamPartId: StreamPartID;
|
|
13
|
+
connectionLocker: ConnectionLocker;
|
|
12
14
|
}
|
|
13
15
|
export declare class TemporaryConnectionRpcLocal implements ITemporaryConnectionRpc {
|
|
14
16
|
private readonly config;
|
|
15
17
|
private readonly temporaryNodes;
|
|
18
|
+
private readonly lockId;
|
|
16
19
|
constructor(config: TemporaryConnectionRpcLocalConfig);
|
|
17
20
|
getNodes(): NodeList;
|
|
18
|
-
|
|
21
|
+
hasNode(node: DhtAddress): boolean;
|
|
22
|
+
removeNode(nodeId: DhtAddress): void;
|
|
19
23
|
openConnection(_request: TemporaryConnectionRequest, context: ServerCallContext): Promise<TemporaryConnectionResponse>;
|
|
24
|
+
closeConnection(_request: CloseTemporaryConnection, context: ServerCallContext): Promise<Empty>;
|
|
20
25
|
}
|
|
21
26
|
export {};
|
|
@@ -1,30 +1,45 @@
|
|
|
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
|
-
const proto_rpc_1 = require("@streamr/proto-rpc");
|
|
7
7
|
const DeliveryRpcRemote_1 = require("../DeliveryRpcRemote");
|
|
8
|
-
const
|
|
8
|
+
const LOCK_ID_BASE = 'system/delivery/temporary-connection/';
|
|
9
9
|
class TemporaryConnectionRpcLocal {
|
|
10
|
+
config;
|
|
11
|
+
temporaryNodes;
|
|
12
|
+
lockId;
|
|
10
13
|
constructor(config) {
|
|
11
14
|
this.config = config;
|
|
12
|
-
|
|
15
|
+
// TODO use config option or named constant?
|
|
16
|
+
this.temporaryNodes = new NodeList_1.NodeList((0, dht_1.getNodeIdFromPeerDescriptor)(config.localPeerDescriptor), 10);
|
|
17
|
+
this.lockId = LOCK_ID_BASE + config.streamPartId;
|
|
13
18
|
}
|
|
14
19
|
getNodes() {
|
|
15
20
|
return this.temporaryNodes;
|
|
16
21
|
}
|
|
17
|
-
|
|
18
|
-
this.temporaryNodes.
|
|
22
|
+
hasNode(node) {
|
|
23
|
+
return this.temporaryNodes.has(node);
|
|
24
|
+
}
|
|
25
|
+
removeNode(nodeId) {
|
|
26
|
+
this.temporaryNodes.remove(nodeId);
|
|
27
|
+
this.config.connectionLocker.weakUnlockConnection(nodeId, this.lockId);
|
|
19
28
|
}
|
|
20
29
|
async openConnection(_request, context) {
|
|
21
30
|
const sender = context.incomingSourceDescriptor;
|
|
22
|
-
const remote = new DeliveryRpcRemote_1.DeliveryRpcRemote(this.config.localPeerDescriptor, sender, this.config.
|
|
31
|
+
const remote = new DeliveryRpcRemote_1.DeliveryRpcRemote(this.config.localPeerDescriptor, sender, this.config.rpcCommunicator, NetworkRpc_client_1.DeliveryRpcClient);
|
|
23
32
|
this.temporaryNodes.add(remote);
|
|
33
|
+
this.config.connectionLocker.weakLockConnection((0, dht_1.getNodeIdFromPeerDescriptor)(sender), this.lockId);
|
|
24
34
|
return {
|
|
25
35
|
accepted: true
|
|
26
36
|
};
|
|
27
37
|
}
|
|
38
|
+
async closeConnection(_request, context) {
|
|
39
|
+
const senderId = (0, dht_1.getNodeIdFromPeerDescriptor)(context.incomingSourceDescriptor);
|
|
40
|
+
this.removeNode(senderId);
|
|
41
|
+
return {};
|
|
42
|
+
}
|
|
28
43
|
}
|
|
29
44
|
exports.TemporaryConnectionRpcLocal = TemporaryConnectionRpcLocal;
|
|
30
45
|
//# sourceMappingURL=TemporaryConnectionRpcLocal.js.map
|
|
@@ -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":["../../../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,kBAAkB,CAAC,IAAA,iCAA2B,EAAC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QACjG,OAAO;YACH,QAAQ,EAAE,IAAI;SACjB,CAAA;IACL,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,QAAkC,EAAE,OAA0B;QAChF,MAAM,QAAQ,GAAG,IAAA,iCAA2B,EAAE,OAA0B,CAAC,wBAAyB,CAAC,CAAA;QACnG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;QACzB,OAAO,EAAE,CAAA;IACb,CAAC;CACJ;AAhDD,kEAgDC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare class TemporaryConnectionRpcRemote extends
|
|
1
|
+
import { RpcRemote } from '@streamr/dht';
|
|
2
|
+
import { TemporaryConnectionRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client';
|
|
3
|
+
export declare class TemporaryConnectionRpcRemote extends RpcRemote<TemporaryConnectionRpcClient> {
|
|
4
4
|
openConnection(): Promise<boolean>;
|
|
5
|
+
closeConnection(): Promise<void>;
|
|
5
6
|
}
|
|
@@ -3,19 +3,29 @@ 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
|
-
class TemporaryConnectionRpcRemote extends dht_1.
|
|
7
|
+
class TemporaryConnectionRpcRemote extends dht_1.RpcRemote {
|
|
9
8
|
async openConnection() {
|
|
10
9
|
try {
|
|
11
10
|
const response = await this.getClient().openConnection({}, this.formDhtRpcOptions());
|
|
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
|
}
|
|
18
|
+
async closeConnection() {
|
|
19
|
+
try {
|
|
20
|
+
await this.getClient().closeConnection({}, this.formDhtRpcOptions({
|
|
21
|
+
connect: false,
|
|
22
|
+
notification: true
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
logger.trace(`closeConnection to ${(0, dht_1.getNodeIdFromPeerDescriptor)(this.getPeerDescriptor())} failed: ${err}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
19
29
|
}
|
|
20
30
|
exports.TemporaryConnectionRpcRemote = TemporaryConnectionRpcRemote;
|
|
21
31
|
//# sourceMappingURL=TemporaryConnectionRpcRemote.js.map
|
|
@@ -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,CAAC;YACD,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;QAC5B,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAChB,MAAM,CAAC,KAAK,CAAC,0BAA0B,IAAA,iC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3,"file":"utils.js","sourceRoot":"","sources":["../../../src/logic/utils.ts"],"names":[],"mappings":";;;AAAA,yEAAiF;AAEjF,0CAA4C;AAErC,MAAM,qBAAqB,GAAG,CACjC,kBAAyD,EACzD,cAAyB,EACzB,kBAA+B,EACxB,EAAE;IACT,MAAM,WAAW,GAAG,GAAG,IAAA,mBAAW,EAAC,cAAc,CAAC,WAAW,CAAC,IAAI,cAAc,CAAC,cAAc,EAAE,CAAA;IACjG,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,CAAC;QAC3C,IAAI,qCAAU,CAAC,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAClG,MAAM,iBAAiB,GAAG,IAAI,qCAAU,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAA;IACzG,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;QACvC,kBAAkB,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,mDAAwB,EAAE,CAAC,CAAA;IACvE,CAAC;IACD,OAAO,kBAAkB,CAAC,GAAG,CAAC,WAAW,CAAE,CAAC,YAAY,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAA;AACnG,CAAC,CAAA;AAbY,QAAA,qBAAqB,yBAajC"}
|
|
@@ -8,9 +8,8 @@ const runtime_4 = require("@protobuf-ts/runtime");
|
|
|
8
8
|
const runtime_5 = require("@protobuf-ts/runtime");
|
|
9
9
|
const runtime_6 = require("@protobuf-ts/runtime");
|
|
10
10
|
const runtime_7 = require("@protobuf-ts/runtime");
|
|
11
|
-
const runtime_8 = require("@protobuf-ts/runtime");
|
|
12
11
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
13
|
-
class Any$Type extends
|
|
12
|
+
class Any$Type extends runtime_7.MessageType {
|
|
14
13
|
constructor() {
|
|
15
14
|
super("google.protobuf.Any", [
|
|
16
15
|
{ no: 1, name: "type_url", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
@@ -58,20 +57,20 @@ class Any$Type extends runtime_8.MessageType {
|
|
|
58
57
|
if (any.typeUrl === "")
|
|
59
58
|
return {};
|
|
60
59
|
let typeName = this.typeUrlToName(any.typeUrl);
|
|
61
|
-
let opt = (0,
|
|
60
|
+
let opt = (0, runtime_6.jsonWriteOptions)(options);
|
|
62
61
|
let type = opt.typeRegistry?.find(t => t.typeName === typeName);
|
|
63
62
|
if (!type)
|
|
64
63
|
throw new globalThis.Error("Unable to convert google.protobuf.Any with typeUrl '" + any.typeUrl + "' to JSON. The specified type " + typeName + " is not available in the type registry.");
|
|
65
64
|
let value = type.fromBinary(any.value, { readUnknownField: false });
|
|
66
65
|
let json = type.internalJsonWrite(value, opt);
|
|
67
|
-
if (typeName.startsWith("google.protobuf.") || !(0,
|
|
66
|
+
if (typeName.startsWith("google.protobuf.") || !(0, runtime_4.isJsonObject)(json))
|
|
68
67
|
json = { value: json };
|
|
69
68
|
json["@type"] = any.typeUrl;
|
|
70
69
|
return json;
|
|
71
70
|
}
|
|
72
71
|
internalJsonRead(json, options, target) {
|
|
73
|
-
if (!(0,
|
|
74
|
-
throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON " + (0,
|
|
72
|
+
if (!(0, runtime_4.isJsonObject)(json))
|
|
73
|
+
throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON " + (0, runtime_5.typeofJsonValue)(json) + ".");
|
|
75
74
|
if (typeof json["@type"] != "string" || json["@type"] == "")
|
|
76
75
|
return this.create();
|
|
77
76
|
let typeName = this.typeUrlToName(json["@type"]);
|
|
@@ -107,8 +106,9 @@ class Any$Type extends runtime_8.MessageType {
|
|
|
107
106
|
return name;
|
|
108
107
|
}
|
|
109
108
|
create(value) {
|
|
110
|
-
const message =
|
|
111
|
-
|
|
109
|
+
const message = globalThis.Object.create((this.messagePrototype));
|
|
110
|
+
message.typeUrl = "";
|
|
111
|
+
message.value = new Uint8Array(0);
|
|
112
112
|
if (value !== undefined)
|
|
113
113
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
|
114
114
|
return message;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any.js","sourceRoot":"","sources":["../../../../../src/proto/google/protobuf/any.ts"],"names":[],"mappings":";;;AAoCA,kDAAgD;AAEhD,kDAA2D;AAE3D,kDAA8D;AAC9D,kDAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"any.js","sourceRoot":"","sources":["../../../../../src/proto/google/protobuf/any.ts"],"names":[],"mappings":";;;AAoCA,kDAAgD;AAEhD,kDAA2D;AAE3D,kDAA8D;AAC9D,kDAAoD;AACpD,kDAAuD;AAEvD,kDAAwD;AAKxD,kDAAmD;AA8HnD,2FAA2F;AAC3F,MAAM,QAAS,SAAQ,qBAAgB;IACnC;QACI,KAAK,CAAC,qBAAqB,EAAE;YACzB,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,qBAAqB,EAAE;YACvE,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,oBAAoB,EAAE;SACvE,CAAC,CAAC;IACP,CAAC;IACD;;;;OAIG;IACH,IAAI,CAAmB,OAAU,EAAE,IAAqB;QACpD,OAAO;YACH,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;SAC5E,CAAC;IACN,CAAC;IACD;;OAEG;IACH,MAAM,CAAmB,GAAQ,EAAE,IAAqB,EAAE,OAAoC;QAC1F,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;YACzB,MAAM,IAAI,KAAK,CA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E,QAAQ,EAAE,CAAC,CAAC,CAAC;YACxG,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IACD,mBAAmB,CAAC,OAAY,EAAE,MAAqB,EAAE,OAA2B;QAChF,0BAA0B;QAC1B,IAAI,OAAO,CAAC,OAAO,KAAK,EAAE;YACtB,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,kBAAQ,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACpE,sBAAsB;QACtB,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM;YACpB,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,kBAAQ,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACjE,IAAI,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACnC,IAAI,CAAC,KAAK,KAAK;YACX,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,6BAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAClF,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AACD;;GAEG;AACU,QAAA,GAAG,GAAG,IAAI,QAAQ,EAAE,CAAC"}
|
|
@@ -4,15 +4,13 @@ exports.Empty = void 0;
|
|
|
4
4
|
const runtime_1 = require("@protobuf-ts/runtime");
|
|
5
5
|
const runtime_2 = require("@protobuf-ts/runtime");
|
|
6
6
|
const runtime_3 = require("@protobuf-ts/runtime");
|
|
7
|
-
const runtime_4 = require("@protobuf-ts/runtime");
|
|
8
7
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
9
|
-
class Empty$Type extends
|
|
8
|
+
class Empty$Type extends runtime_3.MessageType {
|
|
10
9
|
constructor() {
|
|
11
10
|
super("google.protobuf.Empty", []);
|
|
12
11
|
}
|
|
13
12
|
create(value) {
|
|
14
|
-
const message =
|
|
15
|
-
globalThis.Object.defineProperty(message, runtime_3.MESSAGE_TYPE, { enumerable: false, value: this });
|
|
13
|
+
const message = globalThis.Object.create((this.messagePrototype));
|
|
16
14
|
if (value !== undefined)
|
|
17
15
|
(0, runtime_2.reflectionMergePartial)(this, message, value);
|
|
18
16
|
return message;
|