@streamr/dht 100.0.0-pretestnet.4 → 100.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -8
- package/dist/package.json +70 -0
- package/dist/src/connection/Connection.d.ts +1 -0
- package/dist/src/connection/Connection.js +10 -3
- package/dist/src/connection/Connection.js.map +1 -1
- package/dist/src/connection/ConnectionLockHandler.d.ts +14 -14
- package/dist/src/connection/ConnectionLockHandler.js +22 -16
- package/dist/src/connection/ConnectionLockHandler.js.map +1 -1
- package/dist/src/connection/ConnectionLockRpcLocal.d.ts +3 -3
- package/dist/src/connection/ConnectionLockRpcLocal.js +7 -6
- package/dist/src/connection/ConnectionLockRpcLocal.js.map +1 -1
- package/dist/src/connection/ConnectionLockRpcRemote.d.ts +4 -6
- package/dist/src/connection/ConnectionLockRpcRemote.js +10 -37
- package/dist/src/connection/ConnectionLockRpcRemote.js.map +1 -1
- package/dist/src/connection/ConnectionManager.d.ts +19 -20
- package/dist/src/connection/ConnectionManager.js +132 -117
- package/dist/src/connection/ConnectionManager.js.map +1 -1
- package/dist/src/connection/ConnectorFacade.d.ts +3 -2
- package/dist/src/connection/ConnectorFacade.js +10 -3
- package/dist/src/connection/ConnectorFacade.js.map +1 -1
- package/dist/src/connection/Handshaker.d.ts +3 -1
- package/dist/src/connection/Handshaker.js +18 -9
- package/dist/src/connection/Handshaker.js.map +1 -1
- package/dist/src/connection/IConnection.d.ts +2 -7
- package/dist/src/connection/IConnection.js +1 -8
- package/dist/src/connection/IConnection.js.map +1 -1
- package/dist/src/connection/ManagedConnection.d.ts +5 -7
- package/dist/src/connection/ManagedConnection.js +42 -26
- package/dist/src/connection/ManagedConnection.js.map +1 -1
- package/dist/src/connection/ManagedWebrtcConnection.js.map +1 -1
- package/dist/src/connection/connectivityChecker.d.ts +9 -0
- package/dist/src/connection/connectivityChecker.js +130 -0
- package/dist/src/connection/connectivityChecker.js.map +1 -0
- package/dist/src/connection/connectivityRequestHandler.d.ts +3 -0
- package/dist/src/connection/connectivityRequestHandler.js +101 -0
- package/dist/src/connection/connectivityRequestHandler.js.map +1 -0
- package/dist/src/connection/simulator/Simulator.d.ts +0 -3
- package/dist/src/connection/simulator/Simulator.js +34 -69
- package/dist/src/connection/simulator/Simulator.js.map +1 -1
- package/dist/src/connection/simulator/SimulatorConnection.js +27 -25
- package/dist/src/connection/simulator/SimulatorConnection.js.map +1 -1
- package/dist/src/connection/simulator/SimulatorConnector.js +16 -12
- package/dist/src/connection/simulator/SimulatorConnector.js.map +1 -1
- package/dist/src/connection/simulator/pings.js.map +1 -1
- package/dist/src/connection/webrtc/NodeWebrtcConnection.d.ts +2 -3
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js +40 -27
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnector.d.ts +0 -2
- package/dist/src/connection/webrtc/WebrtcConnector.js +24 -25
- 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 +27 -20
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.d.ts +3 -6
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js +2 -5
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js.map +1 -1
- package/dist/src/connection/webrtc/iceServerAsString.js +1 -1
- package/dist/src/connection/webrtc/iceServerAsString.js.map +1 -1
- package/dist/src/connection/websocket/AutoCertifierClientFacade.d.ts +1 -2
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js +6 -4
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js.map +1 -1
- package/dist/src/connection/websocket/ClientWebsocket.d.ts +1 -0
- package/dist/src/connection/websocket/ClientWebsocket.js +14 -7
- package/dist/src/connection/websocket/ClientWebsocket.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketConnector.d.ts +3 -9
- package/dist/src/connection/websocket/WebsocketConnector.js +142 -74
- package/dist/src/connection/websocket/WebsocketConnector.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.d.ts +5 -3
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js +9 -12
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.d.ts +4 -7
- package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.js +7 -44
- 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 +49 -40
- package/dist/src/connection/websocket/WebsocketServer.js.map +1 -1
- package/dist/src/connection/websocket/{ServerWebsocket.d.ts → WebsocketServerConnection.d.ts} +8 -4
- package/dist/src/connection/websocket/WebsocketServerConnection.js +97 -0
- package/dist/src/connection/websocket/WebsocketServerConnection.js.map +1 -0
- package/dist/src/dht/DhtNode.d.ts +45 -49
- package/dist/src/dht/DhtNode.js +229 -317
- package/dist/src/dht/DhtNode.js.map +1 -1
- package/dist/src/dht/DhtNodeRpcLocal.d.ts +10 -9
- package/dist/src/dht/DhtNodeRpcLocal.js +19 -11
- package/dist/src/dht/DhtNodeRpcLocal.js.map +1 -1
- package/dist/src/dht/DhtNodeRpcRemote.d.ts +15 -10
- package/dist/src/dht/DhtNodeRpcRemote.js +38 -21
- package/dist/src/dht/DhtNodeRpcRemote.js.map +1 -1
- package/dist/src/dht/ExternalApiRpcLocal.d.ts +7 -6
- package/dist/src/dht/ExternalApiRpcLocal.js +9 -13
- package/dist/src/dht/ExternalApiRpcLocal.js.map +1 -1
- package/dist/src/dht/ExternalApiRpcRemote.d.ts +6 -5
- package/dist/src/dht/ExternalApiRpcRemote.js +10 -7
- package/dist/src/dht/ExternalApiRpcRemote.js.map +1 -1
- package/dist/src/dht/PeerManager.d.ts +61 -0
- package/dist/src/dht/PeerManager.js +288 -0
- package/dist/src/dht/PeerManager.js.map +1 -0
- package/dist/src/dht/contact/Contact.d.ts +2 -2
- package/dist/src/dht/contact/Contact.js +4 -3
- package/dist/src/dht/contact/Contact.js.map +1 -1
- package/dist/src/dht/contact/ContactList.d.ts +8 -8
- package/dist/src/dht/contact/ContactList.js +12 -7
- 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 +13 -12
- package/dist/src/dht/contact/RandomContactList.js.map +1 -1
- package/dist/src/dht/contact/RingContactList.d.ts +31 -0
- package/dist/src/dht/contact/RingContactList.js +133 -0
- package/dist/src/dht/contact/RingContactList.js.map +1 -0
- package/dist/src/dht/contact/{Remote.d.ts → RpcRemote.d.ts} +8 -7
- package/dist/src/dht/contact/{Remote.js → RpcRemote.js} +16 -13
- package/dist/src/dht/contact/RpcRemote.js.map +1 -0
- package/dist/src/dht/contact/SortedContactList.d.ts +29 -15
- package/dist/src/dht/contact/SortedContactList.js +79 -42
- package/dist/src/dht/contact/SortedContactList.js.map +1 -1
- package/dist/src/dht/contact/ringIdentifiers.d.ts +16 -0
- package/dist/src/dht/contact/ringIdentifiers.js +54 -0
- package/dist/src/dht/contact/ringIdentifiers.js.map +1 -0
- package/dist/src/dht/discovery/DiscoverySession.d.ts +8 -18
- package/dist/src/dht/discovery/DiscoverySession.js +32 -48
- package/dist/src/dht/discovery/DiscoverySession.js.map +1 -1
- package/dist/src/dht/discovery/PeerDiscovery.d.ts +16 -12
- package/dist/src/dht/discovery/PeerDiscovery.js +82 -39
- package/dist/src/dht/discovery/PeerDiscovery.js.map +1 -1
- package/dist/src/dht/discovery/RingDiscoverySession.d.ts +29 -0
- package/dist/src/dht/discovery/RingDiscoverySession.js +123 -0
- package/dist/src/dht/discovery/RingDiscoverySession.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.d.ts +36 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js +166 -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/recursive-operation/RecursiveOperationRpcLocal.js +26 -0
- 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/recursive-operation/RecursiveOperationRpcRemote.js +44 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.d.ts +44 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js +187 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.d.ts +14 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js +20 -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/DuplicateDetector.d.ts +2 -4
- package/dist/src/dht/routing/DuplicateDetector.js +10 -15
- package/dist/src/dht/routing/DuplicateDetector.js.map +1 -1
- package/dist/src/dht/routing/Router.d.ts +11 -27
- package/dist/src/dht/routing/Router.js +92 -58
- package/dist/src/dht/routing/Router.js.map +1 -1
- package/dist/src/dht/routing/RouterRpcLocal.d.ts +3 -4
- package/dist/src/dht/routing/RouterRpcLocal.js +17 -16
- package/dist/src/dht/routing/RouterRpcLocal.js.map +1 -1
- package/dist/src/dht/routing/RouterRpcRemote.d.ts +3 -3
- package/dist/src/dht/routing/RouterRpcRemote.js +29 -20
- package/dist/src/dht/routing/RouterRpcRemote.js.map +1 -1
- package/dist/src/dht/routing/RoutingSession.d.ts +29 -21
- package/dist/src/dht/routing/RoutingSession.js +93 -68
- package/dist/src/dht/routing/RoutingSession.js.map +1 -1
- package/dist/src/dht/routing/RoutingTablesCache.d.ts +24 -0
- package/dist/src/dht/routing/RoutingTablesCache.js +46 -0
- package/dist/src/dht/routing/RoutingTablesCache.js.map +1 -0
- package/dist/src/dht/routing/getPreviousPeer.js.map +1 -1
- package/dist/src/dht/store/LocalDataStore.d.ts +9 -14
- package/dist/src/dht/store/LocalDataStore.js +46 -72
- 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 +182 -0
- package/dist/src/dht/store/StoreManager.js.map +1 -0
- package/dist/src/dht/store/StoreRpcLocal.d.ts +11 -41
- package/dist/src/dht/store/StoreRpcLocal.js +27 -234
- package/dist/src/dht/store/StoreRpcLocal.js.map +1 -1
- package/dist/src/dht/store/StoreRpcRemote.d.ts +6 -7
- package/dist/src/dht/store/StoreRpcRemote.js +10 -20
- package/dist/src/dht/store/StoreRpcRemote.js.map +1 -1
- package/dist/src/exports.d.ts +5 -3
- package/dist/src/exports.js +10 -8
- package/dist/src/exports.js.map +1 -1
- package/dist/src/helpers/AddressTools.js +2 -0
- package/dist/src/helpers/AddressTools.js.map +1 -1
- package/dist/src/helpers/Connectivity.js.map +1 -1
- package/dist/src/helpers/MapWithTtl.d.ts +14 -0
- package/dist/src/helpers/MapWithTtl.js +60 -0
- package/dist/src/helpers/MapWithTtl.js.map +1 -0
- package/dist/src/helpers/createPeerDescriptor.d.ts +3 -0
- package/dist/src/helpers/createPeerDescriptor.js +57 -0
- package/dist/src/helpers/createPeerDescriptor.js.map +1 -0
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.d.ts +2 -0
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.js +30 -0
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.js.map +1 -0
- package/dist/src/helpers/debugHelpers.js.map +1 -1
- package/dist/src/helpers/errors.js +2 -0
- package/dist/src/helpers/errors.js.map +1 -1
- package/dist/src/helpers/offering.d.ts +4 -0
- package/dist/src/helpers/offering.js +18 -0
- package/dist/src/helpers/offering.js.map +1 -0
- package/dist/src/helpers/protoClasses.js +2 -3
- package/dist/src/helpers/protoClasses.js.map +1 -1
- package/dist/src/helpers/protoToString.js.map +1 -1
- package/dist/src/helpers/version.d.ts +6 -0
- package/dist/src/helpers/version.js +38 -0
- package/dist/src/helpers/version.js.map +1 -0
- package/dist/src/identifiers.d.ts +10 -0
- package/dist/src/identifiers.js +31 -0
- package/dist/src/identifiers.js.map +1 -0
- package/dist/src/proto/google/protobuf/any.js +8 -8
- package/dist/src/proto/google/protobuf/any.js.map +1 -1
- package/dist/src/proto/google/protobuf/empty.js +2 -4
- package/dist/src/proto/google/protobuf/empty.js.map +1 -1
- package/dist/src/proto/google/protobuf/timestamp.js +10 -10
- package/dist/src/proto/google/protobuf/timestamp.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +46 -49
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +63 -54
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +226 -232
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +146 -168
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +26 -29
- package/dist/src/proto/packages/proto-rpc/protos/ProtoRpc.js +1 -1
- package/dist/src/rpc-protocol/DhtCallContext.d.ts +2 -2
- package/dist/src/rpc-protocol/DhtCallContext.js +8 -0
- 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 +10 -2
- package/dist/src/transport/ITransport.js +5 -0
- package/dist/src/transport/ITransport.js.map +1 -1
- package/dist/src/transport/ListeningRpcCommunicator.js +3 -1
- package/dist/src/transport/ListeningRpcCommunicator.js.map +1 -1
- package/dist/src/transport/RoutingRpcCommunicator.d.ts +4 -2
- package/dist/src/transport/RoutingRpcCommunicator.js +19 -12
- 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 +13 -9
- package/package.json +16 -13
- package/protos/DhtRpc.proto +76 -76
- package/src/connection/Connection.ts +6 -1
- package/src/connection/ConnectionLockHandler.ts +30 -22
- package/src/connection/ConnectionLockRpcLocal.ts +7 -12
- package/src/connection/ConnectionLockRpcRemote.ts +9 -19
- package/src/connection/ConnectionManager.ts +132 -138
- package/src/connection/ConnectorFacade.ts +10 -9
- package/src/connection/Handshaker.ts +23 -11
- package/src/connection/IConnection.ts +2 -8
- package/src/connection/ManagedConnection.ts +34 -35
- package/src/connection/connectivityChecker.ts +109 -0
- package/src/connection/connectivityRequestHandler.ts +103 -0
- package/src/connection/simulator/Simulator.ts +6 -37
- package/src/connection/simulator/SimulatorConnection.ts +23 -25
- package/src/connection/simulator/SimulatorConnector.ts +11 -11
- package/src/connection/webrtc/BrowserWebrtcConnection.ts +17 -25
- package/src/connection/webrtc/NodeWebrtcConnection.ts +24 -26
- package/src/connection/webrtc/WebrtcConnector.ts +18 -29
- package/src/connection/webrtc/WebrtcConnectorRpcLocal.ts +29 -24
- package/src/connection/webrtc/WebrtcConnectorRpcRemote.ts +4 -14
- package/src/connection/webrtc/iceServerAsString.ts +1 -1
- package/src/connection/websocket/AutoCertifierClientFacade.ts +4 -6
- package/src/connection/websocket/ClientWebsocket.ts +10 -4
- package/src/connection/websocket/WebsocketConnector.ts +120 -97
- package/src/connection/websocket/WebsocketConnectorRpcLocal.ts +13 -15
- package/src/connection/websocket/WebsocketConnectorRpcRemote.ts +7 -27
- package/src/connection/websocket/WebsocketServer.ts +50 -53
- package/src/connection/websocket/WebsocketServerConnection.ts +104 -0
- package/src/dht/DhtNode.ts +289 -410
- package/src/dht/DhtNodeRpcLocal.ts +25 -17
- package/src/dht/DhtNodeRpcRemote.ts +43 -27
- package/src/dht/ExternalApiRpcLocal.ts +30 -17
- package/src/dht/ExternalApiRpcRemote.ts +14 -11
- package/src/dht/PeerManager.ts +339 -0
- package/src/dht/contact/Contact.ts +4 -4
- package/src/dht/contact/ContactList.ts +11 -10
- package/src/dht/contact/RandomContactList.ts +15 -15
- package/src/dht/contact/RingContactList.ts +151 -0
- package/src/dht/contact/{Remote.ts → RpcRemote.ts} +16 -19
- package/src/dht/contact/SortedContactList.ts +120 -72
- package/src/dht/contact/ringIdentifiers.ts +62 -0
- package/src/dht/discovery/DiscoverySession.ts +36 -61
- package/src/dht/discovery/PeerDiscovery.ts +98 -43
- package/src/dht/discovery/RingDiscoverySession.ts +160 -0
- package/src/dht/recursive-operation/RecursiveOperationManager.ts +246 -0
- package/src/dht/recursive-operation/RecursiveOperationRpcLocal.ts +34 -0
- package/src/dht/recursive-operation/RecursiveOperationRpcRemote.ts +43 -0
- package/src/dht/recursive-operation/RecursiveOperationSession.ts +232 -0
- package/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.ts +35 -0
- package/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.ts +30 -0
- package/src/dht/routing/DuplicateDetector.ts +9 -21
- package/src/dht/routing/Router.ts +95 -92
- package/src/dht/routing/RouterRpcLocal.ts +16 -18
- package/src/dht/routing/RouterRpcRemote.ts +26 -24
- package/src/dht/routing/RoutingSession.ts +119 -98
- package/src/dht/routing/RoutingTablesCache.ts +58 -0
- package/src/dht/routing/getPreviousPeer.ts +1 -1
- package/src/dht/store/LocalDataStore.ts +47 -77
- package/src/dht/store/StoreManager.ts +209 -0
- package/src/dht/store/StoreRpcLocal.ts +39 -308
- package/src/dht/store/StoreRpcRemote.ts +13 -31
- package/src/exports.ts +13 -3
- package/src/helpers/AddressTools.ts +2 -0
- package/src/helpers/MapWithTtl.ts +71 -0
- package/src/helpers/createPeerDescriptor.ts +57 -0
- package/src/helpers/createPeerDescriptorSignaturePayload.ts +28 -0
- package/src/helpers/offering.ts +15 -0
- package/src/helpers/protoClasses.ts +4 -6
- package/src/helpers/version.ts +32 -0
- package/src/identifiers.ts +29 -0
- package/src/proto/google/protobuf/any.ts +4 -4
- package/src/proto/google/protobuf/empty.ts +2 -4
- package/src/proto/google/protobuf/timestamp.ts +4 -4
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +65 -68
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +27 -30
- package/src/proto/packages/dht/protos/DhtRpc.ts +297 -313
- package/src/proto/packages/proto-rpc/protos/ProtoRpc.ts +1 -1
- package/src/rpc-protocol/DhtCallContext.ts +2 -2
- package/src/rpc-protocol/DhtRpcOptions.ts +2 -1
- package/src/transport/ITransport.ts +11 -2
- package/src/transport/ListeningRpcCommunicator.ts +1 -1
- package/src/transport/RoutingRpcCommunicator.ts +21 -14
- package/test/RandomGraphSimulation.ts +3 -2
- package/test/benchmark/Find.test.ts +13 -28
- package/test/benchmark/KademliaCorrectness.test.ts +24 -28
- package/test/benchmark/RingCorrectness.test.ts +157 -0
- package/test/benchmark/SortedContactListBenchmark.test.ts +151 -0
- package/test/benchmark/WebsocketServerMemoryLeak.test.ts +41 -0
- package/test/benchmark/hybrid-network-simulation/RingContactList.test.ts +72 -0
- package/test/benchmark/kademlia-simulation/Contact.ts +9 -9
- package/test/benchmark/kademlia-simulation/KademliaSimulation.ts +11 -11
- package/test/benchmark/kademlia-simulation/SimulationNode.ts +29 -25
- package/test/data/generateGroundTruthData.ts +7 -6
- package/test/end-to-end/Layer0-Layer1.test.ts +11 -15
- package/test/end-to-end/Layer0.test.ts +19 -22
- package/test/end-to-end/Layer0MixedConnectionTypes.test.ts +19 -21
- package/test/end-to-end/Layer0Webrtc-Layer1.test.ts +26 -28
- package/test/end-to-end/Layer0Webrtc.test.ts +19 -19
- package/test/end-to-end/Layer1-Scale-WebSocket.test.ts +10 -18
- package/test/end-to-end/Layer1-Scale-Webrtc.test.ts +8 -15
- package/test/end-to-end/RecoveryFromFailedAutoCertification.test.ts +2 -2
- package/test/end-to-end/WebsocketConnectionRequest.test.ts +8 -9
- package/test/end-to-end/memory-leak.test.ts +19 -24
- package/test/integration/ConnectionLocking.test.ts +66 -60
- package/test/integration/ConnectionManager.test.ts +43 -63
- package/test/integration/ConnectivityChecking.test.ts +52 -0
- package/test/integration/DhtJoinPeerDiscovery.test.ts +8 -12
- package/test/integration/DhtNodeExternalAPI.test.ts +17 -21
- package/test/integration/DhtNodeRpcRemote.test.ts +19 -26
- package/test/integration/DhtRpc.test.ts +20 -24
- package/test/integration/Find.test.ts +10 -12
- package/test/integration/Layer1-scale.test.ts +25 -37
- package/test/integration/Mock-Layer1-Layer0.test.ts +39 -59
- package/test/integration/MultipleEntryPointJoining.test.ts +14 -14
- package/test/integration/ReplicateData.test.ts +106 -0
- package/test/integration/RouteMessage.test.ts +42 -68
- package/test/integration/RouterRpcRemote.test.ts +19 -24
- package/test/integration/ScaleDownDht.test.ts +14 -12
- package/test/integration/SimultaneousConnections.test.ts +112 -111
- package/test/integration/Store.test.ts +43 -27
- package/test/integration/StoreAndDelete.test.ts +36 -48
- package/test/integration/StoreOnDhtWithThreeNodes.test.ts +59 -0
- package/test/integration/StoreOnDhtWithTwoNodes.test.ts +17 -37
- package/test/integration/StoreRpcRemote.test.ts +20 -32
- package/test/integration/WebrtcConnectionManagement.test.ts +39 -25
- package/test/integration/WebrtcConnectorRpc.test.ts +6 -11
- package/test/integration/WebsocketConnectionManagement.test.ts +87 -22
- package/test/integration/WebsocketConnectorRpc.test.ts +14 -24
- package/test/integration/{RpcErrors.test.ts → rpc-connections-over-webrpc.test.ts} +15 -26
- package/test/unit/AddressTools.test.ts +4 -0
- package/test/unit/ConnectivityHelpers.test.ts +9 -17
- package/test/unit/DuplicateDetector.test.ts +8 -5
- package/test/unit/LocalDataStore.test.ts +78 -75
- package/test/unit/PeerManager.test.ts +33 -0
- package/test/unit/RandomContactList.test.ts +12 -9
- package/test/unit/RecursiveOperationManager.test.ts +157 -0
- package/test/unit/RecursiveOperationSession.test.ts +68 -0
- package/test/unit/Router.test.ts +52 -35
- package/test/unit/RoutingSession.test.ts +79 -0
- package/test/unit/SortedContactList.test.ts +61 -30
- package/test/unit/StoreManager.test.ts +138 -0
- package/test/unit/WebsocketConnector.test.ts +27 -35
- package/test/unit/connectivityRequestHandler.test.ts +104 -0
- package/test/unit/createPeerDescriptor.test.ts +69 -0
- package/test/unit/customMatchers.test.ts +16 -0
- package/test/unit/version.test.ts +18 -0
- package/test/utils/FakeTransport.ts +47 -0
- package/test/utils/customMatchers.ts +71 -0
- package/test/utils/mock/MockRpcCommunicator.ts +7 -0
- package/test/utils/mock/Router.ts +13 -3
- package/test/utils/mock/Transport.ts +1 -1
- package/test/utils/mock/mockDataEntry.ts +38 -0
- package/test/utils/utils.ts +104 -107
- package/tsconfig.browser.json +2 -1
- package/tsconfig.jest.json +4 -2
- package/tsconfig.node.json +4 -2
- package/dist/src/connection/ConnectivityChecker.d.ts +0 -17
- package/dist/src/connection/ConnectivityChecker.js +0 -208
- package/dist/src/connection/ConnectivityChecker.js.map +0 -1
- package/dist/src/connection/websocket/ServerWebsocket.js +0 -100
- package/dist/src/connection/websocket/ServerWebsocket.js.map +0 -1
- package/dist/src/dht/contact/Remote.js.map +0 -1
- package/dist/src/dht/find/FindRpcLocal.d.ts +0 -14
- package/dist/src/dht/find/FindRpcLocal.js +0 -25
- 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 -145
- 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 -184
- 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 +0 -41
- package/dist/src/dht/routing/FindRpcRemote.js.map +0 -1
- package/dist/src/helpers/PeerID.d.ts +0 -24
- package/dist/src/helpers/PeerID.js +0 -78
- package/dist/src/helpers/PeerID.js.map +0 -1
- package/dist/src/helpers/UUID.d.ts +0 -8
- package/dist/src/helpers/UUID.js +0 -36
- package/dist/src/helpers/UUID.js.map +0 -1
- package/dist/src/helpers/kademliaId.d.ts +0 -1
- package/dist/src/helpers/kademliaId.js +0 -14
- package/dist/src/helpers/kademliaId.js.map +0 -1
- package/dist/src/helpers/peerIdFromPeerDescriptor.d.ts +0 -6
- package/dist/src/helpers/peerIdFromPeerDescriptor.js +0 -23
- package/dist/src/helpers/peerIdFromPeerDescriptor.js.map +0 -1
- package/src/connection/ConnectivityChecker.ts +0 -199
- package/src/connection/websocket/ServerWebsocket.ts +0 -114
- package/src/dht/find/FindRpcLocal.ts +0 -35
- package/src/dht/find/FindSession.ts +0 -178
- package/src/dht/find/FindSessionRpcLocal.ts +0 -25
- package/src/dht/find/FindSessionRpcRemote.ts +0 -30
- package/src/dht/find/Finder.ts +0 -275
- package/src/dht/routing/FindRpcRemote.ts +0 -40
- package/src/helpers/PeerID.ts +0 -88
- package/src/helpers/UUID.ts +0 -35
- package/src/helpers/kademliaId.ts +0 -8
- package/src/helpers/peerIdFromPeerDescriptor.ts +0 -20
- package/test/integration/MigrateData.test.ts +0 -204
- package/test/unit/Finder.test.ts +0 -110
- package/test/unit/PeerID.test.ts +0 -22
- package/test/unit/UUID.test.ts +0 -55
package/test/utils/utils.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { DhtNode } from '../../src/dht/DhtNode'
|
|
|
2
2
|
import {
|
|
3
3
|
ClosestPeersRequest,
|
|
4
4
|
ClosestPeersResponse,
|
|
5
|
-
MigrateDataResponse,
|
|
6
5
|
NodeType,
|
|
7
6
|
PeerDescriptor,
|
|
8
7
|
PingRequest,
|
|
@@ -11,12 +10,9 @@ import {
|
|
|
11
10
|
RouteMessageWrapper,
|
|
12
11
|
StoreDataRequest,
|
|
13
12
|
StoreDataResponse,
|
|
14
|
-
|
|
15
|
-
FindRequest,
|
|
16
|
-
DeleteDataResponse
|
|
13
|
+
ClosestRingPeersResponse
|
|
17
14
|
} from '../../src/proto/packages/dht/protos/DhtRpc'
|
|
18
15
|
import { RpcMessage } from '../../src/proto/packages/proto-rpc/protos/ProtoRpc'
|
|
19
|
-
import { PeerID } from '../../src/helpers/PeerID'
|
|
20
16
|
import {
|
|
21
17
|
IDhtNodeRpc,
|
|
22
18
|
IRouterRpc,
|
|
@@ -31,27 +27,59 @@ import { Empty } from '../../src/proto/google/protobuf/empty'
|
|
|
31
27
|
import { Any } from '../../src/proto/google/protobuf/any'
|
|
32
28
|
import { wait, waitForCondition } from '@streamr/utils'
|
|
33
29
|
import { SimulatorTransport } from '../../src/connection/simulator/SimulatorTransport'
|
|
30
|
+
import { DhtAddress, createRandomDhtAddress, getRawFromDhtAddress } from '../../src/identifiers'
|
|
34
31
|
|
|
35
|
-
export const
|
|
36
|
-
return
|
|
32
|
+
export const createMockPeerDescriptor = (opts?: Partial<Omit<PeerDescriptor, 'nodeId'>>): PeerDescriptor => {
|
|
33
|
+
return {
|
|
34
|
+
nodeId: getRawFromDhtAddress(createRandomDhtAddress()),
|
|
35
|
+
type: NodeType.NODEJS,
|
|
36
|
+
...opts
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const createMockRingNode = async (
|
|
41
|
+
simulator: Simulator,
|
|
42
|
+
nodeId: DhtAddress,
|
|
43
|
+
region: number
|
|
44
|
+
): Promise<DhtNode> => {
|
|
45
|
+
const maxConnections = 80
|
|
46
|
+
const dhtJoinTimeout = 45000
|
|
47
|
+
|
|
48
|
+
const peerDescriptor: PeerDescriptor = {
|
|
49
|
+
nodeId: getRawFromDhtAddress(nodeId ?? createRandomDhtAddress()),
|
|
50
|
+
type: NodeType.NODEJS,
|
|
51
|
+
region
|
|
52
|
+
//ipAddress: ipv4ToNumber(ipAddress)
|
|
53
|
+
}
|
|
54
|
+
const mockConnectionManager = new SimulatorTransport(peerDescriptor, simulator)
|
|
55
|
+
await mockConnectionManager.start()
|
|
56
|
+
const opts = {
|
|
57
|
+
peerDescriptor: peerDescriptor,
|
|
58
|
+
transport: mockConnectionManager,
|
|
59
|
+
numberOfNodesPerKBucket: 8,
|
|
60
|
+
maxConnections: maxConnections,
|
|
61
|
+
dhtJoinTimeout,
|
|
62
|
+
rpcRequestTimeout: 5000
|
|
63
|
+
}
|
|
64
|
+
const node = new class extends DhtNode {
|
|
65
|
+
async stop(): Promise<void> {
|
|
66
|
+
await super.stop()
|
|
67
|
+
await mockConnectionManager.stop()
|
|
68
|
+
}
|
|
69
|
+
}(opts)
|
|
70
|
+
await node.start()
|
|
71
|
+
return node
|
|
37
72
|
}
|
|
38
73
|
|
|
39
74
|
export const createMockConnectionDhtNode = async (
|
|
40
|
-
stringId: string,
|
|
41
75
|
simulator: Simulator,
|
|
42
|
-
|
|
76
|
+
nodeId?: DhtAddress,
|
|
43
77
|
numberOfNodesPerKBucket?: number,
|
|
44
78
|
maxConnections = 80,
|
|
45
79
|
dhtJoinTimeout = 45000
|
|
46
80
|
): Promise<DhtNode> => {
|
|
47
|
-
let id: PeerID
|
|
48
|
-
if (binaryId) {
|
|
49
|
-
id = PeerID.fromValue(binaryId)
|
|
50
|
-
} else {
|
|
51
|
-
id = PeerID.fromString(stringId)
|
|
52
|
-
}
|
|
53
81
|
const peerDescriptor: PeerDescriptor = {
|
|
54
|
-
|
|
82
|
+
nodeId: getRawFromDhtAddress(nodeId ?? createRandomDhtAddress()),
|
|
55
83
|
type: NodeType.NODEJS,
|
|
56
84
|
region: getRandomRegion()
|
|
57
85
|
}
|
|
@@ -76,14 +104,12 @@ export const createMockConnectionDhtNode = async (
|
|
|
76
104
|
}
|
|
77
105
|
|
|
78
106
|
export const createMockConnectionLayer1Node = async (
|
|
79
|
-
stringId: string,
|
|
80
107
|
layer0Node: DhtNode,
|
|
81
108
|
serviceId?: string,
|
|
82
109
|
numberOfNodesPerKBucket = 8
|
|
83
110
|
): Promise<DhtNode> => {
|
|
84
|
-
const id = PeerID.fromString(stringId)
|
|
85
111
|
const descriptor: PeerDescriptor = {
|
|
86
|
-
|
|
112
|
+
nodeId: layer0Node.getLocalPeerDescriptor().nodeId,
|
|
87
113
|
type: NodeType.NODEJS,
|
|
88
114
|
}
|
|
89
115
|
const node = new DhtNode({
|
|
@@ -100,7 +126,7 @@ export const createWrappedClosestPeersRequest = (
|
|
|
100
126
|
): RpcMessage => {
|
|
101
127
|
|
|
102
128
|
const routedMessage: ClosestPeersRequest = {
|
|
103
|
-
|
|
129
|
+
nodeId: sourceDescriptor.nodeId,
|
|
104
130
|
requestId: v4()
|
|
105
131
|
}
|
|
106
132
|
const rpcWrapper: RpcMessage = {
|
|
@@ -114,52 +140,51 @@ export const createWrappedClosestPeersRequest = (
|
|
|
114
140
|
return rpcWrapper
|
|
115
141
|
}
|
|
116
142
|
|
|
117
|
-
export const createFindRequest = (
|
|
118
|
-
fetchData: boolean
|
|
119
|
-
): FindRequest => {
|
|
120
|
-
const request: FindRequest = {
|
|
121
|
-
fetchData,
|
|
122
|
-
sessionId: v4()
|
|
123
|
-
}
|
|
124
|
-
return request
|
|
125
|
-
}
|
|
126
|
-
|
|
127
143
|
interface IDhtRpcWithError extends IDhtNodeRpc {
|
|
128
144
|
throwPingError: (request: PingRequest) => Promise<PingResponse>
|
|
129
145
|
respondPingWithTimeout: (request: PingRequest) => Promise<PingResponse>
|
|
130
146
|
throwGetClosestPeersError: (request: ClosestPeersRequest) => Promise<ClosestPeersResponse>
|
|
131
147
|
}
|
|
132
148
|
|
|
133
|
-
export const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
149
|
+
export const createMockDhtRpc = (neighbors: PeerDescriptor[]): IDhtRpcWithError => {
|
|
150
|
+
return {
|
|
151
|
+
async getClosestPeers(): Promise<ClosestPeersResponse> {
|
|
152
|
+
const response: ClosestPeersResponse = {
|
|
153
|
+
peers: neighbors,
|
|
154
|
+
requestId: 'why am i still here'
|
|
155
|
+
}
|
|
156
|
+
return response
|
|
157
|
+
},
|
|
158
|
+
async getClosestRingPeers(): Promise<ClosestRingPeersResponse> {
|
|
159
|
+
const response: ClosestRingPeersResponse = {
|
|
160
|
+
leftPeers: neighbors,
|
|
161
|
+
rightPeers: neighbors,
|
|
162
|
+
requestId: 'why am i still here'
|
|
163
|
+
}
|
|
164
|
+
return response
|
|
165
|
+
},
|
|
166
|
+
async ping(request: PingRequest): Promise<PingResponse> {
|
|
167
|
+
const response: PingResponse = {
|
|
168
|
+
requestId: request.requestId
|
|
169
|
+
}
|
|
170
|
+
return response
|
|
171
|
+
},
|
|
172
|
+
async leaveNotice(): Promise<Empty> {
|
|
173
|
+
return {}
|
|
174
|
+
},
|
|
175
|
+
async throwPingError(): Promise<PingResponse> {
|
|
176
|
+
throw new Error()
|
|
177
|
+
},
|
|
178
|
+
async respondPingWithTimeout(request: PingRequest): Promise<PingResponse> {
|
|
179
|
+
const response: PingResponse = {
|
|
180
|
+
requestId: request.requestId
|
|
181
|
+
}
|
|
182
|
+
await wait(2000)
|
|
183
|
+
return response
|
|
184
|
+
},
|
|
185
|
+
async throwGetClosestPeersError(): Promise<ClosestPeersResponse> {
|
|
186
|
+
throw new Error('Closest peers error')
|
|
157
187
|
}
|
|
158
|
-
await wait(2000)
|
|
159
|
-
return response
|
|
160
|
-
},
|
|
161
|
-
async throwGetClosestPeersError(): Promise<ClosestPeersResponse> {
|
|
162
|
-
throw new Error('Closest peers error')
|
|
163
188
|
}
|
|
164
189
|
}
|
|
165
190
|
|
|
@@ -170,15 +195,13 @@ interface IRouterRpcWithError extends IRouterRpc {
|
|
|
170
195
|
export const mockRouterRpc: IRouterRpcWithError = {
|
|
171
196
|
async routeMessage(routed: RouteMessageWrapper): Promise<RouteMessageAck> {
|
|
172
197
|
const response: RouteMessageAck = {
|
|
173
|
-
requestId: routed.requestId
|
|
174
|
-
error: ''
|
|
198
|
+
requestId: routed.requestId
|
|
175
199
|
}
|
|
176
200
|
return response
|
|
177
201
|
},
|
|
178
202
|
async forwardMessage(routed: RouteMessageWrapper): Promise<RouteMessageAck> {
|
|
179
203
|
const response: RouteMessageAck = {
|
|
180
|
-
requestId: routed.requestId
|
|
181
|
-
error: ''
|
|
204
|
+
requestId: routed.requestId
|
|
182
205
|
}
|
|
183
206
|
return response
|
|
184
207
|
},
|
|
@@ -189,57 +212,31 @@ export const mockRouterRpc: IRouterRpcWithError = {
|
|
|
189
212
|
|
|
190
213
|
interface IStoreRpcWithError extends IStoreRpc {
|
|
191
214
|
throwStoreDataError: (request: StoreDataRequest) => Promise<StoreDataResponse>
|
|
192
|
-
storeDataErrorString: (request: StoreDataRequest) => Promise<StoreDataResponse>
|
|
193
215
|
}
|
|
194
216
|
|
|
195
217
|
export const mockStoreRpc: IStoreRpcWithError = {
|
|
196
218
|
async storeData(): Promise<StoreDataResponse> {
|
|
197
|
-
return {
|
|
198
|
-
error: ''
|
|
199
|
-
}
|
|
219
|
+
return {}
|
|
200
220
|
},
|
|
201
221
|
async throwStoreDataError(): Promise<StoreDataResponse> {
|
|
202
222
|
throw new Error('Mock')
|
|
203
223
|
},
|
|
204
|
-
async
|
|
205
|
-
return {
|
|
206
|
-
error: 'Mock'
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
async migrateData(): Promise<MigrateDataResponse> {
|
|
210
|
-
return MigrateDataResponse.create()
|
|
211
|
-
},
|
|
212
|
-
async deleteData(): Promise<DeleteDataResponse> {
|
|
213
|
-
return DeleteDataResponse.create()
|
|
224
|
+
async replicateData(): Promise<Empty> {
|
|
225
|
+
return {}
|
|
214
226
|
}
|
|
215
227
|
}
|
|
216
228
|
|
|
217
229
|
export const mockWebsocketConnectorRpc: IWebsocketConnectorRpc = {
|
|
218
|
-
async requestConnection(): Promise<
|
|
219
|
-
|
|
220
|
-
accepted: true
|
|
221
|
-
}
|
|
222
|
-
return responseConnection
|
|
230
|
+
async requestConnection(): Promise<Empty> {
|
|
231
|
+
return {}
|
|
223
232
|
}
|
|
224
233
|
}
|
|
225
234
|
|
|
226
|
-
export const
|
|
227
|
-
const n1
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
const n2: PeerDescriptor = {
|
|
232
|
-
kademliaId: generateId('Neighbor2'),
|
|
233
|
-
type: NodeType.NODEJS,
|
|
234
|
-
}
|
|
235
|
-
const n3: PeerDescriptor = {
|
|
236
|
-
kademliaId: generateId('Neighbor3'),
|
|
237
|
-
type: NodeType.NODEJS,
|
|
238
|
-
}
|
|
239
|
-
const n4: PeerDescriptor = {
|
|
240
|
-
kademliaId: generateId('Neighbor4'),
|
|
241
|
-
type: NodeType.NODEJS,
|
|
242
|
-
}
|
|
235
|
+
export const createMockPeers = (): PeerDescriptor[] => {
|
|
236
|
+
const n1 = createMockPeerDescriptor()
|
|
237
|
+
const n2 = createMockPeerDescriptor()
|
|
238
|
+
const n3 = createMockPeerDescriptor()
|
|
239
|
+
const n4 = createMockPeerDescriptor()
|
|
243
240
|
return [
|
|
244
241
|
n1, n2, n3, n4
|
|
245
242
|
]
|
|
@@ -271,16 +268,16 @@ async function waitReadyForTesting(connectionManager: ConnectionManager, limit:
|
|
|
271
268
|
connectionManager.garbageCollectConnections(limit, LAST_USED_LIMIT)
|
|
272
269
|
try {
|
|
273
270
|
await waitForCondition(() => {
|
|
274
|
-
return (connectionManager.
|
|
275
|
-
connectionManager.
|
|
276
|
-
connectionManager.
|
|
271
|
+
return (connectionManager.getLocalLockedConnectionCount() === 0 &&
|
|
272
|
+
connectionManager.getRemoteLockedConnectionCount() === 0 &&
|
|
273
|
+
connectionManager.getConnections().length <= limit)
|
|
277
274
|
}, 20000)
|
|
278
275
|
} catch (err) {
|
|
279
|
-
if (connectionManager.
|
|
280
|
-
&& connectionManager.
|
|
281
|
-
throw Error('Connections are still locked')
|
|
282
|
-
} else if (connectionManager.
|
|
283
|
-
throw Error(`ConnectionManager has more than ${limit}`)
|
|
276
|
+
if (connectionManager.getLocalLockedConnectionCount() > 0
|
|
277
|
+
&& connectionManager.getRemoteLockedConnectionCount() > 0) {
|
|
278
|
+
throw new Error('Connections are still locked')
|
|
279
|
+
} else if (connectionManager.getConnections().length > limit) {
|
|
280
|
+
throw new Error(`ConnectionManager has more than ${limit}`)
|
|
284
281
|
}
|
|
285
282
|
}
|
|
286
283
|
}
|
package/tsconfig.browser.json
CHANGED
package/tsconfig.jest.json
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
},
|
|
7
7
|
"include": [
|
|
8
8
|
"src/**/*",
|
|
9
|
-
"test/**/*"
|
|
9
|
+
"test/**/*",
|
|
10
|
+
"package.json"
|
|
10
11
|
],
|
|
11
12
|
"exclude": [
|
|
12
13
|
"src/connection/webrtc/BrowserWebrtcConnection.ts"
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
{ "path": "../utils/tsconfig.node.json" },
|
|
16
17
|
{ "path": "../test-utils/tsconfig.node.json" },
|
|
17
18
|
{ "path": "../proto-rpc/tsconfig.node.json" },
|
|
18
|
-
{ "path": "../autocertifier-client/tsconfig.node.json" }
|
|
19
|
+
{ "path": "../autocertifier-client/tsconfig.node.json" },
|
|
20
|
+
{ "path": "../cdn-location/tsconfig.node.json" }
|
|
19
21
|
]
|
|
20
22
|
}
|
package/tsconfig.node.json
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
"noImplicitOverride": false
|
|
6
6
|
},
|
|
7
7
|
"include": [
|
|
8
|
-
"src/**/*"
|
|
8
|
+
"src/**/*",
|
|
9
|
+
"package.json"
|
|
9
10
|
],
|
|
10
11
|
"exclude": [
|
|
11
12
|
"src/connection/webrtc/BrowserWebrtcConnection.ts"
|
|
@@ -14,6 +15,7 @@
|
|
|
14
15
|
{ "path": "../utils/tsconfig.node.json" },
|
|
15
16
|
{ "path": "../test-utils/tsconfig.node.json" },
|
|
16
17
|
{ "path": "../proto-rpc/tsconfig.node.json" },
|
|
17
|
-
{ "path": "../autocertifier-client/tsconfig.node.json" }
|
|
18
|
+
{ "path": "../autocertifier-client/tsconfig.node.json" },
|
|
19
|
+
{ "path": "../cdn-location/tsconfig.node.json" }
|
|
18
20
|
]
|
|
19
21
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ConnectivityResponse, PeerDescriptor } from '../proto/packages/dht/protos/DhtRpc';
|
|
2
|
-
import { ServerWebsocket } from './websocket/ServerWebsocket';
|
|
3
|
-
export declare class ConnectivityChecker {
|
|
4
|
-
private static readonly CONNECTIVITY_CHECKER_SERVICE_ID;
|
|
5
|
-
private static readonly CONNECTIVITY_CHECKER_TIMEOUT;
|
|
6
|
-
private destroyed;
|
|
7
|
-
private readonly websocketPort;
|
|
8
|
-
private readonly tls;
|
|
9
|
-
private host?;
|
|
10
|
-
constructor(websocketPort: number, tls: boolean, host?: string);
|
|
11
|
-
sendConnectivityRequest(entryPoint: PeerDescriptor, selfSigned: boolean): Promise<ConnectivityResponse>;
|
|
12
|
-
setHost(hostName: string): void;
|
|
13
|
-
listenToIncomingConnectivityRequests(connectionToListenTo: ServerWebsocket): void;
|
|
14
|
-
private handleIncomingConnectivityRequest;
|
|
15
|
-
private connectAsync;
|
|
16
|
-
destroy(): void;
|
|
17
|
-
}
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ConnectivityChecker = void 0;
|
|
27
|
-
const DhtRpc_1 = require("../proto/packages/dht/protos/DhtRpc");
|
|
28
|
-
const utils_1 = require("@streamr/utils");
|
|
29
|
-
const Err = __importStar(require("../helpers/errors"));
|
|
30
|
-
const ClientWebsocket_1 = require("./websocket/ClientWebsocket");
|
|
31
|
-
const uuid_1 = require("uuid");
|
|
32
|
-
const ConnectionManager_1 = require("./ConnectionManager");
|
|
33
|
-
const WebsocketConnector_1 = require("./websocket/WebsocketConnector");
|
|
34
|
-
const logger = new utils_1.Logger(module);
|
|
35
|
-
// Class for handling both client and server side of the connectivity
|
|
36
|
-
// checks. This is attached to all ServerWebsockets to listen to
|
|
37
|
-
// ConnectivityRequest messages.
|
|
38
|
-
class ConnectivityChecker {
|
|
39
|
-
constructor(websocketPort, tls, host) {
|
|
40
|
-
this.destroyed = false;
|
|
41
|
-
this.websocketPort = websocketPort;
|
|
42
|
-
this.tls = tls;
|
|
43
|
-
this.host = host;
|
|
44
|
-
}
|
|
45
|
-
async sendConnectivityRequest(entryPoint, selfSigned) {
|
|
46
|
-
if (this.destroyed) {
|
|
47
|
-
throw new Err.ConnectionFailed('ConnectivityChecker is destroyed');
|
|
48
|
-
}
|
|
49
|
-
let outgoingConnection;
|
|
50
|
-
const wsServerInfo = {
|
|
51
|
-
host: entryPoint.websocket.host,
|
|
52
|
-
port: entryPoint.websocket.port,
|
|
53
|
-
tls: entryPoint.websocket.tls,
|
|
54
|
-
};
|
|
55
|
-
const url = (0, WebsocketConnector_1.connectivityMethodToWebsocketUrl)(wsServerInfo, 'connectivityRequest');
|
|
56
|
-
try {
|
|
57
|
-
outgoingConnection = await this.connectAsync({
|
|
58
|
-
url,
|
|
59
|
-
selfSigned
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
catch (e) {
|
|
63
|
-
throw new Err.ConnectionFailed(`Failed to connect to the entrypoint ${url}`, e);
|
|
64
|
-
}
|
|
65
|
-
// send connectivity request
|
|
66
|
-
const connectivityRequestMessage = { port: this.websocketPort, host: this.host, tls: this.tls, selfSigned };
|
|
67
|
-
const msg = {
|
|
68
|
-
serviceId: ConnectivityChecker.CONNECTIVITY_CHECKER_SERVICE_ID,
|
|
69
|
-
messageType: DhtRpc_1.MessageType.CONNECTIVITY_REQUEST, messageId: (0, uuid_1.v4)(),
|
|
70
|
-
body: {
|
|
71
|
-
oneofKind: 'connectivityRequest',
|
|
72
|
-
connectivityRequest: connectivityRequestMessage
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
const responseAwaiter = () => {
|
|
76
|
-
return new Promise((resolve, reject) => {
|
|
77
|
-
const timeoutId = setTimeout(() => {
|
|
78
|
-
outgoingConnection.close(false);
|
|
79
|
-
reject(new Err.ConnectivityResponseTimeout('timeout'));
|
|
80
|
-
}, ConnectivityChecker.CONNECTIVITY_CHECKER_TIMEOUT);
|
|
81
|
-
const listener = (bytes) => {
|
|
82
|
-
outgoingConnection.close(false);
|
|
83
|
-
try {
|
|
84
|
-
const message = DhtRpc_1.Message.fromBinary(bytes);
|
|
85
|
-
if (message.body.oneofKind === 'connectivityResponse') {
|
|
86
|
-
logger.trace('ConnectivityResponse received: ' + JSON.stringify(DhtRpc_1.Message.toJson(message)));
|
|
87
|
-
const connectivityResponseMessage = message.body.connectivityResponse;
|
|
88
|
-
outgoingConnection.off('data', listener);
|
|
89
|
-
clearTimeout(timeoutId);
|
|
90
|
-
resolve(connectivityResponseMessage);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
catch (err) {
|
|
97
|
-
logger.trace(`Could not parse message: ${err}`);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
outgoingConnection.on('data', listener);
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
try {
|
|
104
|
-
const retPromise = responseAwaiter();
|
|
105
|
-
outgoingConnection.send(DhtRpc_1.Message.toBinary(msg));
|
|
106
|
-
logger.trace('ConnectivityRequest sent: ' + JSON.stringify(DhtRpc_1.Message.toJson(msg)));
|
|
107
|
-
return await retPromise;
|
|
108
|
-
}
|
|
109
|
-
catch (e) {
|
|
110
|
-
logger.error('error getting connectivityresponse');
|
|
111
|
-
throw e;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
setHost(hostName) {
|
|
115
|
-
this.host = hostName;
|
|
116
|
-
}
|
|
117
|
-
listenToIncomingConnectivityRequests(connectionToListenTo) {
|
|
118
|
-
connectionToListenTo.on('data', (data) => {
|
|
119
|
-
logger.trace('server received data');
|
|
120
|
-
try {
|
|
121
|
-
const message = DhtRpc_1.Message.fromBinary(data);
|
|
122
|
-
if (message.body.oneofKind === 'connectivityRequest') {
|
|
123
|
-
logger.trace('ConnectivityRequest received: ' + JSON.stringify(DhtRpc_1.Message.toJson(message)));
|
|
124
|
-
this.handleIncomingConnectivityRequest(connectionToListenTo, message.body.connectivityRequest).then(() => {
|
|
125
|
-
logger.trace('handleIncomingConnectivityRequest ok');
|
|
126
|
-
return;
|
|
127
|
-
}).catch((e) => {
|
|
128
|
-
logger.error('handleIncomingConnectivityRequest' + e);
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
catch (err) {
|
|
133
|
-
logger.trace(`Could not parse message: ${err}`);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
async handleIncomingConnectivityRequest(connection, connectivityRequest) {
|
|
138
|
-
if (this.destroyed) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
let outgoingConnection;
|
|
142
|
-
let connectivityResponseMessage;
|
|
143
|
-
const host = connectivityRequest.host ?? connection.getRemoteAddress();
|
|
144
|
-
try {
|
|
145
|
-
const wsServerInfo = {
|
|
146
|
-
host,
|
|
147
|
-
port: connectivityRequest.port,
|
|
148
|
-
tls: connectivityRequest.tls
|
|
149
|
-
};
|
|
150
|
-
const url = (0, WebsocketConnector_1.connectivityMethodToWebsocketUrl)(wsServerInfo, 'connectivityProbe');
|
|
151
|
-
logger.trace(`Attempting Connectivity Check to ${url}`);
|
|
152
|
-
outgoingConnection = await this.connectAsync({
|
|
153
|
-
url,
|
|
154
|
-
selfSigned: connectivityRequest.selfSigned
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
catch (err) {
|
|
158
|
-
logger.debug('error', { err });
|
|
159
|
-
connectivityResponseMessage = {
|
|
160
|
-
host,
|
|
161
|
-
natType: ConnectionManager_1.NatType.UNKNOWN
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
if (outgoingConnection) {
|
|
165
|
-
outgoingConnection.close(false);
|
|
166
|
-
logger.trace('Connectivity test produced positive result, communicating reply to the requester ' + host + ':' + connectivityRequest.port);
|
|
167
|
-
connectivityResponseMessage = {
|
|
168
|
-
host,
|
|
169
|
-
natType: ConnectionManager_1.NatType.OPEN_INTERNET,
|
|
170
|
-
websocket: { host, port: connectivityRequest.port, tls: connectivityRequest.tls }
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
const msg = {
|
|
174
|
-
serviceId: ConnectivityChecker.CONNECTIVITY_CHECKER_SERVICE_ID,
|
|
175
|
-
messageType: DhtRpc_1.MessageType.CONNECTIVITY_RESPONSE, messageId: (0, uuid_1.v4)(),
|
|
176
|
-
body: {
|
|
177
|
-
oneofKind: 'connectivityResponse',
|
|
178
|
-
connectivityResponse: connectivityResponseMessage
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
connection.send(DhtRpc_1.Message.toBinary(msg));
|
|
182
|
-
logger.trace('ConnectivityResponse sent: ' + JSON.stringify(DhtRpc_1.Message.toJson(msg)));
|
|
183
|
-
}
|
|
184
|
-
// eslint-disable-next-line class-methods-use-this
|
|
185
|
-
async connectAsync({ url, selfSigned, timeoutMs = 1000, }) {
|
|
186
|
-
const socket = new ClientWebsocket_1.ClientWebsocket();
|
|
187
|
-
let result;
|
|
188
|
-
try {
|
|
189
|
-
result = await (0, utils_1.runAndRaceEvents3)([
|
|
190
|
-
() => { socket.connect(url, selfSigned); }
|
|
191
|
-
], socket, ['connected', 'error'], timeoutMs);
|
|
192
|
-
}
|
|
193
|
-
catch (e) {
|
|
194
|
-
throw (new Err.ConnectionFailed('WebSocket connection timed out'));
|
|
195
|
-
}
|
|
196
|
-
if (result.winnerName === 'error') {
|
|
197
|
-
throw (new Err.ConnectionFailed('Could not open WebSocket connection'));
|
|
198
|
-
}
|
|
199
|
-
return socket;
|
|
200
|
-
}
|
|
201
|
-
destroy() {
|
|
202
|
-
this.destroyed = true;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
exports.ConnectivityChecker = ConnectivityChecker;
|
|
206
|
-
ConnectivityChecker.CONNECTIVITY_CHECKER_SERVICE_ID = 'system/connectivity-checker';
|
|
207
|
-
ConnectivityChecker.CONNECTIVITY_CHECKER_TIMEOUT = 5000;
|
|
208
|
-
//# sourceMappingURL=ConnectivityChecker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectivityChecker.js","sourceRoot":"","sources":["../../../src/connection/ConnectivityChecker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAG4C;AAE5C,0CAAsF;AACtF,uDAAwC;AACxC,iEAA6D;AAC7D,+BAAyB;AACzB,2DAA6C;AAE7C,uEAAiF;AAEjF,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAEjC,qEAAqE;AACrE,gEAAgE;AAChE,iCAAiC;AAEjC,MAAa,mBAAmB;IAS5B,YAAY,aAAqB,EAAE,GAAY,EAAE,IAAa;QALtD,cAAS,GAAG,KAAK,CAAA;QAMrB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IACpB,CAAC;IAEM,KAAK,CAAC,uBAAuB,CAAC,UAA0B,EAAE,UAAmB;QAChF,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,MAAM,IAAI,GAAG,CAAC,gBAAgB,CAAC,kCAAkC,CAAC,CAAA;SACrE;QACD,IAAI,kBAA+B,CAAA;QACnC,MAAM,YAAY,GAAG;YACjB,IAAI,EAAE,UAAU,CAAC,SAAU,CAAC,IAA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