@streamr/dht 103.1.2 → 103.2.0-experiment.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/exports-browser.cjs +7636 -0
- package/dist/exports-browser.cjs.map +1 -0
- package/dist/exports-browser.d.ts +1321 -0
- package/dist/exports-browser.js +7611 -0
- package/dist/exports-browser.js.map +1 -0
- package/dist/exports-nodejs.cjs +7833 -0
- package/dist/exports-nodejs.cjs.map +1 -0
- package/dist/exports-nodejs.d.ts +1321 -0
- package/dist/exports-nodejs.js +7808 -0
- package/dist/exports-nodejs.js.map +1 -0
- package/package.json +41 -25
- package/dist/generated/google/protobuf/any.d.ts +0 -180
- package/dist/generated/google/protobuf/any.js +0 -155
- package/dist/generated/google/protobuf/any.js.map +0 -1
- package/dist/generated/google/protobuf/empty.d.ts +0 -31
- package/dist/generated/google/protobuf/empty.js +0 -45
- package/dist/generated/google/protobuf/empty.js.map +0 -1
- package/dist/generated/google/protobuf/timestamp.d.ts +0 -156
- package/dist/generated/google/protobuf/timestamp.js +0 -136
- package/dist/generated/google/protobuf/timestamp.js.map +0 -1
- package/dist/generated/packages/dht/protos/DhtRpc.client.d.ts +0 -371
- package/dist/generated/packages/dht/protos/DhtRpc.client.js +0 -292
- package/dist/generated/packages/dht/protos/DhtRpc.client.js.map +0 -1
- package/dist/generated/packages/dht/protos/DhtRpc.d.ts +0 -1031
- package/dist/generated/packages/dht/protos/DhtRpc.js +0 -702
- package/dist/generated/packages/dht/protos/DhtRpc.js.map +0 -1
- package/dist/generated/packages/dht/protos/DhtRpc.server.d.ts +0 -168
- package/dist/generated/packages/dht/protos/DhtRpc.server.js +0 -3
- package/dist/generated/packages/dht/protos/DhtRpc.server.js.map +0 -1
- package/dist/generated/packages/proto-rpc/protos/ProtoRpc.d.ts +0 -87
- package/dist/generated/packages/proto-rpc/protos/ProtoRpc.js +0 -66
- package/dist/generated/packages/proto-rpc/protos/ProtoRpc.js.map +0 -1
- package/dist/package.json +0 -61
- package/dist/src/connection/Connection.d.ts +0 -12
- package/dist/src/connection/Connection.js +0 -30
- package/dist/src/connection/Connection.js.map +0 -1
- package/dist/src/connection/ConnectionLockRpcLocal.d.ts +0 -22
- package/dist/src/connection/ConnectionLockRpcLocal.js +0 -54
- package/dist/src/connection/ConnectionLockRpcLocal.js.map +0 -1
- package/dist/src/connection/ConnectionLockRpcRemote.d.ts +0 -10
- package/dist/src/connection/ConnectionLockRpcRemote.js +0 -61
- package/dist/src/connection/ConnectionLockRpcRemote.js.map +0 -1
- package/dist/src/connection/ConnectionLockStates.d.ts +0 -27
- package/dist/src/connection/ConnectionLockStates.js +0 -114
- package/dist/src/connection/ConnectionLockStates.js.map +0 -1
- package/dist/src/connection/ConnectionManager.d.ts +0 -85
- package/dist/src/connection/ConnectionManager.js +0 -569
- package/dist/src/connection/ConnectionManager.js.map +0 -1
- package/dist/src/connection/ConnectionsView.d.ts +0 -7
- package/dist/src/connection/ConnectionsView.js +0 -3
- package/dist/src/connection/ConnectionsView.js.map +0 -1
- package/dist/src/connection/ConnectorFacade.d.ts +0 -58
- package/dist/src/connection/ConnectorFacade.js +0 -154
- package/dist/src/connection/ConnectorFacade.js.map +0 -1
- package/dist/src/connection/Handshaker.d.ts +0 -27
- package/dist/src/connection/Handshaker.js +0 -179
- package/dist/src/connection/Handshaker.js.map +0 -1
- package/dist/src/connection/IConnection.d.ts +0 -32
- package/dist/src/connection/IConnection.js +0 -12
- package/dist/src/connection/IConnection.js.map +0 -1
- package/dist/src/connection/ManagedConnection.d.ts +0 -30
- package/dist/src/connection/ManagedConnection.js +0 -129
- package/dist/src/connection/ManagedConnection.js.map +0 -1
- package/dist/src/connection/OutputBuffer.d.ts +0 -9
- package/dist/src/connection/OutputBuffer.js +0 -26
- package/dist/src/connection/OutputBuffer.js.map +0 -1
- package/dist/src/connection/PendingConnection.d.ts +0 -19
- package/dist/src/connection/PendingConnection.js +0 -59
- package/dist/src/connection/PendingConnection.js.map +0 -1
- package/dist/src/connection/connectivityChecker.d.ts +0 -9
- package/dist/src/connection/connectivityChecker.js +0 -138
- package/dist/src/connection/connectivityChecker.js.map +0 -1
- package/dist/src/connection/connectivityRequestHandler.d.ts +0 -4
- package/dist/src/connection/connectivityRequestHandler.js +0 -108
- package/dist/src/connection/connectivityRequestHandler.js.map +0 -1
- package/dist/src/connection/simulator/Simulator.d.ts +0 -36
- package/dist/src/connection/simulator/Simulator.js +0 -290
- package/dist/src/connection/simulator/Simulator.js.map +0 -1
- package/dist/src/connection/simulator/SimulatorConnection.d.ts +0 -18
- package/dist/src/connection/simulator/SimulatorConnection.js +0 -123
- package/dist/src/connection/simulator/SimulatorConnection.js.map +0 -1
- package/dist/src/connection/simulator/SimulatorConnector.d.ts +0 -16
- package/dist/src/connection/simulator/SimulatorConnector.js +0 -80
- package/dist/src/connection/simulator/SimulatorConnector.js.map +0 -1
- package/dist/src/connection/simulator/SimulatorTransport.d.ts +0 -6
- package/dist/src/connection/simulator/SimulatorTransport.js +0 -17
- package/dist/src/connection/simulator/SimulatorTransport.js.map +0 -1
- package/dist/src/connection/simulator/pings.d.ts +0 -21
- package/dist/src/connection/simulator/pings.js +0 -61
- package/dist/src/connection/simulator/pings.js.map +0 -1
- package/dist/src/connection/webrtc/BrowserWebrtcConnection.d.ts +0 -37
- package/dist/src/connection/webrtc/BrowserWebrtcConnection.js +0 -229
- package/dist/src/connection/webrtc/BrowserWebrtcConnection.js.map +0 -1
- package/dist/src/connection/webrtc/IWebrtcConnection.d.ts +0 -21
- package/dist/src/connection/webrtc/IWebrtcConnection.js +0 -9
- package/dist/src/connection/webrtc/IWebrtcConnection.js.map +0 -1
- package/dist/src/connection/webrtc/NodeWebrtcConnection.d.ts +0 -45
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js +0 -229
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js.map +0 -1
- package/dist/src/connection/webrtc/WebrtcConnector.d.ts +0 -43
- package/dist/src/connection/webrtc/WebrtcConnector.js +0 -208
- package/dist/src/connection/webrtc/WebrtcConnector.js.map +0 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.d.ts +0 -26
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js +0 -82
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js.map +0 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.d.ts +0 -8
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js +0 -50
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js.map +0 -1
- package/dist/src/connection/webrtc/iceServerAsString.d.ts +0 -2
- package/dist/src/connection/webrtc/iceServerAsString.js +0 -17
- package/dist/src/connection/webrtc/iceServerAsString.js.map +0 -1
- package/dist/src/connection/websocket/AbstractWebsocketClientConnection.d.ts +0 -27
- package/dist/src/connection/websocket/AbstractWebsocketClientConnection.js +0 -107
- package/dist/src/connection/websocket/AbstractWebsocketClientConnection.js.map +0 -1
- package/dist/src/connection/websocket/AutoCertifierClientFacade.d.ts +0 -26
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js +0 -39
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js.map +0 -1
- package/dist/src/connection/websocket/BrowserWebsocketClientConnection.d.ts +0 -7
- package/dist/src/connection/websocket/BrowserWebsocketClientConnection.js +0 -44
- package/dist/src/connection/websocket/BrowserWebsocketClientConnection.js.map +0 -1
- package/dist/src/connection/websocket/NodeWebsocketClientConnection.d.ts +0 -7
- package/dist/src/connection/websocket/NodeWebsocketClientConnection.js +0 -39
- package/dist/src/connection/websocket/NodeWebsocketClientConnection.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketClientConnector.d.ts +0 -26
- package/dist/src/connection/websocket/WebsocketClientConnector.js +0 -86
- package/dist/src/connection/websocket/WebsocketClientConnector.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcLocal.d.ts +0 -18
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcLocal.js +0 -23
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcLocal.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcRemote.d.ts +0 -5
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcRemote.js +0 -17
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcRemote.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketServer.d.ts +0 -25
- package/dist/src/connection/websocket/WebsocketServer.js +0 -146
- package/dist/src/connection/websocket/WebsocketServer.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketServerConnection.d.ts +0 -22
- package/dist/src/connection/websocket/WebsocketServerConnection.js +0 -101
- package/dist/src/connection/websocket/WebsocketServerConnection.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketServerConnector.d.ts +0 -44
- package/dist/src/connection/websocket/WebsocketServerConnector.js +0 -279
- package/dist/src/connection/websocket/WebsocketServerConnector.js.map +0 -1
- package/dist/src/dht/DhtNode.d.ts +0 -119
- package/dist/src/dht/DhtNode.js +0 -500
- package/dist/src/dht/DhtNode.js.map +0 -1
- package/dist/src/dht/DhtNodeRpcLocal.d.ts +0 -23
- package/dist/src/dht/DhtNodeRpcLocal.js +0 -54
- package/dist/src/dht/DhtNodeRpcLocal.js.map +0 -1
- package/dist/src/dht/DhtNodeRpcRemote.d.ts +0 -25
- package/dist/src/dht/DhtNodeRpcRemote.js +0 -83
- package/dist/src/dht/DhtNodeRpcRemote.js.map +0 -1
- package/dist/src/dht/ExternalApiRpcLocal.d.ts +0 -18
- package/dist/src/dht/ExternalApiRpcLocal.js +0 -32
- package/dist/src/dht/ExternalApiRpcLocal.js.map +0 -1
- package/dist/src/dht/ExternalApiRpcRemote.d.ts +0 -10
- package/dist/src/dht/ExternalApiRpcRemote.js +0 -58
- package/dist/src/dht/ExternalApiRpcRemote.js.map +0 -1
- package/dist/src/dht/PeerManager.d.ts +0 -63
- package/dist/src/dht/PeerManager.js +0 -251
- package/dist/src/dht/PeerManager.js.map +0 -1
- package/dist/src/dht/contact/Contact.d.ts +0 -8
- package/dist/src/dht/contact/Contact.js +0 -18
- package/dist/src/dht/contact/Contact.js.map +0 -1
- package/dist/src/dht/contact/ContactList.d.ts +0 -19
- package/dist/src/dht/contact/ContactList.js +0 -35
- package/dist/src/dht/contact/ContactList.js.map +0 -1
- package/dist/src/dht/contact/RandomContactList.d.ts +0 -11
- package/dist/src/dht/contact/RandomContactList.js +0 -47
- package/dist/src/dht/contact/RandomContactList.js.map +0 -1
- package/dist/src/dht/contact/RingContactList.d.ts +0 -28
- package/dist/src/dht/contact/RingContactList.js +0 -126
- package/dist/src/dht/contact/RingContactList.js.map +0 -1
- package/dist/src/dht/contact/RpcRemote.d.ts +0 -19
- package/dist/src/dht/contact/RpcRemote.js +0 -61
- package/dist/src/dht/contact/RpcRemote.js.map +0 -1
- package/dist/src/dht/contact/SortedContactList.d.ts +0 -37
- package/dist/src/dht/contact/SortedContactList.js +0 -134
- package/dist/src/dht/contact/SortedContactList.js.map +0 -1
- package/dist/src/dht/contact/getClosestNodes.d.ts +0 -6
- package/dist/src/dht/contact/getClosestNodes.js +0 -19
- package/dist/src/dht/contact/getClosestNodes.js.map +0 -1
- package/dist/src/dht/contact/ringIdentifiers.d.ts +0 -16
- package/dist/src/dht/contact/ringIdentifiers.js +0 -54
- package/dist/src/dht/contact/ringIdentifiers.js.map +0 -1
- package/dist/src/dht/discovery/DiscoverySession.d.ts +0 -29
- package/dist/src/dht/discovery/DiscoverySession.js +0 -102
- package/dist/src/dht/discovery/DiscoverySession.js.map +0 -1
- package/dist/src/dht/discovery/PeerDiscovery.d.ts +0 -42
- package/dist/src/dht/discovery/PeerDiscovery.js +0 -193
- package/dist/src/dht/discovery/PeerDiscovery.js.map +0 -1
- package/dist/src/dht/discovery/RingDiscoverySession.d.ts +0 -28
- package/dist/src/dht/discovery/RingDiscoverySession.js +0 -116
- package/dist/src/dht/discovery/RingDiscoverySession.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.d.ts +0 -38
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js +0 -165
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.d.ts +0 -14
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js +0 -26
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.d.ts +0 -6
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js +0 -44
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.d.ts +0 -45
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js +0 -185
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.d.ts +0 -14
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js +0 -20
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.d.ts +0 -6
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js +0 -21
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js.map +0 -1
- package/dist/src/dht/routing/DuplicateDetector.d.ts +0 -10
- package/dist/src/dht/routing/DuplicateDetector.js +0 -31
- package/dist/src/dht/routing/DuplicateDetector.js.map +0 -1
- package/dist/src/dht/routing/Router.d.ts +0 -35
- package/dist/src/dht/routing/Router.js +0 -204
- package/dist/src/dht/routing/Router.js.map +0 -1
- package/dist/src/dht/routing/RouterRpcLocal.d.ts +0 -20
- package/dist/src/dht/routing/RouterRpcLocal.js +0 -67
- package/dist/src/dht/routing/RouterRpcLocal.js.map +0 -1
- package/dist/src/dht/routing/RouterRpcRemote.d.ts +0 -8
- package/dist/src/dht/routing/RouterRpcRemote.js +0 -81
- package/dist/src/dht/routing/RouterRpcRemote.js.map +0 -1
- package/dist/src/dht/routing/RoutingSession.d.ts +0 -56
- package/dist/src/dht/routing/RoutingSession.js +0 -201
- package/dist/src/dht/routing/RoutingSession.js.map +0 -1
- package/dist/src/dht/routing/RoutingTablesCache.d.ts +0 -24
- package/dist/src/dht/routing/RoutingTablesCache.js +0 -46
- package/dist/src/dht/routing/RoutingTablesCache.js.map +0 -1
- package/dist/src/dht/routing/getPreviousPeer.d.ts +0 -2
- package/dist/src/dht/routing/getPreviousPeer.js +0 -12
- package/dist/src/dht/routing/getPreviousPeer.js.map +0 -1
- package/dist/src/dht/store/LocalDataStore.d.ts +0 -14
- package/dist/src/dht/store/LocalDataStore.js +0 -78
- package/dist/src/dht/store/LocalDataStore.js.map +0 -1
- package/dist/src/dht/store/StoreManager.d.ts +0 -32
- package/dist/src/dht/store/StoreManager.js +0 -126
- package/dist/src/dht/store/StoreManager.js.map +0 -1
- package/dist/src/dht/store/StoreRpcLocal.d.ts +0 -21
- package/dist/src/dht/store/StoreRpcLocal.js +0 -65
- package/dist/src/dht/store/StoreRpcLocal.js.map +0 -1
- package/dist/src/dht/store/StoreRpcRemote.d.ts +0 -7
- package/dist/src/dht/store/StoreRpcRemote.js +0 -29
- package/dist/src/dht/store/StoreRpcRemote.js.map +0 -1
- package/dist/src/exports.d.ts +0 -25
- package/dist/src/exports.js +0 -48
- package/dist/src/exports.js.map +0 -1
- package/dist/src/helpers/AddressTools.d.ts +0 -2
- package/dist/src/helpers/AddressTools.js +0 -32
- package/dist/src/helpers/AddressTools.js.map +0 -1
- package/dist/src/helpers/Connectivity.d.ts +0 -4
- package/dist/src/helpers/Connectivity.js +0 -24
- package/dist/src/helpers/Connectivity.js.map +0 -1
- package/dist/src/helpers/browser/isBrowserEnvironment.d.ts +0 -1
- package/dist/src/helpers/browser/isBrowserEnvironment.js +0 -6
- package/dist/src/helpers/browser/isBrowserEnvironment.js.map +0 -1
- package/dist/src/helpers/browser/isBrowserEnvironment_override.d.ts +0 -1
- package/dist/src/helpers/browser/isBrowserEnvironment_override.js +0 -7
- package/dist/src/helpers/browser/isBrowserEnvironment_override.js.map +0 -1
- package/dist/src/helpers/createPeerDescriptor.d.ts +0 -3
- package/dist/src/helpers/createPeerDescriptor.js +0 -58
- package/dist/src/helpers/createPeerDescriptor.js.map +0 -1
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.d.ts +0 -2
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.js +0 -30
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.js.map +0 -1
- package/dist/src/helpers/debugHelpers.d.ts +0 -3
- package/dist/src/helpers/debugHelpers.js +0 -11
- package/dist/src/helpers/debugHelpers.js.map +0 -1
- package/dist/src/helpers/errors.d.ts +0 -72
- package/dist/src/helpers/errors.js +0 -97
- package/dist/src/helpers/errors.js.map +0 -1
- package/dist/src/helpers/offering.d.ts +0 -4
- package/dist/src/helpers/offering.js +0 -18
- package/dist/src/helpers/offering.js.map +0 -1
- package/dist/src/helpers/protoClasses.d.ts +0 -2
- package/dist/src/helpers/protoClasses.js +0 -32
- package/dist/src/helpers/protoClasses.js.map +0 -1
- package/dist/src/helpers/protoToString.d.ts +0 -2
- package/dist/src/helpers/protoToString.js +0 -19
- package/dist/src/helpers/protoToString.js.map +0 -1
- package/dist/src/helpers/version.d.ts +0 -6
- package/dist/src/helpers/version.js +0 -38
- package/dist/src/helpers/version.js.map +0 -1
- package/dist/src/identifiers.d.ts +0 -10
- package/dist/src/identifiers.js +0 -31
- package/dist/src/identifiers.js.map +0 -1
- package/dist/src/rpc-protocol/DhtCallContext.d.ts +0 -12
- package/dist/src/rpc-protocol/DhtCallContext.js +0 -17
- package/dist/src/rpc-protocol/DhtCallContext.js.map +0 -1
- package/dist/src/rpc-protocol/DhtRpcOptions.d.ts +0 -10
- package/dist/src/rpc-protocol/DhtRpcOptions.js +0 -3
- package/dist/src/rpc-protocol/DhtRpcOptions.js.map +0 -1
- package/dist/src/transport/ITransport.d.ts +0 -31
- package/dist/src/transport/ITransport.js +0 -9
- package/dist/src/transport/ITransport.js.map +0 -1
- package/dist/src/transport/ListeningRpcCommunicator.d.ts +0 -11
- package/dist/src/transport/ListeningRpcCommunicator.js +0 -31
- package/dist/src/transport/ListeningRpcCommunicator.js.map +0 -1
- package/dist/src/transport/RoutingRpcCommunicator.d.ts +0 -10
- package/dist/src/transport/RoutingRpcCommunicator.js +0 -60
- package/dist/src/transport/RoutingRpcCommunicator.js.map +0 -1
- package/dist/src/types/ServiceID.d.ts +0 -1
- package/dist/src/types/ServiceID.js +0 -3
- package/dist/src/types/ServiceID.js.map +0 -1
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Simulator = exports.LatencyType = void 0;
|
|
7
|
-
const utils_1 = require("@streamr/utils");
|
|
8
|
-
const pings_1 = require("./pings");
|
|
9
|
-
const heap_1 = __importDefault(require("heap"));
|
|
10
|
-
const debugHelpers_1 = require("../../helpers/debugHelpers");
|
|
11
|
-
const identifiers_1 = require("../../identifiers");
|
|
12
|
-
const logger = new utils_1.Logger(module);
|
|
13
|
-
var LatencyType;
|
|
14
|
-
(function (LatencyType) {
|
|
15
|
-
LatencyType["NONE"] = "NONE";
|
|
16
|
-
LatencyType["RANDOM"] = "RANDOM";
|
|
17
|
-
LatencyType["REAL"] = "REAL";
|
|
18
|
-
LatencyType["FIXED"] = "FIXED";
|
|
19
|
-
})(LatencyType || (exports.LatencyType = LatencyType = {}));
|
|
20
|
-
// One-way 'pipe' of messages
|
|
21
|
-
class Association {
|
|
22
|
-
connectedCallback;
|
|
23
|
-
sourceConnection;
|
|
24
|
-
destinationConnection;
|
|
25
|
-
lastOperationAt = 0;
|
|
26
|
-
closing = false;
|
|
27
|
-
constructor(sourceConnection, destinationConnection, connectedCallback) {
|
|
28
|
-
this.connectedCallback = connectedCallback;
|
|
29
|
-
this.sourceConnection = sourceConnection;
|
|
30
|
-
this.destinationConnection = destinationConnection;
|
|
31
|
-
}
|
|
32
|
-
setDestinationConnection(connection) {
|
|
33
|
-
this.destinationConnection = connection;
|
|
34
|
-
}
|
|
35
|
-
getLastOperationAt() {
|
|
36
|
-
return this.lastOperationAt;
|
|
37
|
-
}
|
|
38
|
-
setLastOperationAt(executionTime) {
|
|
39
|
-
this.lastOperationAt = executionTime;
|
|
40
|
-
}
|
|
41
|
-
setClosing() {
|
|
42
|
-
this.closing = true;
|
|
43
|
-
}
|
|
44
|
-
isClosing() {
|
|
45
|
-
return this.closing;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
class SimulatorOperation {
|
|
49
|
-
executionTime;
|
|
50
|
-
association;
|
|
51
|
-
static objectCounter = 0;
|
|
52
|
-
objectId = 0;
|
|
53
|
-
constructor(executionTime, association) {
|
|
54
|
-
this.executionTime = executionTime;
|
|
55
|
-
this.association = association;
|
|
56
|
-
this.objectId = SimulatorOperation.objectCounter;
|
|
57
|
-
SimulatorOperation.objectCounter++;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
class ConnectOperation extends SimulatorOperation {
|
|
61
|
-
sourceConnection;
|
|
62
|
-
targetDescriptor;
|
|
63
|
-
constructor(executionTime, association, sourceConnection, targetDescriptor) {
|
|
64
|
-
super(executionTime, association);
|
|
65
|
-
this.sourceConnection = sourceConnection;
|
|
66
|
-
this.targetDescriptor = targetDescriptor;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
class SendOperation extends SimulatorOperation {
|
|
70
|
-
data;
|
|
71
|
-
constructor(executionTime, association, data) {
|
|
72
|
-
super(executionTime, association);
|
|
73
|
-
this.data = data;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
class CloseOperation extends SimulatorOperation {
|
|
77
|
-
}
|
|
78
|
-
class Simulator {
|
|
79
|
-
stopped = false;
|
|
80
|
-
connectors = new Map();
|
|
81
|
-
latencyTable;
|
|
82
|
-
associations = new Map();
|
|
83
|
-
latencyType;
|
|
84
|
-
fixedLatency;
|
|
85
|
-
loopCounter = 0;
|
|
86
|
-
MAX_LOOPS = 1000;
|
|
87
|
-
operationQueue = new heap_1.default((a, b) => {
|
|
88
|
-
if ((a.executionTime - b.executionTime) === 0) {
|
|
89
|
-
return (a.objectId - b.objectId);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
return (a.executionTime - b.executionTime);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
simulatorTimeout;
|
|
96
|
-
constructor(latencyType = LatencyType.NONE, fixedLatency) {
|
|
97
|
-
this.latencyType = latencyType;
|
|
98
|
-
this.fixedLatency = fixedLatency;
|
|
99
|
-
if (this.latencyType === LatencyType.REAL) {
|
|
100
|
-
this.latencyTable = (0, pings_1.getRegionDelayMatrix)();
|
|
101
|
-
}
|
|
102
|
-
if ((this.latencyType === LatencyType.FIXED) && (this.fixedLatency === undefined)) {
|
|
103
|
-
throw new Error('LatencyType.FIXED requires the desired latency to be given as second parameter');
|
|
104
|
-
}
|
|
105
|
-
this.generateExecutionTime = this.generateExecutionTime.bind(this);
|
|
106
|
-
this.getLatency = this.getLatency.bind(this);
|
|
107
|
-
this.executeCloseOperation = this.executeCloseOperation.bind(this);
|
|
108
|
-
this.executeConnectOperation = this.executeConnectOperation.bind(this);
|
|
109
|
-
this.executeSendOperation = this.executeSendOperation.bind(this);
|
|
110
|
-
this.executeQueuedOperations = this.executeQueuedOperations.bind(this);
|
|
111
|
-
this.accept = this.accept.bind(this);
|
|
112
|
-
this.send = this.send.bind(this);
|
|
113
|
-
this.close = this.close.bind(this);
|
|
114
|
-
this.scheduleNextTimeout = this.scheduleNextTimeout.bind(this);
|
|
115
|
-
this.scheduleOperation = this.scheduleOperation.bind(this);
|
|
116
|
-
}
|
|
117
|
-
generateExecutionTime(association, sourceRegion, targetRegion) {
|
|
118
|
-
let executionTime = Date.now() + this.getLatency(sourceRegion, targetRegion);
|
|
119
|
-
if (association.getLastOperationAt() > executionTime) {
|
|
120
|
-
executionTime = association.getLastOperationAt();
|
|
121
|
-
}
|
|
122
|
-
return executionTime;
|
|
123
|
-
}
|
|
124
|
-
getLatency(sourceRegion, targetRegion) {
|
|
125
|
-
let latency = 0;
|
|
126
|
-
if (this.latencyType === LatencyType.FIXED) {
|
|
127
|
-
latency = this.fixedLatency;
|
|
128
|
-
}
|
|
129
|
-
if (this.latencyType === LatencyType.REAL) {
|
|
130
|
-
if (sourceRegion === undefined || targetRegion === undefined || sourceRegion > 15 || targetRegion > 15) {
|
|
131
|
-
logger.error('invalid region index given to Simulator');
|
|
132
|
-
throw new Error('invalid region index given to Simulator');
|
|
133
|
-
}
|
|
134
|
-
latency = this.latencyTable[sourceRegion][targetRegion];
|
|
135
|
-
}
|
|
136
|
-
if (this.latencyType === LatencyType.RANDOM) {
|
|
137
|
-
latency = Math.random() * (250 - 5) + 5;
|
|
138
|
-
}
|
|
139
|
-
return latency;
|
|
140
|
-
}
|
|
141
|
-
accept(sourceConnection, targetConnection) {
|
|
142
|
-
const sourceAssociation = this.associations.get(sourceConnection.connectionId);
|
|
143
|
-
if (!sourceAssociation) {
|
|
144
|
-
logger.error('source association not found in accept()');
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
sourceAssociation.setDestinationConnection(targetConnection);
|
|
148
|
-
const targetAssociation = new Association(targetConnection, sourceConnection);
|
|
149
|
-
this.associations.set(targetConnection.connectionId, targetAssociation);
|
|
150
|
-
sourceAssociation.connectedCallback();
|
|
151
|
-
}
|
|
152
|
-
addConnector(connector) {
|
|
153
|
-
this.connectors.set((0, identifiers_1.toNodeId)(connector.getPeerDescriptor()), connector);
|
|
154
|
-
}
|
|
155
|
-
executeConnectOperation(operation) {
|
|
156
|
-
const target = this.connectors.get((0, identifiers_1.toNodeId)(operation.targetDescriptor));
|
|
157
|
-
if (!target) {
|
|
158
|
-
logger.error('Target connector not found when executing connect operation');
|
|
159
|
-
operation.association.connectedCallback('Target connector not found');
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
target.handleIncomingConnection(operation.sourceConnection);
|
|
163
|
-
}
|
|
164
|
-
executeCloseOperation(operation) {
|
|
165
|
-
if (this.stopped) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
const target = operation.association.destinationConnection;
|
|
169
|
-
let counterAssociation;
|
|
170
|
-
if (target) {
|
|
171
|
-
counterAssociation = this.associations.get(target.connectionId);
|
|
172
|
-
}
|
|
173
|
-
if (!target || !counterAssociation) {
|
|
174
|
-
this.associations.delete(operation.association.sourceConnection.connectionId);
|
|
175
|
-
}
|
|
176
|
-
else if (!counterAssociation.isClosing()) {
|
|
177
|
-
target.handleIncomingDisconnection();
|
|
178
|
-
this.close(target);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
// this is the 'ack' of the CloseOperation to the original closer
|
|
182
|
-
this.associations.delete(target.connectionId);
|
|
183
|
-
this.associations.delete(operation.association.sourceConnection.connectionId);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
executeSendOperation(operation) {
|
|
187
|
-
if (this.stopped) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
const target = operation.association.destinationConnection;
|
|
191
|
-
target.handleIncomingData(operation.data);
|
|
192
|
-
}
|
|
193
|
-
executeQueuedOperations() {
|
|
194
|
-
const currentTime = Date.now();
|
|
195
|
-
while (this.operationQueue.size() > 0
|
|
196
|
-
&& this.operationQueue.peek().executionTime <= currentTime) {
|
|
197
|
-
const operation = this.operationQueue.pop();
|
|
198
|
-
if (operation instanceof ConnectOperation) {
|
|
199
|
-
this.executeConnectOperation(operation);
|
|
200
|
-
}
|
|
201
|
-
else if (operation instanceof CloseOperation) {
|
|
202
|
-
this.executeCloseOperation(operation);
|
|
203
|
-
}
|
|
204
|
-
else if (operation instanceof SendOperation) {
|
|
205
|
-
this.executeSendOperation(operation);
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
logger.error('Unknown SimulatorOperation');
|
|
209
|
-
}
|
|
210
|
-
this.loopCounter++;
|
|
211
|
-
if (this.loopCounter >= this.MAX_LOOPS) {
|
|
212
|
-
this.loopCounter = 0;
|
|
213
|
-
setTimeout(() => this.executeQueuedOperations(), 0);
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
this.scheduleNextTimeout();
|
|
218
|
-
}
|
|
219
|
-
scheduleNextTimeout() {
|
|
220
|
-
if (this.simulatorTimeout) {
|
|
221
|
-
clearTimeout(this.simulatorTimeout);
|
|
222
|
-
this.simulatorTimeout = undefined;
|
|
223
|
-
}
|
|
224
|
-
const currentTime = Date.now();
|
|
225
|
-
const firstOperation = this.operationQueue.peek();
|
|
226
|
-
if (!firstOperation) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
const firstOperationTime = firstOperation.executionTime;
|
|
230
|
-
const timeDifference = firstOperationTime - currentTime;
|
|
231
|
-
this.simulatorTimeout = setTimeout(this.executeQueuedOperations, timeDifference);
|
|
232
|
-
}
|
|
233
|
-
scheduleOperation(operation) {
|
|
234
|
-
this.operationQueue.push(operation);
|
|
235
|
-
this.scheduleNextTimeout();
|
|
236
|
-
}
|
|
237
|
-
connect(sourceConnection, targetDescriptor, connectedCallback) {
|
|
238
|
-
if (this.stopped) {
|
|
239
|
-
logger.error('connect() called on a stopped simulator ' + (new Error().stack));
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
debugHelpers_1.debugVars.simulatorHeapSize = this.operationQueue.size();
|
|
243
|
-
const association = new Association(sourceConnection, undefined, connectedCallback);
|
|
244
|
-
this.associations.set(sourceConnection.connectionId, association);
|
|
245
|
-
const executionTime = this.generateExecutionTime(association, sourceConnection.localPeerDescriptor.region, targetDescriptor.region);
|
|
246
|
-
association.setLastOperationAt(executionTime);
|
|
247
|
-
const operation = new ConnectOperation(executionTime, association, sourceConnection, targetDescriptor);
|
|
248
|
-
this.scheduleOperation(operation);
|
|
249
|
-
}
|
|
250
|
-
close(sourceConnection) {
|
|
251
|
-
if (this.stopped) {
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
const association = this.associations.get(sourceConnection.connectionId);
|
|
255
|
-
if (!association) {
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
association.setClosing();
|
|
259
|
-
const executionTime = this.generateExecutionTime(association, sourceConnection.localPeerDescriptor.region, sourceConnection.getPeerDescriptor()?.region);
|
|
260
|
-
association.setLastOperationAt(executionTime);
|
|
261
|
-
const operation = new CloseOperation(executionTime, association);
|
|
262
|
-
this.scheduleOperation(operation);
|
|
263
|
-
}
|
|
264
|
-
send(sourceConnection, data) {
|
|
265
|
-
if (this.stopped) {
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
const association = this.associations.get(sourceConnection.connectionId);
|
|
269
|
-
if (!association) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
if (association.isClosing()) {
|
|
273
|
-
logger.trace('Tried to call send() on a closing association');
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
const executionTime = this.generateExecutionTime(association, sourceConnection.localPeerDescriptor.region, association.destinationConnection.localPeerDescriptor.region);
|
|
277
|
-
association.setLastOperationAt(executionTime);
|
|
278
|
-
const operation = new SendOperation(executionTime, association, data);
|
|
279
|
-
this.scheduleOperation(operation);
|
|
280
|
-
}
|
|
281
|
-
stop() {
|
|
282
|
-
this.stopped = true;
|
|
283
|
-
logger.info(this.associations.size + ' associations in the beginning of stop()');
|
|
284
|
-
if (this.simulatorTimeout) {
|
|
285
|
-
clearTimeout(this.simulatorTimeout);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
exports.Simulator = Simulator;
|
|
290
|
-
//# sourceMappingURL=Simulator.js.map
|
|
@@ -1 +0,0 @@
|
|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,iBAAiB,CAAC,SAAS,CAAC,CAAA;IACrC,CAAC;IAEM,IAAI;QACP,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QACnB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,GAAG,0CAA0C,CAAC,CAAA;QAEhF,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,YAAY,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;QACvC,CAAC;IACL,CAAC;CACJ;AAvRD,8BAuRC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ConnectionType, IConnection } from '../IConnection';
|
|
2
|
-
import { Simulator } from './Simulator';
|
|
3
|
-
import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc';
|
|
4
|
-
import { Connection } from '../Connection';
|
|
5
|
-
export declare class SimulatorConnection extends Connection implements IConnection {
|
|
6
|
-
private stopped;
|
|
7
|
-
localPeerDescriptor: PeerDescriptor;
|
|
8
|
-
private targetPeerDescriptor;
|
|
9
|
-
private simulator;
|
|
10
|
-
constructor(localPeerDescriptor: PeerDescriptor, targetPeerDescriptor: PeerDescriptor, connectionType: ConnectionType, simulator: Simulator);
|
|
11
|
-
send(data: Uint8Array): void;
|
|
12
|
-
close(gracefulLeave: boolean): Promise<void>;
|
|
13
|
-
connect(): void;
|
|
14
|
-
handleIncomingData(data: Uint8Array): void;
|
|
15
|
-
handleIncomingDisconnection(): void;
|
|
16
|
-
destroy(): void;
|
|
17
|
-
private doDisconnect;
|
|
18
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SimulatorConnection = void 0;
|
|
4
|
-
const DhtRpc_1 = require("../../../generated/packages/dht/protos/DhtRpc");
|
|
5
|
-
const Connection_1 = require("../Connection");
|
|
6
|
-
const utils_1 = require("@streamr/utils");
|
|
7
|
-
const protoToString_1 = require("../../helpers/protoToString");
|
|
8
|
-
const identifiers_1 = require("../../identifiers");
|
|
9
|
-
const logger = new utils_1.Logger(module);
|
|
10
|
-
class SimulatorConnection extends Connection_1.Connection {
|
|
11
|
-
stopped = false;
|
|
12
|
-
localPeerDescriptor;
|
|
13
|
-
targetPeerDescriptor;
|
|
14
|
-
simulator;
|
|
15
|
-
constructor(localPeerDescriptor, targetPeerDescriptor, connectionType, simulator) {
|
|
16
|
-
super(connectionType);
|
|
17
|
-
this.localPeerDescriptor = localPeerDescriptor;
|
|
18
|
-
this.setPeerDescriptor(targetPeerDescriptor);
|
|
19
|
-
this.targetPeerDescriptor = targetPeerDescriptor;
|
|
20
|
-
this.connectionType = connectionType;
|
|
21
|
-
this.simulator = simulator;
|
|
22
|
-
this.send = this.send.bind(this);
|
|
23
|
-
this.close = this.close.bind(this);
|
|
24
|
-
this.connect = this.connect.bind(this);
|
|
25
|
-
this.handleIncomingData = this.handleIncomingData.bind(this);
|
|
26
|
-
this.handleIncomingDisconnection = this.handleIncomingDisconnection.bind(this);
|
|
27
|
-
this.destroy = this.destroy.bind(this);
|
|
28
|
-
this.doDisconnect = this.doDisconnect.bind(this);
|
|
29
|
-
}
|
|
30
|
-
send(data) {
|
|
31
|
-
logger.trace('send()');
|
|
32
|
-
if (!this.stopped) {
|
|
33
|
-
this.simulator.send(this, data);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
const localNodeId = (0, identifiers_1.toNodeId)(this.localPeerDescriptor);
|
|
37
|
-
const targetNodeId = (0, identifiers_1.toNodeId)(this.targetPeerDescriptor);
|
|
38
|
-
logger.error(localNodeId + ', ' + targetNodeId + 'tried to send() on a stopped connection');
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
async close(gracefulLeave) {
|
|
42
|
-
const localNodeId = (0, identifiers_1.toNodeId)(this.localPeerDescriptor);
|
|
43
|
-
const targetNodeId = (0, identifiers_1.toNodeId)(this.targetPeerDescriptor);
|
|
44
|
-
logger.trace(localNodeId + ', ' + targetNodeId + ' close()');
|
|
45
|
-
if (!this.stopped) {
|
|
46
|
-
logger.trace(localNodeId + ', ' + targetNodeId + ' close() not stopped');
|
|
47
|
-
this.stopped = true;
|
|
48
|
-
try {
|
|
49
|
-
logger.trace(localNodeId + ', ' + targetNodeId + ' close() calling simulator.disconnect()');
|
|
50
|
-
this.simulator.close(this);
|
|
51
|
-
logger.trace(localNodeId + ', ' + targetNodeId + ' close() simulator.disconnect returned');
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
logger.trace(localNodeId + ', ' + targetNodeId + 'close aborted' + e);
|
|
55
|
-
}
|
|
56
|
-
finally {
|
|
57
|
-
logger.trace(localNodeId + ', ' + targetNodeId + ' calling this.doDisconnect');
|
|
58
|
-
this.doDisconnect(gracefulLeave);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
logger.trace(localNodeId + ', ' + targetNodeId + ' close() tried to close a stopped connection');
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
connect() {
|
|
66
|
-
if (!this.stopped) {
|
|
67
|
-
logger.trace('connect() called');
|
|
68
|
-
this.simulator.connect(this, this.targetPeerDescriptor, (error) => {
|
|
69
|
-
if (error !== undefined) {
|
|
70
|
-
logger.trace(error);
|
|
71
|
-
this.doDisconnect(false);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
this.emit('connected');
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
logger.trace('tried to connect() a stopped connection');
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
handleIncomingData(data) {
|
|
83
|
-
if (!this.stopped) {
|
|
84
|
-
logger.trace('handleIncomingData() ' + (0, protoToString_1.protoToString)(DhtRpc_1.Message.fromBinary(data), DhtRpc_1.Message));
|
|
85
|
-
this.emit('data', data);
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
logger.trace('tried to call handleIncomingData() a stopped connection');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
handleIncomingDisconnection() {
|
|
92
|
-
if (!this.stopped) {
|
|
93
|
-
const localNodeId = (0, identifiers_1.toNodeId)(this.localPeerDescriptor);
|
|
94
|
-
logger.trace(localNodeId + ' handleIncomingDisconnection()');
|
|
95
|
-
this.stopped = true;
|
|
96
|
-
this.doDisconnect(false);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
logger.trace('tried to call handleIncomingDisconnection() a stopped connection');
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
destroy() {
|
|
103
|
-
const localNodeId = (0, identifiers_1.toNodeId)(this.localPeerDescriptor);
|
|
104
|
-
if (!this.stopped) {
|
|
105
|
-
logger.trace(localNodeId + ' destroy()');
|
|
106
|
-
this.removeAllListeners();
|
|
107
|
-
this.close(false).catch((_e) => { });
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
logger.trace(localNodeId + ' tried to call destroy() a stopped connection');
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
doDisconnect(gracefulLeave) {
|
|
114
|
-
const localNodeId = (0, identifiers_1.toNodeId)(this.localPeerDescriptor);
|
|
115
|
-
const targetNodeId = (0, identifiers_1.toNodeId)(this.targetPeerDescriptor);
|
|
116
|
-
logger.trace(localNodeId + ' doDisconnect()');
|
|
117
|
-
this.stopped = true;
|
|
118
|
-
logger.trace(localNodeId + ', ' + targetNodeId + ' doDisconnect emitting');
|
|
119
|
-
this.emit('disconnected', gracefulLeave);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
exports.SimulatorConnection = SimulatorConnection;
|
|
123
|
-
//# sourceMappingURL=SimulatorConnection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SimulatorConnection.js","sourceRoot":"","sources":["../../../../src/connection/simulator/SimulatorConnection.ts"],"names":[],"mappings":";;;AAEA,0EAAuF;AACvF,8CAA0C;AAC1C,0CAAuC;AACvC,+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G,YAAY,GAAG,wBAAwB,CAAC,CAAA;QAE1E,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,CAAA;IAC5C,CAAC;CACJ;AA9HD,kDA8HC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc';
|
|
2
|
-
import { Simulator } from './Simulator';
|
|
3
|
-
import { SimulatorConnection } from './SimulatorConnection';
|
|
4
|
-
import { PendingConnection } from '../PendingConnection';
|
|
5
|
-
export declare class SimulatorConnector {
|
|
6
|
-
private connectingConnections;
|
|
7
|
-
private stopped;
|
|
8
|
-
private localPeerDescriptor;
|
|
9
|
-
private simulator;
|
|
10
|
-
private onNewConnection;
|
|
11
|
-
constructor(localPeerDescriptor: PeerDescriptor, simulator: Simulator, onNewConnection: (connection: PendingConnection) => boolean);
|
|
12
|
-
connect(targetPeerDescriptor: PeerDescriptor): PendingConnection;
|
|
13
|
-
getPeerDescriptor(): PeerDescriptor;
|
|
14
|
-
handleIncomingConnection(sourceConnection: SimulatorConnection): void;
|
|
15
|
-
stop(): Promise<void>;
|
|
16
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SimulatorConnector = void 0;
|
|
4
|
-
const IConnection_1 = require("../IConnection");
|
|
5
|
-
const DhtRpc_1 = require("../../../generated/packages/dht/protos/DhtRpc");
|
|
6
|
-
const utils_1 = require("@streamr/utils");
|
|
7
|
-
const SimulatorConnection_1 = require("./SimulatorConnection");
|
|
8
|
-
const identifiers_1 = require("../../identifiers");
|
|
9
|
-
const Handshaker_1 = require("../Handshaker");
|
|
10
|
-
const PendingConnection_1 = require("../PendingConnection");
|
|
11
|
-
const logger = new utils_1.Logger(module);
|
|
12
|
-
class SimulatorConnector {
|
|
13
|
-
connectingConnections = new Map();
|
|
14
|
-
stopped = false;
|
|
15
|
-
localPeerDescriptor;
|
|
16
|
-
simulator;
|
|
17
|
-
onNewConnection;
|
|
18
|
-
constructor(localPeerDescriptor, simulator, onNewConnection) {
|
|
19
|
-
this.localPeerDescriptor = localPeerDescriptor;
|
|
20
|
-
this.simulator = simulator;
|
|
21
|
-
this.onNewConnection = onNewConnection;
|
|
22
|
-
}
|
|
23
|
-
connect(targetPeerDescriptor) {
|
|
24
|
-
logger.trace('connect() ' + (0, identifiers_1.toNodeId)(targetPeerDescriptor));
|
|
25
|
-
const nodeId = (0, identifiers_1.toNodeId)(targetPeerDescriptor);
|
|
26
|
-
const existingConnection = this.connectingConnections.get(nodeId);
|
|
27
|
-
if (existingConnection) {
|
|
28
|
-
return existingConnection;
|
|
29
|
-
}
|
|
30
|
-
const connection = new SimulatorConnection_1.SimulatorConnection(this.localPeerDescriptor, targetPeerDescriptor, IConnection_1.ConnectionType.SIMULATOR_CLIENT, this.simulator);
|
|
31
|
-
const pendingConnection = new PendingConnection_1.PendingConnection(targetPeerDescriptor);
|
|
32
|
-
(0, Handshaker_1.createOutgoingHandshaker)(this.localPeerDescriptor, pendingConnection, connection, targetPeerDescriptor);
|
|
33
|
-
this.connectingConnections.set(nodeId, pendingConnection);
|
|
34
|
-
const delFunc = () => {
|
|
35
|
-
this.connectingConnections.delete(nodeId);
|
|
36
|
-
connection.off('disconnected', delFunc);
|
|
37
|
-
pendingConnection.off('connected', delFunc);
|
|
38
|
-
pendingConnection.off('disconnected', delFunc);
|
|
39
|
-
};
|
|
40
|
-
connection.once('disconnected', delFunc);
|
|
41
|
-
pendingConnection.once('connected', delFunc);
|
|
42
|
-
pendingConnection.once('disconnected', delFunc);
|
|
43
|
-
connection.connect();
|
|
44
|
-
return pendingConnection;
|
|
45
|
-
}
|
|
46
|
-
getPeerDescriptor() {
|
|
47
|
-
return this.localPeerDescriptor;
|
|
48
|
-
}
|
|
49
|
-
handleIncomingConnection(sourceConnection) {
|
|
50
|
-
// connection is incoming, so remotePeerDescriptor is localPeerDescriptor
|
|
51
|
-
const remotePeerDescriptor = sourceConnection.localPeerDescriptor;
|
|
52
|
-
const remoteNodeId = (0, identifiers_1.toNodeId)(sourceConnection.localPeerDescriptor);
|
|
53
|
-
logger.trace(remoteNodeId + ' incoming connection, stopped: ' + this.stopped);
|
|
54
|
-
if (this.stopped) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const connection = new SimulatorConnection_1.SimulatorConnection(this.localPeerDescriptor, remotePeerDescriptor, IConnection_1.ConnectionType.SIMULATOR_SERVER, this.simulator);
|
|
58
|
-
const pendingConnection = new PendingConnection_1.PendingConnection(remotePeerDescriptor);
|
|
59
|
-
const handshaker = (0, Handshaker_1.createIncomingHandshaker)(this.localPeerDescriptor, pendingConnection, connection);
|
|
60
|
-
logger.trace('connected');
|
|
61
|
-
handshaker.once('handshakeRequest', () => {
|
|
62
|
-
logger.trace(remoteNodeId + ' incoming handshake request');
|
|
63
|
-
if (this.onNewConnection(pendingConnection)) {
|
|
64
|
-
logger.trace(remoteNodeId + ' calling acceptHandshake');
|
|
65
|
-
(0, Handshaker_1.acceptHandshake)(handshaker, pendingConnection, connection);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
(0, Handshaker_1.rejectHandshake)(pendingConnection, connection, handshaker, DhtRpc_1.HandshakeError.DUPLICATE_CONNECTION);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
this.simulator.accept(sourceConnection, connection);
|
|
72
|
-
}
|
|
73
|
-
async stop() {
|
|
74
|
-
this.stopped = true;
|
|
75
|
-
const conns = Array.from(this.connectingConnections.values());
|
|
76
|
-
await Promise.allSettled(conns.map(async (conn) => conn.close(false)));
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.SimulatorConnector = SimulatorConnector;
|
|
80
|
-
//# sourceMappingURL=SimulatorConnector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SimulatorConnector.js","sourceRoot":"","sources":["../../../../src/connection/simulator/Simul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,IAAA,qCAAwB,EAAC,IAAI,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,UAAU,CAAC,CAAA;QACpG,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QAEzB,UAAU,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,EAAE;YACrC,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,6BAA6B,CAAC,CAAA;YAE1D,IAAI,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,EAAE,CAAC;gBAC1C,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,0BAA0B,CAAC,CAAA;gBACvD,IAAA,4BAAe,EAAC,UAAU,EAAE,iBAAiB,EAAE,UAAU,CAAC,CAAA;YAC9D,CAAC;iBAAM,CAAC;gBACJ,IAAA,4BAAe,EAAC,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,uBAAc,CAAC,oBAAoB,CAAC,CAAA;YACnG,CAAC;QACL,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAA;IACvD,CAAC;IAEM,KAAK,CAAC,IAAI;QACb,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QACnB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,CAAC,CAAA;QAC7D,MAAM,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC1E,CAAC;CACJ;AAlFD,gDAkFC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc';
|
|
2
|
-
import { ConnectionManager } from '../ConnectionManager';
|
|
3
|
-
import { Simulator } from './Simulator';
|
|
4
|
-
export declare class SimulatorTransport extends ConnectionManager {
|
|
5
|
-
constructor(localPeerDescriptor: PeerDescriptor, simulator: Simulator);
|
|
6
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SimulatorTransport = void 0;
|
|
4
|
-
const utils_1 = require("@streamr/utils");
|
|
5
|
-
const ConnectionManager_1 = require("../ConnectionManager");
|
|
6
|
-
const ConnectorFacade_1 = require("../ConnectorFacade");
|
|
7
|
-
class SimulatorTransport extends ConnectionManager_1.ConnectionManager {
|
|
8
|
-
constructor(localPeerDescriptor, simulator) {
|
|
9
|
-
super({
|
|
10
|
-
createConnectorFacade: () => new ConnectorFacade_1.SimulatorConnectorFacade(localPeerDescriptor, simulator),
|
|
11
|
-
metricsContext: new utils_1.MetricsContext(),
|
|
12
|
-
allowIncomingPrivateConnections: false
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.SimulatorTransport = SimulatorTransport;
|
|
17
|
-
//# sourceMappingURL=SimulatorTransport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SimulatorTransport.js","sourceRoot":"","sources":["../../../../src/connection/simulator/SimulatorTransport.ts"],"names":[],"mappings":";;;AAAA,0CAA+C;AAE/C,4DAAwD;AAExD,wDAA6D;AAE7D,MAAa,kBAAmB,SAAQ,qCAAiB;IACrD,YAAY,mBAAmC,EAAE,SAAoB;QACjE,KAAK,CAAC;YACF,qBAAqB,EAAE,GAAG,EAAE,CAAC,IAAI,0CAAwB,CAAC,mBAAmB,EAAE,SAAS,CAAC;YACzF,cAAc,EAAE,IAAI,sBAAc,EAAE;YACpC,+BAA+B,EAAE,KAAK;SACzC,CAAC,CAAA;IACN,CAAC;CACJ;AARD,gDAQC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare enum RegionIndex {
|
|
2
|
-
eu_central_1 = 0,
|
|
3
|
-
eu_west_1 = 1,
|
|
4
|
-
eu_west_2 = 2,
|
|
5
|
-
eu_west_3 = 3,
|
|
6
|
-
eu_north_1 = 4,
|
|
7
|
-
us_east_1 = 5,
|
|
8
|
-
us_east_2 = 6,
|
|
9
|
-
us_west_1 = 7,
|
|
10
|
-
us_west_2 = 8,
|
|
11
|
-
ca_central_1 = 9,
|
|
12
|
-
ap_south_1 = 10,
|
|
13
|
-
ap_northeast_2 = 11,
|
|
14
|
-
ap_southeast_1 = 12,
|
|
15
|
-
ap_southeast_2 = 13,
|
|
16
|
-
ap_northeast_1 = 14,
|
|
17
|
-
sa_east_1 = 15
|
|
18
|
-
}
|
|
19
|
-
export declare const regionPingMatrix: number[][];
|
|
20
|
-
export declare function getRegionDelayMatrix(): number[][];
|
|
21
|
-
export declare function getRandomRegion(): number;
|