@streamr/dht 100.0.0-testnet-one.4 → 100.0.0-testnet-two.1
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 +66 -0
- package/dist/src/connection/ConnectionLockHandler.d.ts +11 -11
- package/dist/src/connection/ConnectionLockHandler.js.map +1 -1
- package/dist/src/connection/ConnectionLockRpcLocal.d.ts +3 -3
- package/dist/src/connection/ConnectionLockRpcLocal.js +4 -4
- package/dist/src/connection/ConnectionLockRpcLocal.js.map +1 -1
- package/dist/src/connection/ConnectionLockRpcRemote.d.ts +3 -5
- package/dist/src/connection/ConnectionLockRpcRemote.js +4 -7
- package/dist/src/connection/ConnectionLockRpcRemote.js.map +1 -1
- package/dist/src/connection/ConnectionManager.d.ts +4 -6
- package/dist/src/connection/ConnectionManager.js +48 -46
- package/dist/src/connection/ConnectionManager.js.map +1 -1
- package/dist/src/connection/ConnectorFacade.d.ts +2 -2
- package/dist/src/connection/ConnectorFacade.js +2 -1
- package/dist/src/connection/ConnectorFacade.js.map +1 -1
- package/dist/src/connection/Handshaker.d.ts +1 -1
- package/dist/src/connection/Handshaker.js +14 -5
- package/dist/src/connection/Handshaker.js.map +1 -1
- package/dist/src/connection/ManagedConnection.d.ts +4 -7
- package/dist/src/connection/ManagedConnection.js +9 -13
- package/dist/src/connection/ManagedConnection.js.map +1 -1
- package/dist/src/connection/connectivityChecker.js +1 -0
- package/dist/src/connection/connectivityChecker.js.map +1 -1
- package/dist/src/connection/simulator/Simulator.d.ts +0 -3
- package/dist/src/connection/simulator/Simulator.js +3 -51
- package/dist/src/connection/simulator/Simulator.js.map +1 -1
- package/dist/src/connection/simulator/SimulatorConnector.js +5 -5
- package/dist/src/connection/simulator/SimulatorConnector.js.map +1 -1
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js +2 -2
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnector.d.ts +0 -1
- package/dist/src/connection/webrtc/WebrtcConnector.js +7 -9
- package/dist/src/connection/webrtc/WebrtcConnector.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.d.ts +2 -2
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js +21 -14
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.d.ts +2 -5
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js +1 -4
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js.map +1 -1
- package/dist/src/connection/websocket/AutoCertifierClientFacade.d.ts +1 -2
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js +3 -4
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js.map +1 -1
- package/dist/src/connection/websocket/ClientWebsocket.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketConnector.d.ts +2 -7
- package/dist/src/connection/websocket/WebsocketConnector.js +48 -44
- package/dist/src/connection/websocket/WebsocketConnector.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.d.ts +3 -2
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js +8 -10
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.d.ts +3 -6
- package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.js +0 -3
- package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketServer.d.ts +1 -4
- package/dist/src/connection/websocket/WebsocketServer.js +11 -12
- package/dist/src/connection/websocket/WebsocketServer.js.map +1 -1
- package/dist/src/dht/DhtNode.d.ts +10 -13
- package/dist/src/dht/DhtNode.js +41 -54
- package/dist/src/dht/DhtNode.js.map +1 -1
- package/dist/src/dht/DhtNodeRpcLocal.d.ts +2 -3
- package/dist/src/dht/DhtNodeRpcLocal.js +1 -1
- package/dist/src/dht/DhtNodeRpcLocal.js.map +1 -1
- package/dist/src/dht/DhtNodeRpcRemote.d.ts +7 -7
- package/dist/src/dht/DhtNodeRpcRemote.js +9 -11
- package/dist/src/dht/DhtNodeRpcRemote.js.map +1 -1
- package/dist/src/dht/ExternalApiRpcLocal.d.ts +5 -4
- package/dist/src/dht/ExternalApiRpcLocal.js +3 -2
- package/dist/src/dht/ExternalApiRpcLocal.js.map +1 -1
- package/dist/src/dht/ExternalApiRpcRemote.d.ts +2 -2
- package/dist/src/dht/ExternalApiRpcRemote.js +2 -0
- package/dist/src/dht/ExternalApiRpcRemote.js.map +1 -1
- package/dist/src/dht/PeerManager.d.ts +13 -14
- package/dist/src/dht/PeerManager.js +45 -60
- package/dist/src/dht/PeerManager.js.map +1 -1
- package/dist/src/dht/contact/Contact.d.ts +2 -2
- package/dist/src/dht/contact/Contact.js +2 -2
- package/dist/src/dht/contact/Contact.js.map +1 -1
- package/dist/src/dht/contact/ContactList.d.ts +7 -7
- package/dist/src/dht/contact/ContactList.js +3 -3
- package/dist/src/dht/contact/ContactList.js.map +1 -1
- package/dist/src/dht/contact/RandomContactList.d.ts +4 -4
- package/dist/src/dht/contact/RandomContactList.js +12 -11
- package/dist/src/dht/contact/RandomContactList.js.map +1 -1
- package/dist/src/dht/contact/RpcRemote.d.ts +7 -4
- package/dist/src/dht/contact/RpcRemote.js +5 -2
- package/dist/src/dht/contact/RpcRemote.js.map +1 -1
- package/dist/src/dht/contact/SortedContactList.d.ts +13 -13
- package/dist/src/dht/contact/SortedContactList.js +33 -29
- package/dist/src/dht/contact/SortedContactList.js.map +1 -1
- package/dist/src/dht/discovery/DiscoverySession.d.ts +2 -4
- package/dist/src/dht/discovery/DiscoverySession.js +19 -23
- package/dist/src/dht/discovery/DiscoverySession.js.map +1 -1
- package/dist/src/dht/discovery/PeerDiscovery.d.ts +2 -5
- package/dist/src/dht/discovery/PeerDiscovery.js +12 -20
- package/dist/src/dht/discovery/PeerDiscovery.js.map +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.d.ts +36 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js +165 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.d.ts +14 -0
- package/dist/src/dht/{find/FindRpcLocal.js → recursive-operation/RecursiveOperationRpcLocal.js} +7 -7
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.d.ts +6 -0
- package/dist/src/dht/{routing/FindRpcRemote.js → recursive-operation/RecursiveOperationRpcRemote.js} +11 -11
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.d.ts +42 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js +182 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.d.ts +12 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js +17 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.d.ts +6 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js +21 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js.map +1 -0
- package/dist/src/dht/routing/Router.d.ts +4 -19
- package/dist/src/dht/routing/Router.js +41 -33
- package/dist/src/dht/routing/Router.js.map +1 -1
- package/dist/src/dht/routing/RouterRpcLocal.js +6 -5
- package/dist/src/dht/routing/RouterRpcLocal.js.map +1 -1
- package/dist/src/dht/routing/RouterRpcRemote.d.ts +2 -2
- package/dist/src/dht/routing/RouterRpcRemote.js +7 -7
- package/dist/src/dht/routing/RouterRpcRemote.js.map +1 -1
- package/dist/src/dht/routing/RoutingSession.d.ts +20 -16
- package/dist/src/dht/routing/RoutingSession.js +37 -45
- package/dist/src/dht/routing/RoutingSession.js.map +1 -1
- package/dist/src/dht/store/LocalDataStore.d.ts +11 -13
- package/dist/src/dht/store/LocalDataStore.js +36 -56
- package/dist/src/dht/store/LocalDataStore.js.map +1 -1
- package/dist/src/dht/store/StoreManager.d.ts +33 -0
- package/dist/src/dht/store/StoreManager.js +186 -0
- package/dist/src/dht/store/StoreManager.js.map +1 -0
- package/dist/src/dht/store/StoreRpcLocal.d.ts +8 -40
- package/dist/src/dht/store/StoreRpcLocal.js +13 -229
- package/dist/src/dht/store/StoreRpcLocal.js.map +1 -1
- package/dist/src/dht/store/StoreRpcRemote.d.ts +5 -5
- package/dist/src/dht/store/StoreRpcRemote.js +4 -5
- package/dist/src/dht/store/StoreRpcRemote.js.map +1 -1
- package/dist/src/exports.d.ts +2 -0
- package/dist/src/exports.js.map +1 -1
- package/dist/src/helpers/MapWithTtl.d.ts +14 -0
- package/dist/src/helpers/MapWithTtl.js +59 -0
- package/dist/src/helpers/MapWithTtl.js.map +1 -0
- package/dist/src/helpers/PeerID.d.ts +2 -0
- package/dist/src/helpers/PeerID.js +4 -0
- package/dist/src/helpers/PeerID.js.map +1 -1
- package/dist/src/helpers/nodeId.d.ts +5 -0
- package/dist/src/helpers/nodeId.js +18 -1
- package/dist/src/helpers/nodeId.js.map +1 -1
- package/dist/src/helpers/peerIdFromPeerDescriptor.d.ts +2 -1
- package/dist/src/helpers/peerIdFromPeerDescriptor.js +2 -1
- package/dist/src/helpers/peerIdFromPeerDescriptor.js.map +1 -1
- package/dist/src/helpers/protoClasses.js +2 -3
- package/dist/src/helpers/protoClasses.js.map +1 -1
- package/dist/src/helpers/versionCompatibility.d.ts +2 -0
- package/dist/src/helpers/versionCompatibility.js +18 -0
- package/dist/src/helpers/versionCompatibility.js.map +1 -0
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +21 -22
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +18 -18
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +49 -65
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +43 -58
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +11 -12
- package/dist/src/rpc-protocol/DhtCallContext.d.ts +2 -1
- package/dist/src/rpc-protocol/DhtCallContext.js.map +1 -1
- package/dist/src/rpc-protocol/DhtRpcOptions.d.ts +2 -1
- package/dist/src/transport/ITransport.d.ts +9 -1
- package/dist/src/transport/ITransport.js +5 -0
- package/dist/src/transport/ITransport.js.map +1 -1
- package/dist/src/transport/ListeningRpcCommunicator.js +1 -1
- package/dist/src/transport/ListeningRpcCommunicator.js.map +1 -1
- package/dist/src/transport/RoutingRpcCommunicator.d.ts +2 -1
- package/dist/src/transport/RoutingRpcCommunicator.js +16 -11
- package/dist/src/transport/RoutingRpcCommunicator.js.map +1 -1
- package/jest.config.js +4 -1
- package/karma-setup.js +2 -0
- package/karma.config.js +11 -7
- package/package.json +6 -7
- package/protos/DhtRpc.proto +20 -24
- package/src/connection/ConnectionLockHandler.ts +15 -15
- package/src/connection/ConnectionLockRpcLocal.ts +8 -9
- package/src/connection/ConnectionLockRpcRemote.ts +7 -16
- package/src/connection/ConnectionManager.ts +58 -55
- package/src/connection/ConnectorFacade.ts +3 -0
- package/src/connection/Handshaker.ts +21 -6
- package/src/connection/ManagedConnection.ts +20 -34
- package/src/connection/connectivityChecker.ts +1 -0
- package/src/connection/simulator/Simulator.ts +5 -36
- package/src/connection/simulator/SimulatorConnector.ts +8 -8
- package/src/connection/webrtc/BrowserWebrtcConnection.ts +0 -3
- package/src/connection/webrtc/NodeWebrtcConnection.ts +3 -4
- package/src/connection/webrtc/WebrtcConnector.ts +11 -13
- package/src/connection/webrtc/WebrtcConnectorRpcLocal.ts +25 -18
- package/src/connection/webrtc/WebrtcConnectorRpcRemote.ts +3 -13
- package/src/connection/websocket/AutoCertifierClientFacade.ts +4 -6
- package/src/connection/websocket/ClientWebsocket.ts +1 -0
- package/src/connection/websocket/WebsocketConnector.ts +57 -61
- package/src/connection/websocket/WebsocketConnectorRpcLocal.ts +11 -13
- package/src/connection/websocket/WebsocketConnectorRpcRemote.ts +4 -15
- package/src/connection/websocket/WebsocketServer.ts +14 -17
- package/src/dht/DhtNode.ts +69 -71
- package/src/dht/DhtNodeRpcLocal.ts +1 -3
- package/src/dht/DhtNodeRpcRemote.ts +14 -18
- package/src/dht/ExternalApiRpcLocal.ts +16 -6
- package/src/dht/ExternalApiRpcRemote.ts +5 -3
- package/src/dht/PeerManager.ts +73 -90
- package/src/dht/contact/Contact.ts +5 -4
- package/src/dht/contact/ContactList.ts +9 -9
- package/src/dht/contact/RandomContactList.ts +14 -14
- package/src/dht/contact/RpcRemote.ts +10 -7
- package/src/dht/contact/SortedContactList.ts +48 -45
- package/src/dht/discovery/DiscoverySession.ts +25 -27
- package/src/dht/discovery/PeerDiscovery.ts +16 -37
- package/src/dht/recursive-operation/RecursiveOperationManager.ts +240 -0
- package/src/dht/{find/FindRpcLocal.ts → recursive-operation/RecursiveOperationRpcLocal.ts} +9 -9
- package/src/dht/{routing/FindRpcRemote.ts → recursive-operation/RecursiveOperationRpcRemote.ts} +10 -10
- package/src/dht/recursive-operation/RecursiveOperationSession.ts +224 -0
- package/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.ts +25 -0
- package/src/dht/{find/FindSessionRpcRemote.ts → recursive-operation/RecursiveOperationSessionRpcRemote.ts} +8 -8
- package/src/dht/routing/Router.ts +45 -64
- package/src/dht/routing/RouterRpcLocal.ts +7 -6
- package/src/dht/routing/RouterRpcRemote.ts +9 -10
- package/src/dht/routing/RoutingSession.ts +59 -68
- package/src/dht/store/LocalDataStore.ts +47 -66
- package/src/dht/store/StoreManager.ts +217 -0
- package/src/dht/store/StoreRpcLocal.ts +26 -302
- package/src/dht/store/StoreRpcRemote.ts +9 -11
- package/src/exports.ts +2 -0
- package/src/helpers/MapWithTtl.ts +71 -0
- package/src/helpers/PeerID.ts +5 -0
- package/src/helpers/nodeId.ts +20 -0
- package/src/helpers/peerIdFromPeerDescriptor.ts +5 -3
- package/src/helpers/protoClasses.ts +4 -6
- package/src/helpers/versionCompatibility.ts +13 -0
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +31 -32
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +11 -12
- package/src/proto/packages/dht/protos/DhtRpc.ts +67 -90
- package/src/rpc-protocol/DhtCallContext.ts +2 -1
- package/src/rpc-protocol/DhtRpcOptions.ts +2 -1
- package/src/transport/ITransport.ts +10 -1
- package/src/transport/ListeningRpcCommunicator.ts +1 -1
- package/src/transport/RoutingRpcCommunicator.ts +18 -12
- package/test/benchmark/Find.test.ts +8 -21
- package/test/benchmark/KademliaCorrectness.test.ts +11 -20
- package/test/benchmark/SortedContactListBenchmark.test.ts +9 -9
- package/test/benchmark/kademlia-simulation/Contact.ts +9 -8
- package/test/benchmark/kademlia-simulation/KademliaSimulation.ts +2 -2
- package/test/benchmark/kademlia-simulation/SimulationNode.ts +17 -17
- package/test/end-to-end/Layer0-Layer1.test.ts +10 -14
- package/test/end-to-end/Layer0.test.ts +15 -18
- package/test/end-to-end/Layer0MixedConnectionTypes.test.ts +7 -9
- package/test/end-to-end/Layer0Webrtc-Layer1.test.ts +4 -10
- package/test/end-to-end/Layer0Webrtc.test.ts +5 -6
- package/test/end-to-end/Layer1-Scale-WebSocket.test.ts +8 -16
- package/test/end-to-end/Layer1-Scale-Webrtc.test.ts +6 -13
- package/test/end-to-end/WebsocketConnectionRequest.test.ts +5 -6
- package/test/end-to-end/memory-leak.test.ts +6 -8
- package/test/integration/ConnectionLocking.test.ts +6 -13
- package/test/integration/ConnectionManager.test.ts +26 -43
- package/test/integration/DhtJoinPeerDiscovery.test.ts +5 -10
- package/test/integration/DhtNodeExternalAPI.test.ts +16 -22
- package/test/integration/DhtNodeRpcRemote.test.ts +13 -22
- package/test/integration/DhtRpc.test.ts +13 -18
- package/test/integration/Find.test.ts +10 -10
- package/test/integration/Layer1-scale.test.ts +17 -28
- package/test/integration/Mock-Layer1-Layer0.test.ts +25 -43
- package/test/integration/MultipleEntryPointJoining.test.ts +7 -7
- package/test/integration/ReplicateData.test.ts +28 -30
- package/test/integration/RouteMessage.test.ts +30 -27
- package/test/integration/RouterRpcRemote.test.ts +12 -18
- package/test/integration/RpcErrors.test.ts +8 -21
- package/test/integration/ScaleDownDht.test.ts +11 -10
- package/test/integration/SimultaneousConnections.test.ts +43 -67
- package/test/integration/Store.test.ts +23 -36
- package/test/integration/StoreAndDelete.test.ts +30 -50
- package/test/integration/StoreOnDhtWithTwoNodes.test.ts +16 -37
- package/test/integration/StoreRpcRemote.test.ts +20 -30
- package/test/integration/WebrtcConnectionManagement.test.ts +3 -13
- package/test/integration/WebrtcConnectorRpc.test.ts +3 -9
- package/test/integration/WebsocketConnectionManagement.test.ts +7 -10
- package/test/integration/WebsocketConnectorRpc.test.ts +8 -17
- package/test/unit/ConnectivityHelpers.test.ts +9 -17
- package/test/unit/DuplicateDetector.test.ts +7 -4
- package/test/unit/LocalDataStore.test.ts +66 -77
- package/test/unit/PeerManager.test.ts +31 -0
- package/test/unit/RandomContactList.test.ts +13 -8
- package/test/unit/{Finder.test.ts → RecursiveOperationManager.test.ts} +38 -43
- package/test/unit/RecursiveOperationSession.test.ts +68 -0
- package/test/unit/Router.test.ts +15 -22
- package/test/unit/RoutingSession.test.ts +23 -25
- package/test/unit/SortedContactList.test.ts +41 -26
- package/test/unit/StoreManager.test.ts +132 -0
- package/test/unit/WebsocketConnector.test.ts +27 -35
- package/test/unit/customMatchers.test.ts +16 -0
- package/test/unit/versionCompatibility.test.ts +16 -0
- package/test/utils/FakeTransport.ts +44 -0
- package/test/utils/customMatchers.ts +70 -0
- package/test/utils/mock/MockRpcCommunicator.ts +7 -0
- package/test/utils/mock/Router.ts +3 -2
- package/test/utils/mock/mockDataEntry.ts +36 -0
- package/test/utils/utils.ts +49 -87
- package/tsconfig.browser.json +2 -1
- package/tsconfig.jest.json +2 -1
- package/tsconfig.node.json +2 -1
- package/dist/src/dht/find/FindRpcLocal.d.ts +0 -14
- package/dist/src/dht/find/FindRpcLocal.js.map +0 -1
- package/dist/src/dht/find/FindSession.d.ts +0 -44
- package/dist/src/dht/find/FindSession.js +0 -150
- package/dist/src/dht/find/FindSession.js.map +0 -1
- package/dist/src/dht/find/FindSessionRpcLocal.d.ts +0 -12
- package/dist/src/dht/find/FindSessionRpcLocal.js +0 -17
- package/dist/src/dht/find/FindSessionRpcLocal.js.map +0 -1
- package/dist/src/dht/find/FindSessionRpcRemote.d.ts +0 -6
- package/dist/src/dht/find/FindSessionRpcRemote.js +0 -21
- package/dist/src/dht/find/FindSessionRpcRemote.js.map +0 -1
- package/dist/src/dht/find/Finder.d.ts +0 -49
- package/dist/src/dht/find/Finder.js +0 -197
- package/dist/src/dht/find/Finder.js.map +0 -1
- package/dist/src/dht/routing/FindRpcRemote.d.ts +0 -6
- package/dist/src/dht/routing/FindRpcRemote.js.map +0 -1
- package/src/dht/find/FindSession.ts +0 -183
- package/src/dht/find/FindSessionRpcLocal.ts +0 -25
- package/src/dht/find/Finder.ts +0 -295
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamr/dht",
|
|
3
|
-
"version": "100.0.0-testnet-
|
|
3
|
+
"version": "100.0.0-testnet-two.1",
|
|
4
4
|
"description": "Streamr Network DHT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,26 +31,25 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@protobuf-ts/runtime": "^2.8.2",
|
|
33
33
|
"@protobuf-ts/runtime-rpc": "^2.8.2",
|
|
34
|
-
"@streamr/autocertifier-client": "100.0.0-testnet-
|
|
35
|
-
"@streamr/proto-rpc": "100.0.0-testnet-
|
|
36
|
-
"@streamr/utils": "100.0.0-testnet-
|
|
34
|
+
"@streamr/autocertifier-client": "100.0.0-testnet-two.1",
|
|
35
|
+
"@streamr/proto-rpc": "100.0.0-testnet-two.1",
|
|
36
|
+
"@streamr/utils": "100.0.0-testnet-two.1",
|
|
37
37
|
"eventemitter3": "^5.0.0",
|
|
38
38
|
"heap": "^0.2.6",
|
|
39
39
|
"ipaddr.js": "^2.0.1",
|
|
40
40
|
"k-bucket": "^5.1.0",
|
|
41
41
|
"lodash": "^4.17.21",
|
|
42
42
|
"node-datachannel": "^0.4.3",
|
|
43
|
-
"sinon": "15.1.2",
|
|
44
43
|
"uuid": "^9.0.1",
|
|
45
44
|
"websocket": "^1.0.34"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
47
|
"@streamr/browser-test-runner": "^0.0.1",
|
|
49
|
-
"@streamr/test-utils": "100.0.0-testnet-
|
|
48
|
+
"@streamr/test-utils": "100.0.0-testnet-two.1",
|
|
50
49
|
"@types/express": "^4.17.21",
|
|
51
50
|
"@types/heap": "^0.2.34",
|
|
52
51
|
"@types/k-bucket": "^5.0.1",
|
|
53
|
-
"@types/lodash": "^4.14.
|
|
52
|
+
"@types/lodash": "^4.14.202",
|
|
54
53
|
"@types/sinon": "^10.0.15",
|
|
55
54
|
"@types/uuid": "^9.0.7",
|
|
56
55
|
"@types/websocket": "^1.0.3",
|
package/protos/DhtRpc.proto
CHANGED
|
@@ -19,8 +19,8 @@ service RouterRpc {
|
|
|
19
19
|
rpc forwardMessage (RouteMessageWrapper) returns (RouteMessageAck);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
service
|
|
23
|
-
rpc
|
|
22
|
+
service RecursiveOperationRpc {
|
|
23
|
+
rpc routeRequest (RouteMessageWrapper) returns (RouteMessageAck);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
service StoreRpc {
|
|
@@ -28,12 +28,12 @@ service StoreRpc {
|
|
|
28
28
|
rpc replicateData (ReplicateDataRequest) returns (google.protobuf.Empty);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
service
|
|
32
|
-
rpc
|
|
31
|
+
service RecursiveOperationSessionRpc {
|
|
32
|
+
rpc sendResponse(RecursiveOperationResponse) returns (google.protobuf.Empty);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
service WebsocketConnectorRpc {
|
|
36
|
-
rpc requestConnection (WebsocketConnectionRequest) returns (
|
|
36
|
+
rpc requestConnection (WebsocketConnectionRequest) returns (google.protobuf.Empty);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
service WebrtcConnectorRpc {
|
|
@@ -59,13 +59,12 @@ service ExternalApiRpc {
|
|
|
59
59
|
message StoreDataRequest {
|
|
60
60
|
bytes key = 1;
|
|
61
61
|
google.protobuf.Any data = 2;
|
|
62
|
-
|
|
62
|
+
bytes creator = 3;
|
|
63
63
|
google.protobuf.Timestamp createdAt = 4;
|
|
64
64
|
uint32 ttl = 5;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
message StoreDataResponse {
|
|
68
|
-
string error = 1;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
message ExternalStoreDataRequest {
|
|
@@ -84,7 +83,7 @@ message ReplicateDataRequest {
|
|
|
84
83
|
message DataEntry {
|
|
85
84
|
bytes key = 1;
|
|
86
85
|
google.protobuf.Any data = 2;
|
|
87
|
-
|
|
86
|
+
bytes creator = 3;
|
|
88
87
|
google.protobuf.Timestamp createdAt = 4;
|
|
89
88
|
google.protobuf.Timestamp storedAt = 5;
|
|
90
89
|
uint32 ttl = 6; // milliseconds
|
|
@@ -102,18 +101,18 @@ message ClosestPeersResponse {
|
|
|
102
101
|
string requestId = 2;
|
|
103
102
|
}
|
|
104
103
|
|
|
105
|
-
message
|
|
104
|
+
message RecursiveOperationRequest {
|
|
106
105
|
string sessionId = 1;
|
|
107
|
-
|
|
106
|
+
RecursiveOperation operation = 2;
|
|
108
107
|
}
|
|
109
108
|
|
|
110
|
-
enum
|
|
111
|
-
|
|
109
|
+
enum RecursiveOperation {
|
|
110
|
+
FIND_NODE = 0;
|
|
112
111
|
FETCH_DATA = 1;
|
|
113
112
|
DELETE_DATA = 2;
|
|
114
113
|
}
|
|
115
114
|
|
|
116
|
-
message
|
|
115
|
+
message RecursiveOperationResponse {
|
|
117
116
|
repeated PeerDescriptor closestConnectedPeers = 1;
|
|
118
117
|
repeated DataEntry dataEntries = 2;
|
|
119
118
|
bool noCloserNodesFound = 3;
|
|
@@ -129,7 +128,6 @@ message PingResponse {
|
|
|
129
128
|
}
|
|
130
129
|
|
|
131
130
|
message LeaveNotice {
|
|
132
|
-
string serviceId = 1;
|
|
133
131
|
}
|
|
134
132
|
|
|
135
133
|
message PeerDescriptor {
|
|
@@ -150,7 +148,6 @@ message ConnectivityMethod {
|
|
|
150
148
|
enum NodeType {
|
|
151
149
|
NODEJS = 0;
|
|
152
150
|
BROWSER = 1;
|
|
153
|
-
VIRTUAL = 3;
|
|
154
151
|
}
|
|
155
152
|
|
|
156
153
|
enum RpcResponseError {
|
|
@@ -161,9 +158,9 @@ enum RpcResponseError {
|
|
|
161
158
|
}
|
|
162
159
|
|
|
163
160
|
message RouteMessageWrapper {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
161
|
+
string requestId = 1;
|
|
162
|
+
PeerDescriptor sourcePeer = 2;
|
|
163
|
+
bytes target = 3;
|
|
167
164
|
Message message = 4;
|
|
168
165
|
repeated PeerDescriptor reachableThrough = 5;
|
|
169
166
|
repeated PeerDescriptor routingPath = 6;
|
|
@@ -200,16 +197,19 @@ message ConnectivityResponse {
|
|
|
200
197
|
message HandshakeRequest {
|
|
201
198
|
PeerDescriptor sourcePeerDescriptor = 1;
|
|
202
199
|
optional PeerDescriptor targetPeerDescriptor = 2;
|
|
200
|
+
string version = 3;
|
|
203
201
|
}
|
|
204
202
|
|
|
205
203
|
message HandshakeResponse {
|
|
206
204
|
PeerDescriptor sourcePeerDescriptor = 1;
|
|
207
205
|
optional HandshakeError error = 2;
|
|
206
|
+
string version = 3;
|
|
208
207
|
}
|
|
209
208
|
|
|
210
209
|
enum HandshakeError {
|
|
211
210
|
DUPLICATE_CONNECTION = 0;
|
|
212
211
|
INVALID_TARGET_PEER_DESCRIPTOR = 1;
|
|
212
|
+
UNSUPPORTED_VERSION = 2;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
// Wraps all messages
|
|
@@ -220,7 +220,7 @@ enum MessageType {
|
|
|
220
220
|
CONNECTIVITY_RESPONSE = 2;
|
|
221
221
|
HANDSHAKE_REQUEST = 3;
|
|
222
222
|
HANDSHAKE_RESPONSE = 4;
|
|
223
|
-
|
|
223
|
+
RECURSIVE_OPERATION_REQUEST = 5;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
message Message {
|
|
@@ -235,7 +235,7 @@ message Message {
|
|
|
235
235
|
HandshakeRequest handshakeRequest = 8;
|
|
236
236
|
HandshakeResponse handshakeResponse = 9;
|
|
237
237
|
protorpc.RpcMessage rpcMessage = 10;
|
|
238
|
-
|
|
238
|
+
RecursiveOperationRequest recursiveOperationRequest = 11;
|
|
239
239
|
};
|
|
240
240
|
}
|
|
241
241
|
|
|
@@ -245,10 +245,6 @@ message Message {
|
|
|
245
245
|
message WebsocketConnectionRequest {
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
message WebsocketConnectionResponse {
|
|
249
|
-
bool accepted = 1;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
248
|
// WebRTC
|
|
253
249
|
message WebrtcConnectionRequest {
|
|
254
250
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// Connection locks are independent of the existence of connections
|
|
2
2
|
// that is why this class is needed
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { NodeID } from '../helpers/nodeId'
|
|
5
5
|
|
|
6
6
|
export type LockID = string
|
|
7
7
|
|
|
8
8
|
export class ConnectionLockHandler {
|
|
9
9
|
|
|
10
|
-
private localLocks: Map<
|
|
11
|
-
private remoteLocks: Map<
|
|
10
|
+
private localLocks: Map<NodeID, Set<LockID>> = new Map()
|
|
11
|
+
private remoteLocks: Map<NodeID, Set<LockID>> = new Map()
|
|
12
12
|
// TODO: remove weakLocks use localLocks instead. When opening weakLocks from the ConnectioManager,
|
|
13
13
|
// simply do not send lock requests.
|
|
14
|
-
private weakLocks: Set<
|
|
14
|
+
private weakLocks: Set<NodeID> = new Set()
|
|
15
15
|
|
|
16
16
|
public getNumberOfLocalLockedConnections(): number {
|
|
17
17
|
return this.localLocks.size
|
|
@@ -25,7 +25,7 @@ export class ConnectionLockHandler {
|
|
|
25
25
|
return this.weakLocks.size
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
public isLocalLocked(id:
|
|
28
|
+
public isLocalLocked(id: NodeID, lockId?: LockID): boolean {
|
|
29
29
|
if (lockId === undefined) {
|
|
30
30
|
return this.localLocks.has(id)
|
|
31
31
|
} else {
|
|
@@ -33,7 +33,7 @@ export class ConnectionLockHandler {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
public isRemoteLocked(id:
|
|
36
|
+
public isRemoteLocked(id: NodeID, lockId?: LockID): boolean {
|
|
37
37
|
if (lockId === undefined) {
|
|
38
38
|
return this.remoteLocks.has(id)
|
|
39
39
|
} else {
|
|
@@ -45,33 +45,33 @@ export class ConnectionLockHandler {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
private isWeakLocked(id:
|
|
48
|
+
private isWeakLocked(id: NodeID): boolean {
|
|
49
49
|
return this.weakLocks.has(id)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
public isLocked(id:
|
|
52
|
+
public isLocked(id: NodeID): boolean {
|
|
53
53
|
return (this.isLocalLocked(id) || this.isRemoteLocked(id) || this.isWeakLocked(id))
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
public addLocalLocked(id:
|
|
56
|
+
public addLocalLocked(id: NodeID, lockId: LockID): void {
|
|
57
57
|
if (!this.localLocks.has(id)) {
|
|
58
58
|
this.localLocks.set(id, new Set())
|
|
59
59
|
}
|
|
60
60
|
this.localLocks.get(id)!.add(lockId)
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
public addRemoteLocked(id:
|
|
63
|
+
public addRemoteLocked(id: NodeID, lockId: LockID): void {
|
|
64
64
|
if (!this.remoteLocks.has(id)) {
|
|
65
65
|
this.remoteLocks.set(id, new Set())
|
|
66
66
|
}
|
|
67
67
|
this.remoteLocks.get(id)!.add(lockId)
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
public addWeakLocked(id:
|
|
70
|
+
public addWeakLocked(id: NodeID): void {
|
|
71
71
|
this.weakLocks.add(id)
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
public removeLocalLocked(id:
|
|
74
|
+
public removeLocalLocked(id: NodeID, lockId: LockID): void {
|
|
75
75
|
if (this.localLocks.has(id)) {
|
|
76
76
|
this.localLocks.get(id)?.delete(lockId)
|
|
77
77
|
if (this.localLocks.get(id)?.size === 0) {
|
|
@@ -80,7 +80,7 @@ export class ConnectionLockHandler {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
public removeRemoteLocked(id:
|
|
83
|
+
public removeRemoteLocked(id: NodeID, lockId: LockID): void {
|
|
84
84
|
if (this.remoteLocks.has(id)) {
|
|
85
85
|
this.remoteLocks.get(id)?.delete(lockId)
|
|
86
86
|
if (this.remoteLocks.get(id)?.size === 0) {
|
|
@@ -89,11 +89,11 @@ export class ConnectionLockHandler {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
public removeWeakLocked(id:
|
|
92
|
+
public removeWeakLocked(id: NodeID): void {
|
|
93
93
|
this.weakLocks.delete(id)
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
public clearAllLocks(id:
|
|
96
|
+
public clearAllLocks(id: NodeID): void {
|
|
97
97
|
this.localLocks.delete(id)
|
|
98
98
|
this.remoteLocks.delete(id)
|
|
99
99
|
this.weakLocks.delete(id)
|
|
@@ -2,8 +2,7 @@ import { ServerCallContext } from '@protobuf-ts/runtime-rpc'
|
|
|
2
2
|
import { Logger } from '@streamr/utils'
|
|
3
3
|
import {
|
|
4
4
|
areEqualPeerDescriptors,
|
|
5
|
-
|
|
6
|
-
peerIdFromPeerDescriptor
|
|
5
|
+
getNodeIdFromPeerDescriptor
|
|
7
6
|
} from '../helpers/peerIdFromPeerDescriptor'
|
|
8
7
|
import { Empty } from '../proto/google/protobuf/empty'
|
|
9
8
|
import {
|
|
@@ -16,13 +15,13 @@ import {
|
|
|
16
15
|
} from '../proto/packages/dht/protos/DhtRpc'
|
|
17
16
|
import { IConnectionLockRpc } from '../proto/packages/dht/protos/DhtRpc.server'
|
|
18
17
|
import { DhtCallContext } from '../rpc-protocol/DhtCallContext'
|
|
19
|
-
import { PeerIDKey } from '../helpers/PeerID'
|
|
20
18
|
import { getNodeIdOrUnknownFromPeerDescriptor } from './ConnectionManager'
|
|
21
19
|
import { LockID } from './ConnectionLockHandler'
|
|
20
|
+
import { NodeID } from '../helpers/nodeId'
|
|
22
21
|
|
|
23
22
|
interface ConnectionLockRpcLocalConfig {
|
|
24
|
-
addRemoteLocked: (id:
|
|
25
|
-
removeRemoteLocked: (id:
|
|
23
|
+
addRemoteLocked: (id: NodeID, lockId: LockID) => void
|
|
24
|
+
removeRemoteLocked: (id: NodeID, lockId: LockID) => void
|
|
26
25
|
closeConnection: (peerDescriptor: PeerDescriptor, gracefulLeave: boolean, reason?: string) => void
|
|
27
26
|
getLocalPeerDescriptor: () => PeerDescriptor
|
|
28
27
|
}
|
|
@@ -39,14 +38,14 @@ export class ConnectionLockRpcLocal implements IConnectionLockRpc {
|
|
|
39
38
|
|
|
40
39
|
async lockRequest(lockRequest: LockRequest, context: ServerCallContext): Promise<LockResponse> {
|
|
41
40
|
const senderPeerDescriptor = (context as DhtCallContext).incomingSourceDescriptor!
|
|
42
|
-
const remotePeerId = peerIdFromPeerDescriptor(senderPeerDescriptor)
|
|
43
41
|
if (areEqualPeerDescriptors(senderPeerDescriptor, this.config.getLocalPeerDescriptor())) {
|
|
44
42
|
const response: LockResponse = {
|
|
45
43
|
accepted: false
|
|
46
44
|
}
|
|
47
45
|
return response
|
|
48
46
|
}
|
|
49
|
-
|
|
47
|
+
const remoteNodeId = getNodeIdFromPeerDescriptor(senderPeerDescriptor)
|
|
48
|
+
this.config.addRemoteLocked(remoteNodeId, lockRequest.lockId)
|
|
50
49
|
const response: LockResponse = {
|
|
51
50
|
accepted: true
|
|
52
51
|
}
|
|
@@ -55,8 +54,8 @@ export class ConnectionLockRpcLocal implements IConnectionLockRpc {
|
|
|
55
54
|
|
|
56
55
|
async unlockRequest(unlockRequest: UnlockRequest, context: ServerCallContext): Promise<Empty> {
|
|
57
56
|
const senderPeerDescriptor = (context as DhtCallContext).incomingSourceDescriptor!
|
|
58
|
-
const
|
|
59
|
-
this.config.removeRemoteLocked(
|
|
57
|
+
const nodeId = getNodeIdFromPeerDescriptor(senderPeerDescriptor)
|
|
58
|
+
this.config.removeRemoteLocked(nodeId, unlockRequest.lockId)
|
|
60
59
|
return {}
|
|
61
60
|
}
|
|
62
61
|
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import { Logger } from '@streamr/utils'
|
|
2
|
-
import { ProtoRpcClient } from '@streamr/proto-rpc'
|
|
3
|
-
import { IConnectionLockRpcClient } from '../proto/packages/dht/protos/DhtRpc.client'
|
|
4
|
-
import { LockRequest, UnlockRequest, PeerDescriptor, DisconnectNotice, DisconnectMode } from '../proto/packages/dht/protos/DhtRpc'
|
|
5
|
-
import { getNodeIdFromPeerDescriptor } from '../helpers/peerIdFromPeerDescriptor'
|
|
6
2
|
import { RpcRemote } from '../dht/contact/RpcRemote'
|
|
3
|
+
import { getNodeIdFromPeerDescriptor } from '../helpers/peerIdFromPeerDescriptor'
|
|
4
|
+
import { DisconnectMode, DisconnectNotice, LockRequest, UnlockRequest } from '../proto/packages/dht/protos/DhtRpc'
|
|
5
|
+
import { ConnectionLockRpcClient } from '../proto/packages/dht/protos/DhtRpc.client'
|
|
7
6
|
import { LockID } from './ConnectionLockHandler'
|
|
8
7
|
|
|
9
8
|
const logger = new Logger(module)
|
|
10
9
|
|
|
11
|
-
export class ConnectionLockRpcRemote extends RpcRemote<
|
|
12
|
-
|
|
13
|
-
constructor(
|
|
14
|
-
localPeerDescriptor: PeerDescriptor,
|
|
15
|
-
targetPeerDescriptor: PeerDescriptor,
|
|
16
|
-
client: ProtoRpcClient<IConnectionLockRpcClient>
|
|
17
|
-
) {
|
|
18
|
-
super(localPeerDescriptor, targetPeerDescriptor, 'DUMMY', client)
|
|
19
|
-
}
|
|
10
|
+
export class ConnectionLockRpcRemote extends RpcRemote<ConnectionLockRpcClient> {
|
|
20
11
|
|
|
21
12
|
public async lockRequest(lockId: LockID): Promise<boolean> {
|
|
22
13
|
logger.trace(`Requesting locked connection to ${getNodeIdFromPeerDescriptor(this.getPeerDescriptor())}`)
|
|
@@ -52,9 +43,9 @@ export class ConnectionLockRpcRemote extends RpcRemote<IConnectionLockRpcClient>
|
|
|
52
43
|
disconnectMode
|
|
53
44
|
}
|
|
54
45
|
const options = this.formDhtRpcOptions({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
timeout: 2000
|
|
46
|
+
connect: false,
|
|
47
|
+
sendIfStopped: true,
|
|
48
|
+
timeout: 2000 // TODO use config option or named constant?
|
|
58
49
|
})
|
|
59
50
|
await this.getClient().gracefulDisconnect(request, options)
|
|
60
51
|
}
|