@streamr/trackerless-network 100.2.5-beta.1 → 101.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +6 -6
- package/dist/src/NetworkNode.js +1 -1
- package/dist/src/NetworkNode.js.map +1 -1
- package/dist/src/NetworkStack.d.ts +5 -5
- package/dist/src/NetworkStack.js +21 -21
- package/dist/src/NetworkStack.js.map +1 -1
- package/dist/src/exports.d.ts +2 -2
- package/dist/src/exports.js +2 -2
- package/dist/src/exports.js.map +1 -1
- package/dist/src/logic/ContentDeliveryLayerNode.d.ts +5 -5
- package/dist/src/logic/ContentDeliveryLayerNode.js +85 -85
- package/dist/src/logic/ContentDeliveryLayerNode.js.map +1 -1
- package/dist/src/logic/ContentDeliveryManager.d.ts +11 -12
- package/dist/src/logic/ContentDeliveryManager.js +65 -61
- package/dist/src/logic/ContentDeliveryManager.js.map +1 -1
- package/dist/src/logic/ContentDeliveryRpcLocal.d.ts +5 -5
- package/dist/src/logic/ContentDeliveryRpcLocal.js +9 -9
- package/dist/src/logic/ContentDeliveryRpcLocal.js.map +1 -1
- package/dist/src/logic/{Layer0Node.d.ts → ControlLayerNode.d.ts} +1 -1
- package/dist/src/logic/{Layer0Node.js → ControlLayerNode.js} +1 -1
- package/dist/src/logic/ControlLayerNode.js.map +1 -0
- package/dist/src/logic/{Layer1Node.d.ts → DiscoveryLayerNode.d.ts} +8 -8
- package/dist/src/logic/{Layer1Node.js → DiscoveryLayerNode.js} +1 -1
- package/dist/src/logic/DiscoveryLayerNode.js.map +1 -0
- package/dist/src/logic/PeerDescriptorStoreManager.d.ts +28 -0
- package/dist/src/logic/PeerDescriptorStoreManager.js +79 -0
- package/dist/src/logic/PeerDescriptorStoreManager.js.map +1 -0
- package/dist/src/logic/StreamPartNetworkSplitAvoidance.d.ts +5 -5
- package/dist/src/logic/StreamPartNetworkSplitAvoidance.js +8 -8
- package/dist/src/logic/StreamPartNetworkSplitAvoidance.js.map +1 -1
- package/dist/src/logic/StreamPartReconnect.d.ts +5 -5
- package/dist/src/logic/StreamPartReconnect.js +10 -10
- package/dist/src/logic/StreamPartReconnect.js.map +1 -1
- package/dist/src/logic/createContentDeliveryLayerNode.d.ts +3 -3
- package/dist/src/logic/createContentDeliveryLayerNode.js +34 -34
- package/dist/src/logic/createContentDeliveryLayerNode.js.map +1 -1
- package/dist/src/logic/inspect/InspectSession.d.ts +3 -3
- package/dist/src/logic/inspect/InspectSession.js +5 -5
- package/dist/src/logic/inspect/InspectSession.js.map +1 -1
- package/dist/src/logic/inspect/Inspector.d.ts +2 -2
- package/dist/src/logic/inspect/Inspector.js +8 -8
- package/dist/src/logic/inspect/Inspector.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.d.ts +4 -4
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js +24 -24
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.d.ts +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js +4 -4
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/Handshaker.d.ts +3 -3
- package/dist/src/logic/neighbor-discovery/Handshaker.js +37 -37
- 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 +9 -9
- package/dist/src/logic/neighbor-discovery/NeighborFinder.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.d.ts +3 -3
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js +12 -12
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.d.ts +3 -3
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js +14 -14
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js.map +1 -1
- package/dist/src/logic/proxy/ProxyClient.d.ts +3 -3
- package/dist/src/logic/proxy/ProxyClient.js +25 -25
- package/dist/src/logic/proxy/ProxyClient.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.d.ts +3 -3
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js +10 -10
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.d.ts +3 -3
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js +11 -11
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +4 -4
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +8 -8
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +11 -3
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +7 -5
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +2 -2
- package/dist/src/proto/packages/proto-rpc/protos/ProtoRpc.js +1 -1
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.js +1 -1
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.d.ts +6 -23
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js +5 -23
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js.map +1 -1
- package/dist/test/benchmark/first-message.js +7 -7
- package/dist/test/benchmark/first-message.js.map +1 -1
- package/dist/test/utils/utils.d.ts +2 -2
- package/dist/test/utils/utils.js +3 -3
- package/dist/test/utils/utils.js.map +1 -1
- package/package.json +6 -6
- package/protos/NetworkRpc.proto +3 -9
- package/src/NetworkNode.ts +1 -1
- package/src/NetworkStack.ts +24 -24
- package/src/exports.ts +2 -2
- package/src/logic/ContentDeliveryLayerNode.ts +112 -112
- package/src/logic/ContentDeliveryManager.ts +71 -67
- package/src/logic/ContentDeliveryRpcLocal.ts +12 -12
- package/src/logic/{Layer0Node.ts → ControlLayerNode.ts} +1 -1
- package/src/logic/{Layer1Node.ts → DiscoveryLayerNode.ts} +8 -8
- package/src/logic/PeerDescriptorStoreManager.ts +97 -0
- package/src/logic/StreamPartNetworkSplitAvoidance.ts +11 -11
- package/src/logic/StreamPartReconnect.ts +12 -12
- package/src/logic/createContentDeliveryLayerNode.ts +38 -38
- package/src/logic/inspect/InspectSession.ts +6 -6
- package/src/logic/inspect/Inspector.ts +9 -9
- package/src/logic/neighbor-discovery/HandshakeRpcLocal.ts +26 -26
- package/src/logic/neighbor-discovery/HandshakeRpcRemote.ts +6 -6
- package/src/logic/neighbor-discovery/Handshaker.ts +45 -45
- package/src/logic/neighbor-discovery/NeighborFinder.ts +10 -10
- package/src/logic/neighbor-discovery/NeighborUpdateManager.ts +14 -14
- package/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts +17 -17
- package/src/logic/proxy/ProxyClient.ts +26 -26
- package/src/logic/proxy/ProxyConnectionRpcLocal.ts +12 -12
- package/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts +13 -13
- package/src/proto/google/protobuf/any.ts +1 -1
- package/src/proto/google/protobuf/empty.ts +1 -1
- package/src/proto/google/protobuf/timestamp.ts +1 -1
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +9 -9
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +3 -3
- package/src/proto/packages/dht/protos/DhtRpc.ts +15 -5
- package/src/proto/packages/proto-rpc/protos/ProtoRpc.ts +1 -1
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.client.ts +1 -1
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.server.ts +1 -1
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.ts +10 -27
- package/test/benchmark/StreamPartIdDataKeyDistribution.test.ts +1 -1
- package/test/benchmark/first-message.ts +9 -9
- package/test/end-to-end/content-delivery-layer-node-with-real-connections.test.ts +12 -12
- package/test/end-to-end/proxy-and-full-node.test.ts +4 -4
- package/test/integration/ContentDeliveryLayerNode-Layer1Node-Latencies.test.ts +19 -19
- package/test/integration/ContentDeliveryLayerNode-Layer1Node.test.ts +19 -19
- package/test/integration/ContentDeliveryManager.test.ts +11 -11
- package/test/integration/Inspect.test.ts +1 -1
- package/test/integration/Propagation.test.ts +6 -6
- package/test/integration/joining-streams-on-offline-peers.test.ts +3 -3
- package/test/integration/stream-without-default-entrypoints.test.ts +2 -2
- package/test/integration/streamEntryPointReplacing.test.ts +2 -2
- package/test/unit/ContentDeliveryLayerNode.test.ts +11 -11
- package/test/unit/ContentDeliveryManager.test.ts +2 -2
- package/test/unit/{EntrypointDiscovery.test.ts → PeerDescriptorStoreManager.test.ts} +28 -29
- package/test/unit/StreamPartIDDataKey.test.ts +1 -1
- package/test/unit/StreamPartNetworkSplitAvoidance.test.ts +8 -8
- package/test/unit/StreamPartReconnect.test.ts +9 -9
- package/test/utils/fake/FakePeerDescriptorStoreManager.ts +29 -0
- package/test/utils/mock/{MockLayer0Node.ts → MockControlLayerNode.ts} +2 -2
- package/test/utils/mock/{MockLayer1Node.ts → MockDiscoveryLayerNode.ts} +2 -2
- package/test/utils/utils.ts +5 -5
- package/dist/src/logic/EntryPointDiscovery.d.ts +0 -27
- package/dist/src/logic/EntryPointDiscovery.js +0 -80
- package/dist/src/logic/EntryPointDiscovery.js.map +0 -1
- package/dist/src/logic/Layer0Node.js.map +0 -1
- package/dist/src/logic/Layer1Node.js.map +0 -1
- package/src/logic/EntryPointDiscovery.ts +0 -100
- package/test/utils/fake/FakeEntryPointDiscovery.ts +0 -29
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PeerDescriptorStoreManager = exports.MAX_NODE_COUNT = void 0;
|
|
4
|
+
const dht_1 = require("@streamr/dht");
|
|
5
|
+
const utils_1 = require("@streamr/utils");
|
|
6
|
+
const any_1 = require("../proto/google/protobuf/any");
|
|
7
|
+
const parsePeerDescriptor = (dataEntries) => {
|
|
8
|
+
return dataEntries.filter((entry) => !entry.deleted).map((entry) => any_1.Any.unpack(entry.data, dht_1.PeerDescriptor));
|
|
9
|
+
};
|
|
10
|
+
const logger = new utils_1.Logger(module);
|
|
11
|
+
exports.MAX_NODE_COUNT = 8;
|
|
12
|
+
/**
|
|
13
|
+
* For each key there is usually 0-MAX_NODE_COUNT PeerDescriptors stored in the DHT. If there are fewer node,
|
|
14
|
+
* the peer descriptor of the local node is stored to the DHT.
|
|
15
|
+
*/
|
|
16
|
+
class PeerDescriptorStoreManager {
|
|
17
|
+
abortController;
|
|
18
|
+
options;
|
|
19
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
20
|
+
isLocalNodeStored_ = false;
|
|
21
|
+
constructor(options) {
|
|
22
|
+
this.options = options;
|
|
23
|
+
this.abortController = new AbortController();
|
|
24
|
+
}
|
|
25
|
+
async fetchNodes() {
|
|
26
|
+
logger.trace('Fetch data', { key: this.options.key });
|
|
27
|
+
try {
|
|
28
|
+
const result = await this.options.fetchDataFromDht(this.options.key);
|
|
29
|
+
return parsePeerDescriptor(result);
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async storeAndKeepLocalNode() {
|
|
36
|
+
if (this.abortController.signal.aborted) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
40
|
+
this.isLocalNodeStored_ = true;
|
|
41
|
+
await this.storeLocalNode();
|
|
42
|
+
await this.keepLocalNode();
|
|
43
|
+
}
|
|
44
|
+
async storeLocalNode() {
|
|
45
|
+
const localPeerDescriptor = this.options.localPeerDescriptor;
|
|
46
|
+
const dataToStore = any_1.Any.pack(localPeerDescriptor, dht_1.PeerDescriptor);
|
|
47
|
+
try {
|
|
48
|
+
await this.options.storeDataToDht(this.options.key, dataToStore);
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
logger.warn('Failed to store local node', { key: this.options.key });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async keepLocalNode() {
|
|
55
|
+
await (0, utils_1.scheduleAtInterval)(async () => {
|
|
56
|
+
logger.trace('Attempting to keep local node', { key: this.options.key });
|
|
57
|
+
try {
|
|
58
|
+
const discovered = await this.fetchNodes();
|
|
59
|
+
if (discovered.length < exports.MAX_NODE_COUNT
|
|
60
|
+
|| discovered.some((peerDescriptor) => (0, dht_1.areEqualPeerDescriptors)(peerDescriptor, this.options.localPeerDescriptor))) {
|
|
61
|
+
await this.storeLocalNode();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
logger.debug('Failed to keep local node', { key: this.options.key });
|
|
66
|
+
}
|
|
67
|
+
}, this.options.storeInterval ?? 60000, false, this.abortController.signal);
|
|
68
|
+
}
|
|
69
|
+
isLocalNodeStored() {
|
|
70
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
71
|
+
return this.isLocalNodeStored_;
|
|
72
|
+
}
|
|
73
|
+
async destroy() {
|
|
74
|
+
this.abortController.abort();
|
|
75
|
+
await this.options.deleteDataFromDht(this.options.key, false);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.PeerDescriptorStoreManager = PeerDescriptorStoreManager;
|
|
79
|
+
//# sourceMappingURL=PeerDescriptorStoreManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PeerDescriptorStoreManager.js","sourceRoot":"","sources":["../../../src/logic/PeerDescriptorStoreManager.ts"],"names":[],"mappings":";;;AAAA,sCAKqB;AACrB,0CAA2D;AAC3D,sDAAkD;AAElD,MAAM,mBAAmB,GAAG,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IAAI,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;IAC/E,CAAC;IAEM,iBAAiB;QACpB,gDAAgD;QAChD,OAAO,IAAI,CAAC,kBAAkB,CAAA;IAClC,CAAC;IAED,KAAK,CAAC,OAAO;QACT,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAA;QAC5B,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACjE,CAAC;CACJ;AAlED,gEAkEC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { DhtAddress, PeerDescriptor } from '@streamr/dht';
|
|
2
|
-
import {
|
|
2
|
+
import { DiscoveryLayerNode } from './DiscoveryLayerNode';
|
|
3
3
|
export declare const MIN_NEIGHBOR_COUNT = 4;
|
|
4
|
-
export interface
|
|
5
|
-
|
|
4
|
+
export interface StreamPartNetworkSplitAvoidanceOptions {
|
|
5
|
+
discoveryLayerNode: DiscoveryLayerNode;
|
|
6
6
|
discoverEntryPoints: (excludedNodes?: Set<DhtAddress>) => Promise<PeerDescriptor[]>;
|
|
7
7
|
exponentialRunOfBaseDelay?: number;
|
|
8
8
|
}
|
|
9
9
|
export declare class StreamPartNetworkSplitAvoidance {
|
|
10
10
|
private readonly abortController;
|
|
11
|
-
private readonly
|
|
11
|
+
private readonly options;
|
|
12
12
|
private readonly excludedNodes;
|
|
13
13
|
private running;
|
|
14
|
-
constructor(
|
|
14
|
+
constructor(options: StreamPartNetworkSplitAvoidanceOptions);
|
|
15
15
|
avoidNetworkSplit(): Promise<void>;
|
|
16
16
|
isRunning(): boolean;
|
|
17
17
|
destroy(): void;
|
|
@@ -35,29 +35,29 @@ const exponentialRunOff = async (task, description, abortSignal, baseDelay = 500
|
|
|
35
35
|
exports.MIN_NEIGHBOR_COUNT = 4;
|
|
36
36
|
class StreamPartNetworkSplitAvoidance {
|
|
37
37
|
abortController;
|
|
38
|
-
|
|
38
|
+
options;
|
|
39
39
|
excludedNodes = new Set();
|
|
40
40
|
running = false;
|
|
41
|
-
constructor(
|
|
42
|
-
this.
|
|
41
|
+
constructor(options) {
|
|
42
|
+
this.options = options;
|
|
43
43
|
this.abortController = new AbortController();
|
|
44
44
|
}
|
|
45
45
|
async avoidNetworkSplit() {
|
|
46
46
|
this.running = true;
|
|
47
47
|
await exponentialRunOff(async () => {
|
|
48
|
-
const discoveredEntrypoints = await this.
|
|
48
|
+
const discoveredEntrypoints = await this.options.discoverEntryPoints();
|
|
49
49
|
const filteredEntryPoints = discoveredEntrypoints.filter((peer) => !this.excludedNodes.has((0, dht_1.getNodeIdFromPeerDescriptor)(peer)));
|
|
50
|
-
await this.
|
|
51
|
-
if (this.
|
|
50
|
+
await this.options.discoveryLayerNode.joinDht(filteredEntryPoints, false, false);
|
|
51
|
+
if (this.options.discoveryLayerNode.getNeighborCount() < exports.MIN_NEIGHBOR_COUNT) {
|
|
52
52
|
// Filter out nodes that are not neighbors as those nodes are assumed to be offline
|
|
53
53
|
const newExcludes = filteredEntryPoints
|
|
54
|
-
.filter((peer) => !this.
|
|
54
|
+
.filter((peer) => !this.options.discoveryLayerNode.getNeighbors()
|
|
55
55
|
.some((neighbor) => (0, dht_1.areEqualPeerDescriptors)(neighbor, peer)))
|
|
56
56
|
.map((peer) => (0, dht_1.getNodeIdFromPeerDescriptor)(peer));
|
|
57
57
|
newExcludes.forEach((node) => this.excludedNodes.add(node));
|
|
58
58
|
throw new Error(`Network split is still possible`);
|
|
59
59
|
}
|
|
60
|
-
}, 'avoid network split', this.abortController.signal, this.
|
|
60
|
+
}, 'avoid network split', this.abortController.signal, this.options.exponentialRunOfBaseDelay);
|
|
61
61
|
this.running = false;
|
|
62
62
|
this.excludedNodes.clear();
|
|
63
63
|
logger.trace(`Network split avoided`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamPartNetworkSplitAvoidance.js","sourceRoot":"","sources":["../../../src/logic/StreamPartNetworkSplitAvoidance.ts"],"names":[],"mappings":";;;AAAA,sCAA+G;AAC/G,0CAA6C;AAG7C;;;;;;GAMG;AAEH,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAEjC,MAAM,iBAAiB,GAAG,KAAK,EAC3B,IAAyB,EACzB,WAAmB,EACnB,WAAwB,EACxB,SAAS,GAAG,GAAG,EACf,WAAW,GAAG,CAAC,EACF,EAAE;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YACtB,OAAM;QACV,CAAC;QACD,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,CAAA;QACrB,MAAM,KAAK,GAAG,SAAS,GAAG,MAAM,CAAA;QAChC,IAAI,CAAC;YACD,MAAM,IAAI,EAAE,CAAA;QAChB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YACd,MAAM,CAAC,KAAK,CAAC,GAAG,WAAW,wBAAwB,KAAK,KAAK,CAAC,CAAA;QAClE,CAAC;QACD,IAAI,CAAC,CAAC,wDAAwD;YAC1D,MAAM,IAAA,YAAI,EAAC,KAAK,EAAE,WAAW,CAAC,CAAA;QAClC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,CAAA,CAAE,2BAA2B;QACvD,CAAC;IACL,CAAC;AACL,CAAC,CAAA;AAEY,QAAA,kBAAkB,GAAG,CAAC,CAAA;AAQnC,MAAa,+BAA+B;IAEvB,eAAe,CAAiB;IAChC,
|
|
1
|
+
{"version":3,"file":"StreamPartNetworkSplitAvoidance.js","sourceRoot":"","sources":["../../../src/logic/StreamPartNetworkSplitAvoidance.ts"],"names":[],"mappings":";;;AAAA,sCAA+G;AAC/G,0CAA6C;AAG7C;;;;;;GAMG;AAEH,MAAM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AE,CAAA;QAC1B,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAA;IACzC,CAAC;IAEM,SAAS;QACZ,OAAO,IAAI,CAAC,OAAO,CAAA;IACvB,CAAC;IAED,OAAO;QACH,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAA;IAChC,CAAC;CACJ;AAxCD,0EAwCC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { PeerDescriptorStoreManager } from './PeerDescriptorStoreManager';
|
|
2
|
+
import { DiscoveryLayerNode } from './DiscoveryLayerNode';
|
|
3
3
|
export declare class StreamPartReconnect {
|
|
4
4
|
private abortController?;
|
|
5
|
-
private readonly
|
|
6
|
-
private readonly
|
|
7
|
-
constructor(
|
|
5
|
+
private readonly discoveryLayerNode;
|
|
6
|
+
private readonly peerDescriptorStoreManager;
|
|
7
|
+
constructor(discoveryLayerNode: DiscoveryLayerNode, peerDescriptorStoreManager: PeerDescriptorStoreManager);
|
|
8
8
|
reconnect(timeout?: number): Promise<void>;
|
|
9
9
|
isRunning(): boolean;
|
|
10
10
|
destroy(): void;
|
|
@@ -5,21 +5,21 @@ const utils_1 = require("@streamr/utils");
|
|
|
5
5
|
const DEFAULT_RECONNECT_INTERVAL = 30 * 1000;
|
|
6
6
|
class StreamPartReconnect {
|
|
7
7
|
abortController;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
constructor(
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
8
|
+
discoveryLayerNode;
|
|
9
|
+
peerDescriptorStoreManager;
|
|
10
|
+
constructor(discoveryLayerNode, peerDescriptorStoreManager) {
|
|
11
|
+
this.discoveryLayerNode = discoveryLayerNode;
|
|
12
|
+
this.peerDescriptorStoreManager = peerDescriptorStoreManager;
|
|
13
13
|
}
|
|
14
14
|
async reconnect(timeout = DEFAULT_RECONNECT_INTERVAL) {
|
|
15
15
|
this.abortController = new AbortController();
|
|
16
16
|
await (0, utils_1.scheduleAtInterval)(async () => {
|
|
17
|
-
const entryPoints = await this.
|
|
18
|
-
await this.
|
|
19
|
-
if (this.
|
|
20
|
-
await this.
|
|
17
|
+
const entryPoints = await this.peerDescriptorStoreManager.fetchNodes();
|
|
18
|
+
await this.discoveryLayerNode.joinDht(entryPoints);
|
|
19
|
+
if (this.peerDescriptorStoreManager.isLocalNodeStored()) {
|
|
20
|
+
await this.peerDescriptorStoreManager.storeAndKeepLocalNode();
|
|
21
21
|
}
|
|
22
|
-
if (this.
|
|
22
|
+
if (this.discoveryLayerNode.getNeighborCount() > 0) {
|
|
23
23
|
this.abortController.abort();
|
|
24
24
|
}
|
|
25
25
|
}, timeout, true, this.abortController.signal);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamPartReconnect.js","sourceRoot":"","sources":["../../../src/logic/StreamPartReconnect.ts"],"names":[],"mappings":";;;AAAA,0CAAmD;AAInD,MAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,CAAA;AAC5C,MAAa,mBAAmB;IACpB,eAAe,CAAkB;IACxB,
|
|
1
|
+
{"version":3,"file":"StreamPartReconnect.js","sourceRoot":"","sources":["../../../src/logic/StreamPartReconnect.ts"],"names":[],"mappings":";;;AAAA,0CAAmD;AAInD,MAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,CAAA;AAC5C,MAAa,mBAAmB;IACpB,eAAe,CAAkB;IACxB,kBAAkB,CAAoB;IACtC,0BAA0B,CAA4B;IAEvE,YAAY,kBAAsC,EAAE,0BAAsD;QACtG,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAA;QAC5C,IAAI,CAAC,0BAA0B,GAAG,0BAA0B,CAAA;IAChE,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,0BAA0B;QAChD,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,EAAE,CAAA;QAC5C,MAAM,IAAA,0BAAkB,EAAC,KAAK,IAAI,EAAE;YAChC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,0BAA0B,CAAC,UAAU,EAAE,CAAA;YACtE,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;YAClD,IAAI,IAAI,CAAC,0BAA0B,CAAC,iBAAiB,EAAE,EAAE,CAAC;gBACtD,MAAM,IAAI,CAAC,0BAA0B,CAAC,qBAAqB,EAAE,CAAA;YACjE,CAAC;YACD,IAAI,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,GAAG,CAAC,EAAE,CAAC;gBACjD,IAAI,CAAC,eAAgB,CAAC,KAAK,EAAE,CAAA;YACjC,CAAC;QACL,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;IAClD,CAAC;IAED,SAAS;QACL,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAA;IAC9E,CAAC;IAED,OAAO;QACH,IAAI,CAAC,eAAe,EAAE,KAAK,EAAE,CAAA;IACjC,CAAC;CACJ;AA/BD,kDA+BC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StrictContentDeliveryLayerNodeOptions, ContentDeliveryLayerNode } from './ContentDeliveryLayerNode';
|
|
2
2
|
import { MarkOptional } from 'ts-essentials';
|
|
3
|
-
type
|
|
3
|
+
type ContentDeliveryLayerNodeOptions = MarkOptional<StrictContentDeliveryLayerNodeOptions, 'nearbyNodeView' | 'randomNodeView' | 'neighbors' | 'leftNodeView' | 'rightNodeView' | 'propagation' | 'handshaker' | 'neighborFinder' | 'neighborUpdateManager' | 'neighborTargetCount' | 'rpcCommunicator' | 'nodeViewSize' | 'inspector' | 'temporaryConnectionRpcLocal'> & {
|
|
4
4
|
maxContactCount?: number;
|
|
5
5
|
minPropagationTargets?: number;
|
|
6
6
|
acceptProxyConnections?: boolean;
|
|
7
7
|
neighborUpdateInterval?: number;
|
|
8
8
|
};
|
|
9
|
-
export declare const createContentDeliveryLayerNode: (
|
|
9
|
+
export declare const createContentDeliveryLayerNode: (options: ContentDeliveryLayerNodeOptions) => ContentDeliveryLayerNode;
|
|
10
10
|
export {};
|
|
@@ -12,32 +12,32 @@ const ProxyConnectionRpcLocal_1 = require("./proxy/ProxyConnectionRpcLocal");
|
|
|
12
12
|
const Inspector_1 = require("./inspect/Inspector");
|
|
13
13
|
const TemporaryConnectionRpcLocal_1 = require("./temporary-connection/TemporaryConnectionRpcLocal");
|
|
14
14
|
const formStreamPartDeliveryServiceId_1 = require("./formStreamPartDeliveryServiceId");
|
|
15
|
-
const createConfigWithDefaults = (
|
|
16
|
-
const ownNodeId = (0, dht_1.getNodeIdFromPeerDescriptor)(
|
|
17
|
-
const rpcCommunicator =
|
|
18
|
-
const neighborTargetCount =
|
|
19
|
-
const maxContactCount =
|
|
20
|
-
const minPropagationTargets =
|
|
21
|
-
const acceptProxyConnections =
|
|
22
|
-
const neighborUpdateInterval =
|
|
23
|
-
const neighbors =
|
|
24
|
-
const leftNodeView =
|
|
25
|
-
const rightNodeView =
|
|
26
|
-
const nearbyNodeView =
|
|
27
|
-
const randomNodeView =
|
|
15
|
+
const createConfigWithDefaults = (options) => {
|
|
16
|
+
const ownNodeId = (0, dht_1.getNodeIdFromPeerDescriptor)(options.localPeerDescriptor);
|
|
17
|
+
const rpcCommunicator = options.rpcCommunicator ?? new dht_1.ListeningRpcCommunicator((0, formStreamPartDeliveryServiceId_1.formStreamPartContentDeliveryServiceId)(options.streamPartId), options.transport);
|
|
18
|
+
const neighborTargetCount = options.neighborTargetCount ?? 4;
|
|
19
|
+
const maxContactCount = options.maxContactCount ?? 20;
|
|
20
|
+
const minPropagationTargets = options.minPropagationTargets ?? 2;
|
|
21
|
+
const acceptProxyConnections = options.acceptProxyConnections ?? false;
|
|
22
|
+
const neighborUpdateInterval = options.neighborUpdateInterval ?? 10000;
|
|
23
|
+
const neighbors = options.neighbors ?? new NodeList_1.NodeList(ownNodeId, maxContactCount);
|
|
24
|
+
const leftNodeView = options.leftNodeView ?? new NodeList_1.NodeList(ownNodeId, maxContactCount);
|
|
25
|
+
const rightNodeView = options.rightNodeView ?? new NodeList_1.NodeList(ownNodeId, maxContactCount);
|
|
26
|
+
const nearbyNodeView = options.nearbyNodeView ?? new NodeList_1.NodeList(ownNodeId, maxContactCount);
|
|
27
|
+
const randomNodeView = options.randomNodeView ?? new NodeList_1.NodeList(ownNodeId, maxContactCount);
|
|
28
28
|
const ongoingHandshakes = new Set();
|
|
29
29
|
const temporaryConnectionRpcLocal = new TemporaryConnectionRpcLocal_1.TemporaryConnectionRpcLocal({
|
|
30
30
|
rpcCommunicator,
|
|
31
|
-
localPeerDescriptor:
|
|
32
|
-
streamPartId:
|
|
33
|
-
connectionLocker:
|
|
31
|
+
localPeerDescriptor: options.localPeerDescriptor,
|
|
32
|
+
streamPartId: options.streamPartId,
|
|
33
|
+
connectionLocker: options.connectionLocker
|
|
34
34
|
});
|
|
35
35
|
const proxyConnectionRpcLocal = acceptProxyConnections ? new ProxyConnectionRpcLocal_1.ProxyConnectionRpcLocal({
|
|
36
|
-
localPeerDescriptor:
|
|
37
|
-
streamPartId:
|
|
36
|
+
localPeerDescriptor: options.localPeerDescriptor,
|
|
37
|
+
streamPartId: options.streamPartId,
|
|
38
38
|
rpcCommunicator
|
|
39
39
|
}) : undefined;
|
|
40
|
-
const propagation =
|
|
40
|
+
const propagation = options.propagation ?? new Propagation_1.Propagation({
|
|
41
41
|
minPropagationTargets,
|
|
42
42
|
sendToNeighbor: async (neighborId, msg) => {
|
|
43
43
|
const remote = neighbors.get(neighborId) ?? temporaryConnectionRpcLocal.getNodes().get(neighborId);
|
|
@@ -53,9 +53,9 @@ const createConfigWithDefaults = (config) => {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
-
const handshaker =
|
|
57
|
-
localPeerDescriptor:
|
|
58
|
-
streamPartId:
|
|
56
|
+
const handshaker = options.handshaker ?? new Handshaker_1.Handshaker({
|
|
57
|
+
localPeerDescriptor: options.localPeerDescriptor,
|
|
58
|
+
streamPartId: options.streamPartId,
|
|
59
59
|
rpcCommunicator,
|
|
60
60
|
neighbors,
|
|
61
61
|
leftNodeView,
|
|
@@ -63,10 +63,10 @@ const createConfigWithDefaults = (config) => {
|
|
|
63
63
|
nearbyNodeView,
|
|
64
64
|
randomNodeView,
|
|
65
65
|
maxNeighborCount: neighborTargetCount,
|
|
66
|
-
rpcRequestTimeout:
|
|
66
|
+
rpcRequestTimeout: options.rpcRequestTimeout,
|
|
67
67
|
ongoingHandshakes
|
|
68
68
|
});
|
|
69
|
-
const neighborFinder =
|
|
69
|
+
const neighborFinder = options.neighborFinder ?? new NeighborFinder_1.NeighborFinder({
|
|
70
70
|
neighbors,
|
|
71
71
|
leftNodeView,
|
|
72
72
|
rightNodeView,
|
|
@@ -75,25 +75,25 @@ const createConfigWithDefaults = (config) => {
|
|
|
75
75
|
doFindNeighbors: (excludedIds) => handshaker.attemptHandshakesOnContacts(excludedIds),
|
|
76
76
|
minCount: neighborTargetCount
|
|
77
77
|
});
|
|
78
|
-
const neighborUpdateManager =
|
|
78
|
+
const neighborUpdateManager = options.neighborUpdateManager ?? new NeighborUpdateManager_1.NeighborUpdateManager({
|
|
79
79
|
neighbors,
|
|
80
80
|
nearbyNodeView,
|
|
81
|
-
localPeerDescriptor:
|
|
81
|
+
localPeerDescriptor: options.localPeerDescriptor,
|
|
82
82
|
neighborFinder,
|
|
83
|
-
streamPartId:
|
|
83
|
+
streamPartId: options.streamPartId,
|
|
84
84
|
rpcCommunicator,
|
|
85
85
|
neighborUpdateInterval,
|
|
86
86
|
neighborTargetCount,
|
|
87
87
|
ongoingHandshakes
|
|
88
88
|
});
|
|
89
|
-
const inspector =
|
|
90
|
-
localPeerDescriptor:
|
|
89
|
+
const inspector = options.inspector ?? new Inspector_1.Inspector({
|
|
90
|
+
localPeerDescriptor: options.localPeerDescriptor,
|
|
91
91
|
rpcCommunicator,
|
|
92
|
-
streamPartId:
|
|
93
|
-
connectionLocker:
|
|
92
|
+
streamPartId: options.streamPartId,
|
|
93
|
+
connectionLocker: options.connectionLocker
|
|
94
94
|
});
|
|
95
95
|
return {
|
|
96
|
-
...
|
|
96
|
+
...options,
|
|
97
97
|
neighbors,
|
|
98
98
|
leftNodeView,
|
|
99
99
|
rightNodeView,
|
|
@@ -111,8 +111,8 @@ const createConfigWithDefaults = (config) => {
|
|
|
111
111
|
temporaryConnectionRpcLocal
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
|
-
const createContentDeliveryLayerNode = (
|
|
115
|
-
return new ContentDeliveryLayerNode_1.ContentDeliveryLayerNode(createConfigWithDefaults(
|
|
114
|
+
const createContentDeliveryLayerNode = (options) => {
|
|
115
|
+
return new ContentDeliveryLayerNode_1.ContentDeliveryLayerNode(createConfigWithDefaults(options));
|
|
116
116
|
};
|
|
117
117
|
exports.createContentDeliveryLayerNode = createContentDeliveryLayerNode;
|
|
118
118
|
//# sourceMappingURL=createContentDeliveryLayerNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createContentDeliveryLayerNode.js","sourceRoot":"","sources":["../../../src/logic/createContentDeliveryLayerNode.ts"],"names":[],"mappings":";;;AAAA,sCAAgG;AAChG,gEAA4D;AAC5D,wEAAoE;AACpE,sFAAkF;AAClF,
|
|
1
|
+
{"version":3,"file":"createContentDeliveryLayerNode.js","sourceRoot":"","sources":["../../../src/logic/createContentDeliveryLayerNode.ts"],"names":[],"mappings":";;;AAAA,sCAAgG;AAChG,gEAA4D;AAC5D,wEAAoE;AACpE,sFAAkF;AAClF,yEAA4G;AAC5G,yCAAqC;AACrC,2DAAuD;AAGvD,6EAAyE;AACzE,mDAA+C;AAC/C,oGAAgG;AAChG,uFAA0F;AAa1F,MAAM,wBAAwB,GAAG,CAAC,OAAwC,EAAyC,EAAE;IACjH,MAAM,SAAS,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
|
}
|
|
7
|
-
interface
|
|
7
|
+
interface InspectSessionOptions {
|
|
8
8
|
inspectedNode: DhtAddress;
|
|
9
9
|
}
|
|
10
10
|
export declare class InspectSession extends EventEmitter<Events> {
|
|
11
11
|
private readonly inspectionMessages;
|
|
12
12
|
private readonly inspectedNode;
|
|
13
|
-
constructor(
|
|
14
|
-
markMessage(
|
|
13
|
+
constructor(options: InspectSessionOptions);
|
|
14
|
+
markMessage(remoteNodeId: DhtAddress, messageId: MessageID): void;
|
|
15
15
|
getInspectedMessageCount(): number;
|
|
16
16
|
onlyMarkedByInspectedNode(): boolean;
|
|
17
17
|
stop(): void;
|
|
@@ -10,18 +10,18 @@ class InspectSession extends eventemitter3_1.EventEmitter {
|
|
|
10
10
|
// Boolean indicates if the message has been received by the inspected node
|
|
11
11
|
inspectionMessages = new Map();
|
|
12
12
|
inspectedNode;
|
|
13
|
-
constructor(
|
|
13
|
+
constructor(options) {
|
|
14
14
|
super();
|
|
15
|
-
this.inspectedNode =
|
|
15
|
+
this.inspectedNode = options.inspectedNode;
|
|
16
16
|
}
|
|
17
|
-
markMessage(
|
|
17
|
+
markMessage(remoteNodeId, messageId) {
|
|
18
18
|
const messageKey = createMessageKey(messageId);
|
|
19
19
|
if (!this.inspectionMessages.has(messageKey)) {
|
|
20
|
-
this.inspectionMessages.set(messageKey,
|
|
20
|
+
this.inspectionMessages.set(messageKey, remoteNodeId === this.inspectedNode);
|
|
21
21
|
}
|
|
22
22
|
else if (this.inspectionMessages.has(messageKey)
|
|
23
23
|
&& this.inspectionMessages.get(messageKey) === false
|
|
24
|
-
&&
|
|
24
|
+
&& remoteNodeId === this.inspectedNode) {
|
|
25
25
|
this.emit('done');
|
|
26
26
|
}
|
|
27
27
|
else if (this.inspectionMessages.has(messageKey)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InspectSession.js","sourceRoot":"","sources":["../../../../src/logic/inspect/InspectSession.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE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BAAkB,CAAC,GAAG,CAAC,UAAU,CAAC;eAC3C,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,KAAK;eACjD,YAAY,KAAK,IAAI,CAAC,aAAa,EACxC,CAAC;YACC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACrB,CAAC;aAAM,IAAI,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC;eAC3C,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE,CAAC;YACtD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACrB,CAAC;IACL,CAAC;IAED,wBAAwB;QACpB,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAA;IACvC,CAAC;IAED,yBAAyB;QACrB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAA;IACxF,CAAC;IAED,IAAI;QACA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACrB,CAAC;CACJ;AArCD,wCAqCC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PeerDescriptor, ConnectionLocker, LockID, DhtAddress, ListeningRpcCommunicator } from '@streamr/dht';
|
|
2
2
|
import { MessageID } from '../../proto/packages/trackerless-network/protos/NetworkRpc';
|
|
3
3
|
import { StreamPartID } from '@streamr/protocol';
|
|
4
|
-
interface
|
|
4
|
+
interface InspectorOptions {
|
|
5
5
|
localPeerDescriptor: PeerDescriptor;
|
|
6
6
|
streamPartId: StreamPartID;
|
|
7
7
|
rpcCommunicator: ListeningRpcCommunicator;
|
|
@@ -19,7 +19,7 @@ export declare class Inspector {
|
|
|
19
19
|
private readonly inspectionTimeout;
|
|
20
20
|
private readonly openInspectConnection;
|
|
21
21
|
private readonly closeInspectConnection;
|
|
22
|
-
constructor(
|
|
22
|
+
constructor(options: InspectorOptions);
|
|
23
23
|
defaultOpenInspectConnection(peerDescriptor: PeerDescriptor, lockId: LockID): Promise<void>;
|
|
24
24
|
defaultCloseInspectConnection(peerDescriptor: PeerDescriptor, lockId: LockID): Promise<void>;
|
|
25
25
|
inspect(peerDescriptor: PeerDescriptor): Promise<boolean>;
|
|
@@ -17,14 +17,14 @@ class Inspector {
|
|
|
17
17
|
inspectionTimeout;
|
|
18
18
|
openInspectConnection;
|
|
19
19
|
closeInspectConnection;
|
|
20
|
-
constructor(
|
|
21
|
-
this.streamPartId =
|
|
22
|
-
this.localPeerDescriptor =
|
|
23
|
-
this.rpcCommunicator =
|
|
24
|
-
this.connectionLocker =
|
|
25
|
-
this.inspectionTimeout =
|
|
26
|
-
this.openInspectConnection =
|
|
27
|
-
this.closeInspectConnection =
|
|
20
|
+
constructor(options) {
|
|
21
|
+
this.streamPartId = options.streamPartId;
|
|
22
|
+
this.localPeerDescriptor = options.localPeerDescriptor;
|
|
23
|
+
this.rpcCommunicator = options.rpcCommunicator;
|
|
24
|
+
this.connectionLocker = options.connectionLocker;
|
|
25
|
+
this.inspectionTimeout = options.inspectionTimeout ?? DEFAULT_TIMEOUT;
|
|
26
|
+
this.openInspectConnection = options.openInspectConnection ?? this.defaultOpenInspectConnection;
|
|
27
|
+
this.closeInspectConnection = options.closeInspectConnection ?? this.defaultCloseInspectConnection;
|
|
28
28
|
}
|
|
29
29
|
async defaultOpenInspectConnection(peerDescriptor, lockId) {
|
|
30
30
|
const rpcRemote = new TemporaryConnectionRpcRemote_1.TemporaryConnectionRpcRemote(this.localPeerDescriptor, peerDescriptor, this.rpcCommunicator, NetworkRpc_client_1.TemporaryConnectionRpcClient);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Inspector.js","sourceRoot":"","sources":["../../../../src/logic/inspect/Inspector.ts"],"names":[],"mappings":";;;AAAA,sCAA0I;AAE1I,qD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QACnB,IAAI,CAAC;YACD,MAAM,IAAA,qBAAa,EAAuB,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAA;YAClF,OAAO,GAAG,IAAI,CAAA;QAClB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAA;QACvD,CAAC;gBAAS,CAAC;YACP,MAAM,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;YACzD,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAChC,CAAC;QACD,OAAO,OAAO,IAAI,OAAO,CAAC,wBAAwB,EAAE,GAAG,CAAC,IAAI,OAAO,CAAC,yBAAyB,EAAE,CAAA;IACnG,CAAC;IAED,WAAW,CAAC,MAAkB,EAAE,SAAoB;QAChD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAA;IAC9E,CAAC;IAED,WAAW,CAAC,MAAkB;QAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IACpC,CAAC;IAED,IAAI;QACA,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC9B,OAAO,CAAC,IAAI,EAAE,CAAA;QAClB,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAA;IACzB,CAAC;CAEJ;AA/ED,8BA+EC"}
|
|
@@ -6,7 +6,7 @@ import { IHandshakeRpc } from '../../proto/packages/trackerless-network/protos/N
|
|
|
6
6
|
import { HandshakeRpcRemote } from './HandshakeRpcRemote';
|
|
7
7
|
import { ContentDeliveryRpcRemote } from '../ContentDeliveryRpcRemote';
|
|
8
8
|
import { StreamPartID } from '@streamr/protocol';
|
|
9
|
-
interface
|
|
9
|
+
interface HandshakeRpcLocalOptions {
|
|
10
10
|
streamPartId: StreamPartID;
|
|
11
11
|
neighbors: NodeList;
|
|
12
12
|
ongoingHandshakes: Set<DhtAddress>;
|
|
@@ -14,11 +14,11 @@ interface HandshakeRpcLocalConfig {
|
|
|
14
14
|
maxNeighborCount: number;
|
|
15
15
|
createRpcRemote: (target: PeerDescriptor) => HandshakeRpcRemote;
|
|
16
16
|
createContentDeliveryRpcRemote: (peerDescriptor: PeerDescriptor) => ContentDeliveryRpcRemote;
|
|
17
|
-
handshakeWithInterleaving: (target: PeerDescriptor,
|
|
17
|
+
handshakeWithInterleaving: (target: PeerDescriptor, remoteNodeId: DhtAddress) => Promise<boolean>;
|
|
18
18
|
}
|
|
19
19
|
export declare class HandshakeRpcLocal implements IHandshakeRpc {
|
|
20
|
-
private readonly
|
|
21
|
-
constructor(
|
|
20
|
+
private readonly options;
|
|
21
|
+
constructor(options: HandshakeRpcLocalOptions);
|
|
22
22
|
handshake(request: StreamPartHandshakeRequest, context: ServerCallContext): Promise<StreamPartHandshakeResponse>;
|
|
23
23
|
private handleRequest;
|
|
24
24
|
private acceptHandshake;
|