@streamr/dht 100.0.0-pretestnet.0 → 100.0.0-pretestnet.3
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/src/connection/ConnectionLockHandler.d.ts +7 -8
- package/dist/src/connection/ConnectionLockHandler.js +16 -14
- package/dist/src/connection/ConnectionLockHandler.js.map +1 -1
- package/dist/src/connection/ConnectionLockRpcLocal.d.ts +20 -0
- package/dist/src/connection/ConnectionLockRpcLocal.js +47 -0
- package/dist/src/connection/ConnectionLockRpcLocal.js.map +1 -0
- package/dist/src/connection/ConnectionLockRpcRemote.d.ts +4 -3
- package/dist/src/connection/ConnectionLockRpcRemote.js +6 -6
- package/dist/src/connection/ConnectionLockRpcRemote.js.map +1 -1
- package/dist/src/connection/ConnectionManager.d.ts +5 -8
- package/dist/src/connection/ConnectionManager.js +77 -107
- package/dist/src/connection/ConnectionManager.js.map +1 -1
- package/dist/src/connection/ConnectivityChecker.d.ts +7 -6
- package/dist/src/connection/ConnectivityChecker.js +23 -20
- package/dist/src/connection/ConnectivityChecker.js.map +1 -1
- package/dist/src/connection/ConnectorFacade.d.ts +15 -12
- package/dist/src/connection/ConnectorFacade.js +61 -26
- package/dist/src/connection/ConnectorFacade.js.map +1 -1
- package/dist/src/connection/Handshaker.d.ts +2 -2
- package/dist/src/connection/Handshaker.js +28 -28
- package/dist/src/connection/Handshaker.js.map +1 -1
- package/dist/src/connection/IConnection.d.ts +5 -6
- package/dist/src/connection/IConnection.js.map +1 -1
- package/dist/src/connection/ManagedConnection.d.ts +3 -4
- package/dist/src/connection/ManagedConnection.js +30 -30
- package/dist/src/connection/ManagedConnection.js.map +1 -1
- package/dist/src/connection/ManagedWebrtcConnection.d.ts +7 -0
- package/dist/src/connection/ManagedWebrtcConnection.js +20 -0
- package/dist/src/connection/ManagedWebrtcConnection.js.map +1 -0
- package/dist/src/connection/{Simulator → simulator}/Simulator.js +3 -3
- package/dist/src/connection/{Simulator → simulator}/Simulator.js.map +1 -1
- package/dist/src/connection/{Simulator → simulator}/SimulatorConnection.d.ts +3 -4
- package/dist/src/connection/{Simulator → simulator}/SimulatorConnection.js +22 -22
- package/dist/src/connection/simulator/SimulatorConnection.js.map +1 -0
- package/dist/src/connection/{Simulator → simulator}/SimulatorConnector.d.ts +2 -2
- package/dist/src/connection/{Simulator → simulator}/SimulatorConnector.js +11 -11
- package/dist/src/connection/{Simulator → simulator}/SimulatorConnector.js.map +1 -1
- package/dist/src/connection/{Simulator → simulator}/SimulatorTransport.d.ts +1 -1
- package/dist/src/connection/{Simulator → simulator}/SimulatorTransport.js +2 -2
- package/dist/src/connection/simulator/SimulatorTransport.js.map +1 -0
- package/dist/src/connection/{Simulator → simulator}/pings.js.map +1 -1
- package/dist/src/connection/{WebRTC/IWebRtcConnection.d.ts → webrtc/IWebrtcConnection.d.ts} +2 -2
- package/dist/src/connection/{WebRTC/IWebRtcConnection.js → webrtc/IWebrtcConnection.js} +1 -1
- package/dist/src/connection/webrtc/IWebrtcConnection.js.map +1 -0
- package/dist/src/connection/{WebRTC/NodeWebRtcConnection.d.ts → webrtc/NodeWebrtcConnection.d.ts} +6 -7
- package/dist/src/connection/{WebRTC/NodeWebRtcConnection.js → webrtc/NodeWebrtcConnection.js} +36 -36
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js.map +1 -0
- package/dist/src/connection/webrtc/WebrtcConnector.d.ts +38 -0
- package/dist/src/connection/webrtc/WebrtcConnector.js +178 -0
- package/dist/src/connection/webrtc/WebrtcConnector.js.map +1 -0
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.d.ts +26 -0
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js +99 -0
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js.map +1 -0
- package/dist/src/connection/{WebRTC/WebRtcConnectorRpcRemote.d.ts → webrtc/WebrtcConnectorRpcRemote.d.ts} +4 -4
- package/dist/src/connection/{WebRTC/WebRtcConnectorRpcRemote.js → webrtc/WebrtcConnectorRpcRemote.js} +6 -8
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js.map +1 -0
- package/dist/src/connection/{WebRTC → webrtc}/iceServerAsString.d.ts +1 -1
- package/dist/src/connection/{WebRTC → webrtc}/iceServerAsString.js.map +1 -1
- package/dist/src/connection/websocket/AutoCertifierClientFacade.d.ts +26 -0
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js +37 -0
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js.map +1 -0
- package/dist/src/connection/{WebSocket/ClientWebSocket.d.ts → websocket/ClientWebsocket.d.ts} +5 -4
- package/dist/src/connection/{WebSocket/ClientWebSocket.js → websocket/ClientWebsocket.js} +20 -16
- package/dist/src/connection/websocket/ClientWebsocket.js.map +1 -0
- package/dist/src/connection/{WebSocket/ServerWebSocket.d.ts → websocket/ServerWebsocket.d.ts} +2 -2
- package/dist/src/connection/{WebSocket/ServerWebSocket.js → websocket/ServerWebsocket.js} +23 -27
- package/dist/src/connection/websocket/ServerWebsocket.js.map +1 -0
- package/dist/src/connection/{WebSocket/WebSocketConnectorRpcLocal.d.ts → websocket/WebsocketConnector.d.ts} +23 -15
- package/dist/src/connection/{WebSocket/WebSocketConnectorRpcLocal.js → websocket/WebsocketConnector.js} +108 -102
- package/dist/src/connection/websocket/WebsocketConnector.js.map +1 -0
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.d.ts +17 -0
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js +26 -0
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js.map +1 -0
- package/dist/src/connection/{WebSocket/WebSocketConnectorRpcRemote.d.ts → websocket/WebsocketConnectorRpcRemote.d.ts} +3 -3
- package/dist/src/connection/{WebSocket/WebSocketConnectorRpcRemote.js → websocket/WebsocketConnectorRpcRemote.js} +5 -10
- package/dist/src/connection/{WebSocket/WebSocketConnectorRpcRemote.js.map → websocket/WebsocketConnectorRpcRemote.js.map} +1 -1
- package/dist/src/connection/{WebSocket/WebSocketServer.d.ts → websocket/WebsocketServer.d.ts} +6 -3
- package/dist/src/connection/{WebSocket/WebSocketServer.js → websocket/WebsocketServer.js} +39 -19
- package/dist/src/connection/websocket/WebsocketServer.js.map +1 -0
- package/dist/src/dht/DhtNode.d.ts +11 -19
- package/dist/src/dht/DhtNode.js +119 -150
- package/dist/src/dht/DhtNode.js.map +1 -1
- package/dist/src/dht/DhtNodeRpcLocal.d.ts +22 -0
- package/dist/src/dht/DhtNodeRpcLocal.js +42 -0
- package/dist/src/dht/DhtNodeRpcLocal.js.map +1 -0
- package/dist/src/dht/{RemoteDhtNode.d.ts → DhtNodeRpcRemote.d.ts} +5 -3
- package/dist/src/dht/{RemoteDhtNode.js → DhtNodeRpcRemote.js} +17 -21
- package/dist/src/dht/DhtNodeRpcRemote.js.map +1 -0
- package/dist/src/dht/ExternalApiRpcLocal.d.ts +16 -0
- package/dist/src/dht/ExternalApiRpcLocal.js +30 -0
- package/dist/src/dht/ExternalApiRpcLocal.js.map +1 -0
- package/dist/src/dht/ExternalApiRpcRemote.d.ts +1 -1
- package/dist/src/dht/ExternalApiRpcRemote.js +2 -2
- package/dist/src/dht/ExternalApiRpcRemote.js.map +1 -1
- package/dist/src/dht/contact/Remote.d.ts +4 -1
- package/dist/src/dht/contact/Remote.js +28 -2
- package/dist/src/dht/contact/Remote.js.map +1 -1
- package/dist/src/dht/contact/SortedContactList.d.ts +2 -2
- package/dist/src/dht/contact/SortedContactList.js +3 -3
- package/dist/src/dht/contact/SortedContactList.js.map +1 -1
- package/dist/src/dht/discovery/DiscoverySession.d.ts +9 -7
- package/dist/src/dht/discovery/DiscoverySession.js +8 -8
- package/dist/src/dht/discovery/DiscoverySession.js.map +1 -1
- package/dist/src/dht/discovery/PeerDiscovery.d.ts +7 -10
- package/dist/src/dht/discovery/PeerDiscovery.js +5 -5
- package/dist/src/dht/discovery/PeerDiscovery.js.map +1 -1
- package/dist/src/dht/find/FindRpcLocal.d.ts +14 -0
- package/dist/src/dht/find/FindRpcLocal.js +25 -0
- package/dist/src/dht/find/FindRpcLocal.js.map +1 -0
- package/dist/src/dht/find/{RecursiveFindSession.d.ts → FindSession.d.ts} +12 -13
- package/dist/src/dht/find/{RecursiveFindSession.js → FindSession.js} +18 -15
- package/dist/src/dht/find/FindSession.js.map +1 -0
- package/dist/src/dht/find/FindSessionRpcLocal.d.ts +12 -0
- package/dist/src/dht/find/FindSessionRpcLocal.js +17 -0
- package/dist/src/dht/find/FindSessionRpcLocal.js.map +1 -0
- package/dist/src/dht/find/{RemoteRecursiveFindSession.d.ts → FindSessionRpcRemote.d.ts} +2 -2
- package/dist/src/dht/find/{RemoteRecursiveFindSession.js → FindSessionRpcRemote.js} +5 -5
- package/dist/src/dht/find/FindSessionRpcRemote.js.map +1 -0
- package/dist/src/dht/find/{RecursiveFinder.d.ts → Finder.d.ts} +16 -19
- package/dist/src/dht/find/{RecursiveFinder.js → Finder.js} +51 -46
- package/dist/src/dht/find/Finder.js.map +1 -0
- package/dist/src/dht/routing/FindRpcRemote.d.ts +6 -0
- package/dist/src/dht/routing/FindRpcRemote.js +41 -0
- package/dist/src/dht/routing/FindRpcRemote.js.map +1 -0
- package/dist/src/dht/routing/Router.d.ts +10 -17
- package/dist/src/dht/routing/Router.js +48 -90
- package/dist/src/dht/routing/Router.js.map +1 -1
- package/dist/src/dht/routing/RouterRpcLocal.d.ts +22 -0
- package/dist/src/dht/routing/RouterRpcLocal.js +66 -0
- package/dist/src/dht/routing/RouterRpcLocal.js.map +1 -0
- package/dist/src/dht/routing/RouterRpcRemote.d.ts +0 -1
- package/dist/src/dht/routing/RouterRpcRemote.js +15 -43
- package/dist/src/dht/routing/RouterRpcRemote.js.map +1 -1
- package/dist/src/dht/routing/RoutingSession.d.ts +17 -8
- package/dist/src/dht/routing/RoutingSession.js +124 -131
- package/dist/src/dht/routing/RoutingSession.js.map +1 -1
- package/dist/src/dht/routing/getPreviousPeer.d.ts +2 -0
- package/dist/src/dht/routing/getPreviousPeer.js +9 -0
- package/dist/src/dht/routing/getPreviousPeer.js.map +1 -0
- package/dist/src/dht/store/StoreRpcLocal.d.ts +11 -8
- package/dist/src/dht/store/StoreRpcLocal.js +25 -24
- package/dist/src/dht/store/StoreRpcLocal.js.map +1 -1
- package/dist/src/dht/store/StoreRpcRemote.js +3 -7
- package/dist/src/dht/store/StoreRpcRemote.js.map +1 -1
- package/dist/src/exports.d.ts +11 -5
- package/dist/src/exports.js +17 -4
- package/dist/src/exports.js.map +1 -1
- package/dist/src/helpers/Connectivity.d.ts +4 -0
- package/dist/src/helpers/Connectivity.js +24 -0
- package/dist/src/helpers/Connectivity.js.map +1 -0
- package/dist/src/helpers/errors.d.ts +3 -3
- package/dist/src/helpers/errors.js +7 -7
- package/dist/src/helpers/protoClasses.js +3 -3
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +56 -39
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +49 -36
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +64 -84
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +64 -66
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +26 -21
- package/dist/src/rpc-protocol/DhtCallContext.d.ts +0 -1
- package/dist/src/rpc-protocol/DhtCallContext.js.map +1 -1
- package/dist/src/transport/ITransport.d.ts +5 -6
- package/dist/src/transport/ListeningRpcCommunicator.d.ts +5 -1
- package/dist/src/transport/ListeningRpcCommunicator.js +8 -2
- package/dist/src/transport/ListeningRpcCommunicator.js.map +1 -1
- package/dist/src/transport/RoutingRpcCommunicator.d.ts +2 -1
- package/dist/src/transport/RoutingRpcCommunicator.js +0 -1
- package/dist/src/transport/RoutingRpcCommunicator.js.map +1 -1
- package/dist/src/types/ServiceID.d.ts +1 -0
- package/dist/src/types/ServiceID.js +3 -0
- package/dist/src/types/ServiceID.js.map +1 -0
- package/karma.config.js +4 -4
- package/package.json +10 -8
- package/protos/DhtRpc.proto +32 -35
- package/src/connection/ConnectionLockHandler.ts +19 -17
- package/src/connection/ConnectionLockRpcLocal.ts +74 -0
- package/src/connection/ConnectionLockRpcRemote.ts +7 -6
- package/src/connection/ConnectionManager.ts +59 -95
- package/src/connection/ConnectivityChecker.ts +30 -26
- package/src/connection/ConnectorFacade.ts +74 -34
- package/src/connection/Handshaker.ts +9 -9
- package/src/connection/IConnection.ts +5 -6
- package/src/connection/ManagedConnection.ts +21 -22
- package/src/connection/{ManagedWebRtcConnection.ts → ManagedWebrtcConnection.ts} +9 -9
- package/src/connection/{Simulator → simulator}/Simulator.ts +4 -4
- package/src/connection/{Simulator → simulator}/SimulatorConnection.ts +23 -24
- package/src/connection/{Simulator → simulator}/SimulatorConnector.ts +13 -13
- package/src/connection/{Simulator → simulator}/SimulatorTransport.ts +2 -2
- package/src/connection/{WebRTC/BrowserWebRtcConnection.ts → webrtc/BrowserWebrtcConnection.ts} +12 -13
- package/src/connection/{WebRTC/IWebRtcConnection.ts → webrtc/IWebrtcConnection.ts} +2 -2
- package/src/connection/{WebRTC/NodeWebRtcConnection.ts → webrtc/NodeWebrtcConnection.ts} +32 -33
- package/src/connection/webrtc/WebrtcConnector.ts +225 -0
- package/src/connection/webrtc/WebrtcConnectorRpcLocal.ts +132 -0
- package/src/connection/{WebRTC/WebRtcConnectorRpcRemote.ts → webrtc/WebrtcConnectorRpcRemote.ts} +6 -7
- package/src/connection/{WebRTC → webrtc}/iceServerAsString.ts +1 -1
- package/src/connection/websocket/AutoCertifierClientFacade.ts +91 -0
- package/src/connection/{WebSocket/ClientWebSocket.ts → websocket/ClientWebsocket.ts} +19 -17
- package/src/connection/{WebSocket/ServerWebSocket.ts → websocket/ServerWebsocket.ts} +21 -27
- package/src/connection/{WebSocket/WebSocketConnectorRpcLocal.ts → websocket/WebsocketConnector.ts} +110 -101
- package/src/connection/websocket/WebsocketConnectorRpcLocal.ts +41 -0
- package/src/connection/{WebSocket/WebSocketConnectorRpcRemote.ts → websocket/WebsocketConnectorRpcRemote.ts} +6 -12
- package/src/connection/{WebSocket/WebSocketServer.ts → websocket/WebsocketServer.ts} +40 -22
- package/src/dht/DhtNode.ts +144 -179
- package/src/dht/DhtNodeRpcLocal.ts +68 -0
- package/src/dht/{RemoteDhtNode.ts → DhtNodeRpcRemote.ts} +12 -13
- package/src/dht/ExternalApiRpcLocal.ts +46 -0
- package/src/dht/ExternalApiRpcRemote.ts +4 -4
- package/src/dht/contact/Remote.ts +32 -4
- package/src/dht/contact/SortedContactList.ts +4 -4
- package/src/dht/discovery/DiscoverySession.ts +23 -20
- package/src/dht/discovery/PeerDiscovery.ts +14 -17
- package/src/dht/find/FindRpcLocal.ts +35 -0
- package/src/dht/find/{RecursiveFindSession.ts → FindSession.ts} +26 -25
- package/src/dht/find/FindSessionRpcLocal.ts +25 -0
- package/src/dht/find/{RemoteRecursiveFindSession.ts → FindSessionRpcRemote.ts} +9 -5
- package/src/dht/find/{RecursiveFinder.ts → Finder.ts} +78 -71
- package/src/dht/routing/FindRpcRemote.ts +40 -0
- package/src/dht/routing/Router.ts +70 -105
- package/src/dht/routing/RouterRpcLocal.ts +81 -0
- package/src/dht/routing/RouterRpcRemote.ts +15 -45
- package/src/dht/routing/RoutingSession.ts +56 -61
- package/src/dht/routing/getPreviousPeer.ts +6 -0
- package/src/dht/store/StoreRpcLocal.ts +44 -37
- package/src/dht/store/StoreRpcRemote.ts +4 -8
- package/src/exports.ts +11 -5
- package/src/helpers/Connectivity.ts +19 -0
- package/src/helpers/errors.ts +3 -3
- package/src/helpers/protoClasses.ts +6 -6
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +75 -59
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +26 -21
- package/src/proto/packages/dht/protos/DhtRpc.ts +87 -114
- package/src/rpc-protocol/DhtCallContext.ts +0 -1
- package/src/transport/ITransport.ts +5 -8
- package/src/transport/ListeningRpcCommunicator.ts +14 -4
- package/src/transport/RoutingRpcCommunicator.ts +3 -4
- package/src/types/ServiceID.ts +1 -0
- package/test/benchmark/{RecursiveFind.test.ts → Find.test.ts} +6 -6
- package/test/benchmark/KademliaCorrectness.test.ts +2 -2
- package/test/benchmark/kademlia-simulation/SimulationNode.ts +3 -3
- package/test/end-to-end/Layer0-Layer1.test.ts +13 -5
- package/test/end-to-end/Layer0.test.ts +35 -17
- package/test/end-to-end/Layer0MixedConnectionTypes.test.ts +24 -6
- package/test/end-to-end/{Layer0WebRTC-Layer1.test.ts → Layer0Webrtc-Layer1.test.ts} +1 -1
- package/test/end-to-end/{Layer0WebRTC.test.ts → Layer0Webrtc.test.ts} +14 -10
- package/test/end-to-end/Layer1-Scale-WebSocket.test.ts +8 -4
- package/test/end-to-end/{Layer1-Scale-WebRTC.test.ts → Layer1-Scale-Webrtc.test.ts} +2 -2
- package/test/end-to-end/RecoveryFromFailedAutoCertification.test.ts +52 -0
- package/test/end-to-end/{WebSocketConnectionRequest.test.ts → WebsocketConnectionRequest.test.ts} +16 -8
- package/test/end-to-end/memory-leak.test.ts +85 -0
- package/test/integration/ConnectionLocking.test.ts +4 -4
- package/test/integration/ConnectionManager.test.ts +37 -28
- package/test/integration/DhtJoinPeerDiscovery.test.ts +2 -2
- package/test/integration/DhtNodeExternalAPI.test.ts +10 -10
- package/test/integration/{RemoteDhtNode.test.ts → DhtNodeRpcRemote.test.ts} +10 -10
- package/test/integration/DhtRpc.test.ts +5 -5
- package/test/integration/{RecursiveFind.test.ts → Find.test.ts} +3 -3
- package/test/integration/Layer1-scale.test.ts +1 -1
- package/test/integration/MigrateData.test.ts +6 -5
- package/test/integration/Mock-Layer1-Layer0.test.ts +1 -1
- package/test/integration/MultipleEntryPointJoining.test.ts +6 -6
- package/test/integration/RouteMessage.test.ts +26 -26
- package/test/integration/RpcErrors.test.ts +10 -10
- package/test/integration/ScaleDownDht.test.ts +3 -3
- package/test/integration/SimultaneousConnections.test.ts +10 -7
- package/test/integration/Store.test.ts +1 -1
- package/test/integration/StoreAndDelete.test.ts +1 -1
- package/test/integration/StoreOnDhtWithTwoNodes.test.ts +12 -12
- package/test/integration/{WebRtcConnectionManagement.test.ts → WebrtcConnectionManagement.test.ts} +4 -4
- package/test/integration/{WebRtcConnectorRpc.test.ts → WebrtcConnectorRpc.test.ts} +7 -8
- package/test/integration/{WebSocket.test.ts → Websocket.test.ts} +14 -13
- package/test/integration/{WebSocketConnectionManagement.test.ts → WebsocketConnectionManagement.test.ts} +4 -4
- package/test/integration/{WebSocketConnectorRpc.test.ts → WebsocketConnectorRpc.test.ts} +15 -15
- package/test/unit/AutoCertifierClientFacade.test.ts +58 -0
- package/test/unit/ConnectivityHelpers.test.ts +69 -0
- package/test/unit/{RecursiveFinder.test.ts → Finder.test.ts} +19 -17
- package/test/unit/Router.test.ts +26 -26
- package/test/unit/UUID.test.ts +1 -1
- package/test/unit/{WebSocketConnectorRpcLocal.test.ts → WebsocketConnector.test.ts} +8 -8
- package/test/unit/{WebSocketServer.test.ts → WebsocketServer.test.ts} +20 -14
- package/test/unit/webrtcReplaceInternalIpWithExternalIp.test.ts +1 -1
- package/test/utils/FakeRpcCommunicator.ts +23 -0
- package/test/utils/mock/Transport.ts +1 -1
- package/test/utils/utils.ts +14 -24
- package/tsconfig.browser.json +1 -1
- package/tsconfig.jest.json +3 -2
- package/tsconfig.node.json +3 -2
- package/dist/src/connection/ManagedWebRtcConnection.d.ts +0 -7
- package/dist/src/connection/ManagedWebRtcConnection.js +0 -20
- package/dist/src/connection/ManagedWebRtcConnection.js.map +0 -1
- package/dist/src/connection/Simulator/SimulatorConnection.js.map +0 -1
- package/dist/src/connection/Simulator/SimulatorTransport.js.map +0 -1
- package/dist/src/connection/WebRTC/IWebRtcConnection.js.map +0 -1
- package/dist/src/connection/WebRTC/NodeWebRtcConnection.js.map +0 -1
- package/dist/src/connection/WebRTC/WebRtcConnectorRpcLocal.d.ts +0 -51
- package/dist/src/connection/WebRTC/WebRtcConnectorRpcLocal.js +0 -249
- package/dist/src/connection/WebRTC/WebRtcConnectorRpcLocal.js.map +0 -1
- package/dist/src/connection/WebRTC/WebRtcConnectorRpcRemote.js.map +0 -1
- package/dist/src/connection/WebSocket/ClientWebSocket.js.map +0 -1
- package/dist/src/connection/WebSocket/ServerWebSocket.js.map +0 -1
- package/dist/src/connection/WebSocket/WebSocketConnectorRpcLocal.js.map +0 -1
- package/dist/src/connection/WebSocket/WebSocketServer.js.map +0 -1
- package/dist/src/dht/RemoteDhtNode.js.map +0 -1
- package/dist/src/dht/find/RecursiveFindSession.js.map +0 -1
- package/dist/src/dht/find/RecursiveFinder.js.map +0 -1
- package/dist/src/dht/find/RemoteRecursiveFindSession.js.map +0 -1
- package/dist/src/dht/registerExternalApiRpcMethods.d.ts +0 -2
- package/dist/src/dht/registerExternalApiRpcMethods.js +0 -32
- package/dist/src/dht/registerExternalApiRpcMethods.js.map +0 -1
- package/src/connection/WebRTC/WebRtcConnectorRpcLocal.ts +0 -335
- package/src/dht/registerExternalApiRpcMethods.ts +0 -44
- package/test/utils/mock/RecursiveFinder.ts +0 -19
- /package/dist/src/connection/{Simulator → simulator}/Simulator.d.ts +0 -0
- /package/dist/src/connection/{Simulator → simulator}/pings.d.ts +0 -0
- /package/dist/src/connection/{Simulator → simulator}/pings.js +0 -0
- /package/dist/src/connection/{WebRTC → webrtc}/iceServerAsString.js +0 -0
- /package/src/connection/{Simulator → simulator}/pings.ts +0 -0
|
@@ -246,11 +246,7 @@ export interface PeerDescriptor {
|
|
|
246
246
|
*/
|
|
247
247
|
websocket?: ConnectivityMethod;
|
|
248
248
|
/**
|
|
249
|
-
* @generated from protobuf field: optional
|
|
250
|
-
*/
|
|
251
|
-
openInternet?: boolean;
|
|
252
|
-
/**
|
|
253
|
-
* @generated from protobuf field: optional uint32 region = 7;
|
|
249
|
+
* @generated from protobuf field: optional uint32 region = 6;
|
|
254
250
|
*/
|
|
255
251
|
region?: number;
|
|
256
252
|
}
|
|
@@ -288,19 +284,15 @@ export interface RouteMessageWrapper {
|
|
|
288
284
|
*/
|
|
289
285
|
destinationPeer?: PeerDescriptor;
|
|
290
286
|
/**
|
|
291
|
-
* @generated from protobuf field: dht.
|
|
292
|
-
*/
|
|
293
|
-
previousPeer?: PeerDescriptor;
|
|
294
|
-
/**
|
|
295
|
-
* @generated from protobuf field: dht.Message message = 5;
|
|
287
|
+
* @generated from protobuf field: dht.Message message = 4;
|
|
296
288
|
*/
|
|
297
289
|
message?: Message;
|
|
298
290
|
/**
|
|
299
|
-
* @generated from protobuf field: repeated dht.PeerDescriptor reachableThrough =
|
|
291
|
+
* @generated from protobuf field: repeated dht.PeerDescriptor reachableThrough = 5;
|
|
300
292
|
*/
|
|
301
293
|
reachableThrough: PeerDescriptor[];
|
|
302
294
|
/**
|
|
303
|
-
* @generated from protobuf field: repeated dht.PeerDescriptor routingPath =
|
|
295
|
+
* @generated from protobuf field: repeated dht.PeerDescriptor routingPath = 6;
|
|
304
296
|
*/
|
|
305
297
|
routingPath: PeerDescriptor[];
|
|
306
298
|
}
|
|
@@ -335,25 +327,25 @@ export interface ConnectivityRequest {
|
|
|
335
327
|
* @generated from protobuf field: optional string host = 3;
|
|
336
328
|
*/
|
|
337
329
|
host?: string;
|
|
330
|
+
/**
|
|
331
|
+
* @generated from protobuf field: bool selfSigned = 4;
|
|
332
|
+
*/
|
|
333
|
+
selfSigned: boolean;
|
|
338
334
|
}
|
|
339
335
|
/**
|
|
340
336
|
* @generated from protobuf message dht.ConnectivityResponse
|
|
341
337
|
*/
|
|
342
338
|
export interface ConnectivityResponse {
|
|
343
339
|
/**
|
|
344
|
-
* @generated from protobuf field:
|
|
345
|
-
*/
|
|
346
|
-
openInternet: boolean;
|
|
347
|
-
/**
|
|
348
|
-
* @generated from protobuf field: string host = 2;
|
|
340
|
+
* @generated from protobuf field: string host = 1;
|
|
349
341
|
*/
|
|
350
342
|
host: string;
|
|
351
343
|
/**
|
|
352
|
-
* @generated from protobuf field: string natType =
|
|
344
|
+
* @generated from protobuf field: string natType = 2;
|
|
353
345
|
*/
|
|
354
346
|
natType: string;
|
|
355
347
|
/**
|
|
356
|
-
* @generated from protobuf field: dht.ConnectivityMethod websocket =
|
|
348
|
+
* @generated from protobuf field: dht.ConnectivityMethod websocket = 3;
|
|
357
349
|
*/
|
|
358
350
|
websocket?: ConnectivityMethod;
|
|
359
351
|
}
|
|
@@ -459,41 +451,25 @@ export interface Message {
|
|
|
459
451
|
/**
|
|
460
452
|
* WebSocket
|
|
461
453
|
*
|
|
462
|
-
* @generated from protobuf message dht.
|
|
454
|
+
* @generated from protobuf message dht.WebsocketConnectionRequest
|
|
463
455
|
*/
|
|
464
|
-
export interface
|
|
465
|
-
/**
|
|
466
|
-
* @generated from protobuf field: string ip = 1;
|
|
467
|
-
*/
|
|
468
|
-
ip: string;
|
|
469
|
-
/**
|
|
470
|
-
* @generated from protobuf field: uint32 port = 2;
|
|
471
|
-
*/
|
|
472
|
-
port: number;
|
|
456
|
+
export interface WebsocketConnectionRequest {
|
|
473
457
|
}
|
|
474
458
|
/**
|
|
475
|
-
* @generated from protobuf message dht.
|
|
459
|
+
* @generated from protobuf message dht.WebsocketConnectionResponse
|
|
476
460
|
*/
|
|
477
|
-
export interface
|
|
461
|
+
export interface WebsocketConnectionResponse {
|
|
478
462
|
/**
|
|
479
463
|
* @generated from protobuf field: bool accepted = 1;
|
|
480
464
|
*/
|
|
481
465
|
accepted: boolean;
|
|
482
|
-
/**
|
|
483
|
-
* @generated from protobuf field: optional string reason = 2;
|
|
484
|
-
*/
|
|
485
|
-
reason?: string;
|
|
486
466
|
}
|
|
487
467
|
/**
|
|
488
468
|
* WebRTC
|
|
489
469
|
*
|
|
490
|
-
* @generated from protobuf message dht.
|
|
470
|
+
* @generated from protobuf message dht.WebrtcConnectionRequest
|
|
491
471
|
*/
|
|
492
|
-
export interface
|
|
493
|
-
/**
|
|
494
|
-
* @generated from protobuf field: string connectionId = 1;
|
|
495
|
-
*/
|
|
496
|
-
connectionId: string;
|
|
472
|
+
export interface WebrtcConnectionRequest {
|
|
497
473
|
}
|
|
498
474
|
/**
|
|
499
475
|
* @generated from protobuf message dht.RtcOffer
|
|
@@ -543,18 +519,18 @@ export interface IceCandidate {
|
|
|
543
519
|
*/
|
|
544
520
|
export interface LockRequest {
|
|
545
521
|
/**
|
|
546
|
-
* @generated from protobuf field: string
|
|
522
|
+
* @generated from protobuf field: string lockId = 1;
|
|
547
523
|
*/
|
|
548
|
-
|
|
524
|
+
lockId: string;
|
|
549
525
|
}
|
|
550
526
|
/**
|
|
551
527
|
* @generated from protobuf message dht.UnlockRequest
|
|
552
528
|
*/
|
|
553
529
|
export interface UnlockRequest {
|
|
554
530
|
/**
|
|
555
|
-
* @generated from protobuf field: string
|
|
531
|
+
* @generated from protobuf field: string lockId = 1;
|
|
556
532
|
*/
|
|
557
|
-
|
|
533
|
+
lockId: string;
|
|
558
534
|
}
|
|
559
535
|
/**
|
|
560
536
|
* @generated from protobuf message dht.LockResponse
|
|
@@ -584,18 +560,18 @@ export interface DisconnectNotice {
|
|
|
584
560
|
export interface DisconnectNoticeResponse {
|
|
585
561
|
}
|
|
586
562
|
/**
|
|
587
|
-
* @generated from protobuf message dht.
|
|
563
|
+
* @generated from protobuf message dht.ExternalFindDataRequest
|
|
588
564
|
*/
|
|
589
|
-
export interface
|
|
565
|
+
export interface ExternalFindDataRequest {
|
|
590
566
|
/**
|
|
591
567
|
* @generated from protobuf field: bytes kademliaId = 1;
|
|
592
568
|
*/
|
|
593
569
|
kademliaId: Uint8Array;
|
|
594
570
|
}
|
|
595
571
|
/**
|
|
596
|
-
* @generated from protobuf message dht.
|
|
572
|
+
* @generated from protobuf message dht.ExternalFindDataResponse
|
|
597
573
|
*/
|
|
598
|
-
export interface
|
|
574
|
+
export interface ExternalFindDataResponse {
|
|
599
575
|
/**
|
|
600
576
|
* @generated from protobuf field: repeated dht.DataEntry dataEntries = 1;
|
|
601
577
|
*/
|
|
@@ -650,29 +626,29 @@ export enum RpcResponseError {
|
|
|
650
626
|
*/
|
|
651
627
|
export enum MessageType {
|
|
652
628
|
/**
|
|
653
|
-
* @generated from protobuf enum value:
|
|
629
|
+
* @generated from protobuf enum value: RPC = 0;
|
|
654
630
|
*/
|
|
655
|
-
|
|
631
|
+
RPC = 0,
|
|
656
632
|
/**
|
|
657
|
-
* @generated from protobuf enum value:
|
|
633
|
+
* @generated from protobuf enum value: CONNECTIVITY_REQUEST = 1;
|
|
658
634
|
*/
|
|
659
|
-
|
|
635
|
+
CONNECTIVITY_REQUEST = 1,
|
|
660
636
|
/**
|
|
661
|
-
* @generated from protobuf enum value:
|
|
637
|
+
* @generated from protobuf enum value: CONNECTIVITY_RESPONSE = 2;
|
|
662
638
|
*/
|
|
663
|
-
|
|
639
|
+
CONNECTIVITY_RESPONSE = 2,
|
|
664
640
|
/**
|
|
665
|
-
* @generated from protobuf enum value:
|
|
641
|
+
* @generated from protobuf enum value: HANDSHAKE_REQUEST = 3;
|
|
666
642
|
*/
|
|
667
|
-
|
|
643
|
+
HANDSHAKE_REQUEST = 3,
|
|
668
644
|
/**
|
|
669
|
-
* @generated from protobuf enum value:
|
|
645
|
+
* @generated from protobuf enum value: HANDSHAKE_RESPONSE = 4;
|
|
670
646
|
*/
|
|
671
|
-
|
|
647
|
+
HANDSHAKE_RESPONSE = 4,
|
|
672
648
|
/**
|
|
673
|
-
* @generated from protobuf enum value:
|
|
649
|
+
* @generated from protobuf enum value: FIND_REQUEST = 5;
|
|
674
650
|
*/
|
|
675
|
-
|
|
651
|
+
FIND_REQUEST = 5
|
|
676
652
|
}
|
|
677
653
|
/**
|
|
678
654
|
* @generated from protobuf enum dht.DisconnectMode
|
|
@@ -905,8 +881,7 @@ class PeerDescriptor$Type extends MessageType$<PeerDescriptor> {
|
|
|
905
881
|
{ no: 3, name: "udp", kind: "message", T: () => ConnectivityMethod },
|
|
906
882
|
{ no: 4, name: "tcp", kind: "message", T: () => ConnectivityMethod },
|
|
907
883
|
{ no: 5, name: "websocket", kind: "message", T: () => ConnectivityMethod },
|
|
908
|
-
{ no: 6, name: "
|
|
909
|
-
{ no: 7, name: "region", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }
|
|
884
|
+
{ no: 6, name: "region", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }
|
|
910
885
|
]);
|
|
911
886
|
}
|
|
912
887
|
}
|
|
@@ -935,10 +910,9 @@ class RouteMessageWrapper$Type extends MessageType$<RouteMessageWrapper> {
|
|
|
935
910
|
{ no: 1, name: "sourcePeer", kind: "message", T: () => PeerDescriptor },
|
|
936
911
|
{ no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
937
912
|
{ no: 3, name: "destinationPeer", kind: "message", T: () => PeerDescriptor },
|
|
938
|
-
{ no: 4, name: "
|
|
939
|
-
{ no: 5, name: "
|
|
940
|
-
{ no: 6, name: "
|
|
941
|
-
{ no: 7, name: "routingPath", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }
|
|
913
|
+
{ no: 4, name: "message", kind: "message", T: () => Message },
|
|
914
|
+
{ no: 5, name: "reachableThrough", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor },
|
|
915
|
+
{ no: 6, name: "routingPath", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }
|
|
942
916
|
]);
|
|
943
917
|
}
|
|
944
918
|
}
|
|
@@ -965,7 +939,8 @@ class ConnectivityRequest$Type extends MessageType$<ConnectivityRequest> {
|
|
|
965
939
|
super("dht.ConnectivityRequest", [
|
|
966
940
|
{ no: 1, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
|
967
941
|
{ no: 2, name: "tls", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
|
|
968
|
-
{ no: 3, name: "host", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }
|
|
942
|
+
{ no: 3, name: "host", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ },
|
|
943
|
+
{ no: 4, name: "selfSigned", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
|
|
969
944
|
]);
|
|
970
945
|
}
|
|
971
946
|
}
|
|
@@ -977,10 +952,9 @@ export const ConnectivityRequest = new ConnectivityRequest$Type();
|
|
|
977
952
|
class ConnectivityResponse$Type extends MessageType$<ConnectivityResponse> {
|
|
978
953
|
constructor() {
|
|
979
954
|
super("dht.ConnectivityResponse", [
|
|
980
|
-
{ no: 1, name: "
|
|
981
|
-
{ no: 2, name: "
|
|
982
|
-
{ no: 3, name: "
|
|
983
|
-
{ no: 4, name: "websocket", kind: "message", T: () => ConnectivityMethod }
|
|
955
|
+
{ no: 1, name: "host", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
956
|
+
{ no: 2, name: "natType", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
957
|
+
{ no: 3, name: "websocket", kind: "message", T: () => ConnectivityMethod }
|
|
984
958
|
]);
|
|
985
959
|
}
|
|
986
960
|
}
|
|
@@ -1038,43 +1012,37 @@ class Message$Type extends MessageType$<Message> {
|
|
|
1038
1012
|
*/
|
|
1039
1013
|
export const Message = new Message$Type();
|
|
1040
1014
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
1041
|
-
class
|
|
1015
|
+
class WebsocketConnectionRequest$Type extends MessageType$<WebsocketConnectionRequest> {
|
|
1042
1016
|
constructor() {
|
|
1043
|
-
super("dht.
|
|
1044
|
-
{ no: 1, name: "ip", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
1045
|
-
{ no: 2, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }
|
|
1046
|
-
]);
|
|
1017
|
+
super("dht.WebsocketConnectionRequest", []);
|
|
1047
1018
|
}
|
|
1048
1019
|
}
|
|
1049
1020
|
/**
|
|
1050
|
-
* @generated MessageType for protobuf message dht.
|
|
1021
|
+
* @generated MessageType for protobuf message dht.WebsocketConnectionRequest
|
|
1051
1022
|
*/
|
|
1052
|
-
export const
|
|
1023
|
+
export const WebsocketConnectionRequest = new WebsocketConnectionRequest$Type();
|
|
1053
1024
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
1054
|
-
class
|
|
1025
|
+
class WebsocketConnectionResponse$Type extends MessageType$<WebsocketConnectionResponse> {
|
|
1055
1026
|
constructor() {
|
|
1056
|
-
super("dht.
|
|
1057
|
-
{ no: 1, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
|
|
1058
|
-
{ no: 2, name: "reason", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }
|
|
1027
|
+
super("dht.WebsocketConnectionResponse", [
|
|
1028
|
+
{ no: 1, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
|
|
1059
1029
|
]);
|
|
1060
1030
|
}
|
|
1061
1031
|
}
|
|
1062
1032
|
/**
|
|
1063
|
-
* @generated MessageType for protobuf message dht.
|
|
1033
|
+
* @generated MessageType for protobuf message dht.WebsocketConnectionResponse
|
|
1064
1034
|
*/
|
|
1065
|
-
export const
|
|
1035
|
+
export const WebsocketConnectionResponse = new WebsocketConnectionResponse$Type();
|
|
1066
1036
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
1067
|
-
class
|
|
1037
|
+
class WebrtcConnectionRequest$Type extends MessageType$<WebrtcConnectionRequest> {
|
|
1068
1038
|
constructor() {
|
|
1069
|
-
super("dht.
|
|
1070
|
-
{ no: 1, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1071
|
-
]);
|
|
1039
|
+
super("dht.WebrtcConnectionRequest", []);
|
|
1072
1040
|
}
|
|
1073
1041
|
}
|
|
1074
1042
|
/**
|
|
1075
|
-
* @generated MessageType for protobuf message dht.
|
|
1043
|
+
* @generated MessageType for protobuf message dht.WebrtcConnectionRequest
|
|
1076
1044
|
*/
|
|
1077
|
-
export const
|
|
1045
|
+
export const WebrtcConnectionRequest = new WebrtcConnectionRequest$Type();
|
|
1078
1046
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
1079
1047
|
class RtcOffer$Type extends MessageType$<RtcOffer> {
|
|
1080
1048
|
constructor() {
|
|
@@ -1119,7 +1087,7 @@ export const IceCandidate = new IceCandidate$Type();
|
|
|
1119
1087
|
class LockRequest$Type extends MessageType$<LockRequest> {
|
|
1120
1088
|
constructor() {
|
|
1121
1089
|
super("dht.LockRequest", [
|
|
1122
|
-
{ no: 1, name: "
|
|
1090
|
+
{ no: 1, name: "lockId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1123
1091
|
]);
|
|
1124
1092
|
}
|
|
1125
1093
|
}
|
|
@@ -1131,7 +1099,7 @@ export const LockRequest = new LockRequest$Type();
|
|
|
1131
1099
|
class UnlockRequest$Type extends MessageType$<UnlockRequest> {
|
|
1132
1100
|
constructor() {
|
|
1133
1101
|
super("dht.UnlockRequest", [
|
|
1134
|
-
{ no: 1, name: "
|
|
1102
|
+
{ no: 1, name: "lockId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
1135
1103
|
]);
|
|
1136
1104
|
}
|
|
1137
1105
|
}
|
|
@@ -1175,34 +1143,34 @@ class DisconnectNoticeResponse$Type extends MessageType$<DisconnectNoticeRespons
|
|
|
1175
1143
|
*/
|
|
1176
1144
|
export const DisconnectNoticeResponse = new DisconnectNoticeResponse$Type();
|
|
1177
1145
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
1178
|
-
class
|
|
1146
|
+
class ExternalFindDataRequest$Type extends MessageType$<ExternalFindDataRequest> {
|
|
1179
1147
|
constructor() {
|
|
1180
|
-
super("dht.
|
|
1148
|
+
super("dht.ExternalFindDataRequest", [
|
|
1181
1149
|
{ no: 1, name: "kademliaId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
|
1182
1150
|
]);
|
|
1183
1151
|
}
|
|
1184
1152
|
}
|
|
1185
1153
|
/**
|
|
1186
|
-
* @generated MessageType for protobuf message dht.
|
|
1154
|
+
* @generated MessageType for protobuf message dht.ExternalFindDataRequest
|
|
1187
1155
|
*/
|
|
1188
|
-
export const
|
|
1156
|
+
export const ExternalFindDataRequest = new ExternalFindDataRequest$Type();
|
|
1189
1157
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
1190
|
-
class
|
|
1158
|
+
class ExternalFindDataResponse$Type extends MessageType$<ExternalFindDataResponse> {
|
|
1191
1159
|
constructor() {
|
|
1192
|
-
super("dht.
|
|
1160
|
+
super("dht.ExternalFindDataResponse", [
|
|
1193
1161
|
{ no: 1, name: "dataEntries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => DataEntry },
|
|
1194
1162
|
{ no: 2, name: "error", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }
|
|
1195
1163
|
]);
|
|
1196
1164
|
}
|
|
1197
1165
|
}
|
|
1198
1166
|
/**
|
|
1199
|
-
* @generated MessageType for protobuf message dht.
|
|
1167
|
+
* @generated MessageType for protobuf message dht.ExternalFindDataResponse
|
|
1200
1168
|
*/
|
|
1201
|
-
export const
|
|
1169
|
+
export const ExternalFindDataResponse = new ExternalFindDataResponse$Type();
|
|
1202
1170
|
/**
|
|
1203
|
-
* @generated ServiceType for protobuf service dht.
|
|
1171
|
+
* @generated ServiceType for protobuf service dht.DhtNodeRpc
|
|
1204
1172
|
*/
|
|
1205
|
-
export const
|
|
1173
|
+
export const DhtNodeRpc = new ServiceType("dht.DhtNodeRpc", [
|
|
1206
1174
|
{ name: "getClosestPeers", options: {}, I: ClosestPeersRequest, O: ClosestPeersResponse },
|
|
1207
1175
|
{ name: "ping", options: {}, I: PingRequest, O: PingResponse },
|
|
1208
1176
|
{ name: "leaveNotice", options: {}, I: LeaveNotice, O: Empty }
|
|
@@ -1212,8 +1180,13 @@ export const DhtRpcService = new ServiceType("dht.DhtRpcService", [
|
|
|
1212
1180
|
*/
|
|
1213
1181
|
export const RouterRpc = new ServiceType("dht.RouterRpc", [
|
|
1214
1182
|
{ name: "routeMessage", options: {}, I: RouteMessageWrapper, O: RouteMessageAck },
|
|
1215
|
-
{ name: "forwardMessage", options: {}, I: RouteMessageWrapper, O: RouteMessageAck }
|
|
1216
|
-
|
|
1183
|
+
{ name: "forwardMessage", options: {}, I: RouteMessageWrapper, O: RouteMessageAck }
|
|
1184
|
+
]);
|
|
1185
|
+
/**
|
|
1186
|
+
* @generated ServiceType for protobuf service dht.FindRpc
|
|
1187
|
+
*/
|
|
1188
|
+
export const FindRpc = new ServiceType("dht.FindRpc", [
|
|
1189
|
+
{ name: "routeFindRequest", options: {}, I: RouteMessageWrapper, O: RouteMessageAck }
|
|
1217
1190
|
]);
|
|
1218
1191
|
/**
|
|
1219
1192
|
* @generated ServiceType for protobuf service dht.StoreRpc
|
|
@@ -1224,22 +1197,22 @@ export const StoreRpc = new ServiceType("dht.StoreRpc", [
|
|
|
1224
1197
|
{ name: "deleteData", options: {}, I: DeleteDataRequest, O: DeleteDataResponse }
|
|
1225
1198
|
]);
|
|
1226
1199
|
/**
|
|
1227
|
-
* @generated ServiceType for protobuf service dht.
|
|
1200
|
+
* @generated ServiceType for protobuf service dht.FindSessionRpc
|
|
1228
1201
|
*/
|
|
1229
|
-
export const
|
|
1202
|
+
export const FindSessionRpc = new ServiceType("dht.FindSessionRpc", [
|
|
1230
1203
|
{ name: "sendFindResponse", options: {}, I: FindResponse, O: Empty }
|
|
1231
1204
|
]);
|
|
1232
1205
|
/**
|
|
1233
|
-
* @generated ServiceType for protobuf service dht.
|
|
1206
|
+
* @generated ServiceType for protobuf service dht.WebsocketConnectorRpc
|
|
1234
1207
|
*/
|
|
1235
|
-
export const
|
|
1236
|
-
{ name: "requestConnection", options: {}, I:
|
|
1208
|
+
export const WebsocketConnectorRpc = new ServiceType("dht.WebsocketConnectorRpc", [
|
|
1209
|
+
{ name: "requestConnection", options: {}, I: WebsocketConnectionRequest, O: WebsocketConnectionResponse }
|
|
1237
1210
|
]);
|
|
1238
1211
|
/**
|
|
1239
|
-
* @generated ServiceType for protobuf service dht.
|
|
1212
|
+
* @generated ServiceType for protobuf service dht.WebrtcConnectorRpc
|
|
1240
1213
|
*/
|
|
1241
|
-
export const
|
|
1242
|
-
{ name: "requestConnection", options: {}, I:
|
|
1214
|
+
export const WebrtcConnectorRpc = new ServiceType("dht.WebrtcConnectorRpc", [
|
|
1215
|
+
{ name: "requestConnection", options: {}, I: WebrtcConnectionRequest, O: Empty },
|
|
1243
1216
|
{ name: "rtcOffer", options: {}, I: RtcOffer, O: Empty },
|
|
1244
1217
|
{ name: "rtcAnswer", options: {}, I: RtcAnswer, O: Empty },
|
|
1245
1218
|
{ name: "iceCandidate", options: {}, I: IceCandidate, O: Empty }
|
|
@@ -1256,6 +1229,6 @@ export const ConnectionLockRpc = new ServiceType("dht.ConnectionLockRpc", [
|
|
|
1256
1229
|
* @generated ServiceType for protobuf service dht.ExternalApiRpc
|
|
1257
1230
|
*/
|
|
1258
1231
|
export const ExternalApiRpc = new ServiceType("dht.ExternalApiRpc", [
|
|
1259
|
-
{ name: "
|
|
1232
|
+
{ name: "externalFindData", options: {}, I: ExternalFindDataRequest, O: ExternalFindDataResponse },
|
|
1260
1233
|
{ name: "externalStoreData", options: {}, I: ExternalStoreDataRequest, O: ExternalStoreDataResponse }
|
|
1261
1234
|
]);
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { Message, PeerDescriptor } from '../proto/packages/dht/protos/DhtRpc'
|
|
2
2
|
|
|
3
|
-
export type DisconnectionType = 'OUTGOING_GRACEFUL_DISCONNECT' | 'OUTGOING_GRACEFUL_LEAVE' |
|
|
4
|
-
'INCOMING_GRACEFUL_DISCONNECT' | 'INCOMING_GRACEFUL_LEAVE' | 'OTHER'
|
|
5
|
-
|
|
6
3
|
export interface TransportEvents {
|
|
7
|
-
disconnected: (peerDescriptor: PeerDescriptor,
|
|
4
|
+
disconnected: (peerDescriptor: PeerDescriptor, gracefulLeave: boolean) => void
|
|
8
5
|
message: (message: Message) => void
|
|
9
6
|
connected: (peerDescriptor: PeerDescriptor) => void
|
|
10
7
|
|
|
@@ -13,19 +10,19 @@ export interface TransportEvents {
|
|
|
13
10
|
export interface ITransport {
|
|
14
11
|
on<T extends keyof TransportEvents>(eventName: T, listener: (message: Message) => void): void
|
|
15
12
|
on<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor) => void): void
|
|
16
|
-
on<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor,
|
|
13
|
+
on<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor, gracefulLeave: boolean) => void): void
|
|
17
14
|
|
|
18
15
|
once<T extends keyof TransportEvents>(eventName: T, listener: (message: Message) => void): void
|
|
19
16
|
once<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor) => void): void
|
|
20
17
|
once<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor,
|
|
21
|
-
|
|
18
|
+
gracefulLeave: boolean) => void): void
|
|
22
19
|
|
|
23
20
|
off<T extends keyof TransportEvents>(eventName: T, listener: (message: Message) => void): void
|
|
24
21
|
off<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor) => void): void
|
|
25
|
-
off<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor,
|
|
22
|
+
off<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor, gracefulLeave: boolean) => void): void
|
|
26
23
|
|
|
27
24
|
send(msg: Message, doNotConnect?: boolean): Promise<void>
|
|
28
|
-
|
|
25
|
+
getLocalPeerDescriptor(): PeerDescriptor
|
|
29
26
|
getAllConnectionPeerDescriptors(): PeerDescriptor[]
|
|
30
27
|
stop(): void | Promise<void>
|
|
31
28
|
}
|
|
@@ -2,13 +2,23 @@ import { ITransport } from './ITransport'
|
|
|
2
2
|
import { RoutingRpcCommunicator } from './RoutingRpcCommunicator'
|
|
3
3
|
import { RpcCommunicatorConfig } from '@streamr/proto-rpc'
|
|
4
4
|
import { Message } from '../proto/packages/dht/protos/DhtRpc'
|
|
5
|
+
import { ServiceID } from '../types/ServiceID'
|
|
5
6
|
|
|
6
7
|
export class ListeningRpcCommunicator extends RoutingRpcCommunicator {
|
|
7
|
-
|
|
8
|
+
private readonly transport: ITransport
|
|
9
|
+
private readonly listener: (msg: Message) => void
|
|
10
|
+
|
|
11
|
+
constructor(ownServiceId: ServiceID, transport: ITransport, config?: RpcCommunicatorConfig) {
|
|
8
12
|
super(ownServiceId, transport.send, config)
|
|
9
|
-
|
|
10
|
-
transport.on('message', (msg: Message) => {
|
|
13
|
+
this.listener = (msg: Message) => {
|
|
11
14
|
this.handleMessageFromPeer(msg)
|
|
12
|
-
}
|
|
15
|
+
}
|
|
16
|
+
this.transport = transport
|
|
17
|
+
transport.on('message', this.listener)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
destroy(): void {
|
|
21
|
+
this.transport.off('message', this.listener)
|
|
22
|
+
this.stop()
|
|
13
23
|
}
|
|
14
24
|
}
|
|
@@ -3,13 +3,14 @@ import { v4 } from 'uuid'
|
|
|
3
3
|
import { RpcCommunicator, RpcCommunicatorConfig } from '@streamr/proto-rpc'
|
|
4
4
|
import { DhtCallContext } from '../rpc-protocol/DhtCallContext'
|
|
5
5
|
import { RpcMessage } from '../proto/packages/proto-rpc/protos/ProtoRpc'
|
|
6
|
+
import { ServiceID } from '../types/ServiceID'
|
|
6
7
|
|
|
7
8
|
export class RoutingRpcCommunicator extends RpcCommunicator {
|
|
8
|
-
private ownServiceId:
|
|
9
|
+
private ownServiceId: ServiceID
|
|
9
10
|
private sendFn: (msg: Message, doNotConnect?: boolean, doNotMindStopped?: boolean) => Promise<void>
|
|
10
11
|
|
|
11
12
|
constructor(
|
|
12
|
-
ownServiceId:
|
|
13
|
+
ownServiceId: ServiceID,
|
|
13
14
|
sendFn: (msg: Message, doNotConnect?: boolean) => Promise<void>,
|
|
14
15
|
config?: RpcCommunicatorConfig
|
|
15
16
|
) {
|
|
@@ -20,7 +21,6 @@ export class RoutingRpcCommunicator extends RpcCommunicator {
|
|
|
20
21
|
this.setOutgoingMessageListener((msg: RpcMessage, _requestId: string, callContext?: DhtCallContext) => {
|
|
21
22
|
let targetDescriptor: PeerDescriptor
|
|
22
23
|
// rpc call message
|
|
23
|
-
|
|
24
24
|
if (callContext!.targetDescriptor) {
|
|
25
25
|
targetDescriptor = callContext!.targetDescriptor!
|
|
26
26
|
} else { // rpc reply message
|
|
@@ -53,7 +53,6 @@ export class RoutingRpcCommunicator extends RpcCommunicator {
|
|
|
53
53
|
if (message.serviceId == this.ownServiceId && message.body.oneofKind === 'rpcMessage') {
|
|
54
54
|
const context = new DhtCallContext()
|
|
55
55
|
context.incomingSourceDescriptor = message.sourceDescriptor
|
|
56
|
-
context.incomingTargetDescriptor = message.targetDescriptor
|
|
57
56
|
this.handleIncomingMessage(message.body.rpcMessage, context)
|
|
58
57
|
}
|
|
59
58
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ServiceID = string
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import { LatencyType, Simulator } from '../../src/connection/
|
|
2
|
+
import { LatencyType, Simulator } from '../../src/connection/simulator/Simulator'
|
|
3
3
|
import { DhtNode } from '../../src/dht/DhtNode'
|
|
4
4
|
import { NodeType, PeerDescriptor } from '../../src/proto/packages/dht/protos/DhtRpc'
|
|
5
5
|
import { createMockConnectionDhtNode } from '../utils/utils'
|
|
@@ -12,7 +12,7 @@ import { debugVars } from '../../src/helpers/debugHelpers'
|
|
|
12
12
|
|
|
13
13
|
const logger = new Logger(module)
|
|
14
14
|
|
|
15
|
-
describe('
|
|
15
|
+
describe('Find correctness', () => {
|
|
16
16
|
let entryPoint: DhtNode
|
|
17
17
|
let nodes: DhtNode[]
|
|
18
18
|
let entrypointDescriptor: PeerDescriptor
|
|
@@ -70,16 +70,16 @@ describe('Recursive find correctness', () => {
|
|
|
70
70
|
debugVars['waiting'] = false
|
|
71
71
|
logger.info('waiting over')
|
|
72
72
|
|
|
73
|
-
nodes.forEach((node) => logger.info(keyFromPeerDescriptor(node.
|
|
73
|
+
nodes.forEach((node) => logger.info(keyFromPeerDescriptor(node.getLocalPeerDescriptor()) + ': connections:' +
|
|
74
74
|
node.getNumberOfConnections() + ', kbucket: ' + node.getBucketSize()
|
|
75
75
|
+ ', localLocked: ' + node.getNumberOfLocalLockedConnections()
|
|
76
76
|
+ ', remoteLocked: ' + node.getNumberOfRemoteLockedConnections()
|
|
77
77
|
+ ', weakLocked: ' + node.getNumberOfWeakLockedConnections()))
|
|
78
78
|
|
|
79
|
-
logger.info('starting
|
|
79
|
+
logger.info('starting find')
|
|
80
80
|
const kademliaIdToFind = Uint8Array.from(dhtIds[9].data)
|
|
81
|
-
const results = await nodes[159].
|
|
82
|
-
logger.info('
|
|
81
|
+
const results = await nodes[159].startFind(kademliaIdToFind)
|
|
82
|
+
logger.info('find over')
|
|
83
83
|
expect(results.closestNodes).toBeGreaterThanOrEqual(5)
|
|
84
84
|
expect(PeerID.fromValue(kademliaIdToFind).equals(peerIdFromPeerDescriptor(results.closestNodes[0])))
|
|
85
85
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import { Simulator } from '../../src/connection/
|
|
2
|
+
import { Simulator } from '../../src/connection/simulator/Simulator'
|
|
3
3
|
import { DhtNode } from '../../src/dht/DhtNode'
|
|
4
4
|
import { PeerID } from '../../src/helpers/PeerID'
|
|
5
5
|
import { keyFromPeerDescriptor } from '../../src/helpers/peerIdFromPeerDescriptor'
|
|
@@ -88,7 +88,7 @@ describe('Kademlia correctness', () => {
|
|
|
88
88
|
correctNeighbors++
|
|
89
89
|
}
|
|
90
90
|
} catch (e) {
|
|
91
|
-
console.error('Node ' + keyFromPeerDescriptor(nodes[i].
|
|
91
|
+
console.error('Node ' + keyFromPeerDescriptor(nodes[i].getLocalPeerDescriptor()) + ' had only '
|
|
92
92
|
+ kademliaNeighbors.length + ' kademlia neighbors')
|
|
93
93
|
}
|
|
94
94
|
if (correctNeighbors === 0) {
|
|
@@ -94,7 +94,7 @@ export class SimulationNode {
|
|
|
94
94
|
while (true) {
|
|
95
95
|
let oldClosestContactId = this.neighborList.getClosestContactId()
|
|
96
96
|
let uncontacted = this.neighborList.getUncontactedContacts(this.ALPHA)
|
|
97
|
-
if (uncontacted.length
|
|
97
|
+
if (uncontacted.length === 0) {
|
|
98
98
|
return
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -102,7 +102,7 @@ export class SimulationNode {
|
|
|
102
102
|
|
|
103
103
|
if (oldClosestContactId.equals(this.neighborList.getClosestContactId())) {
|
|
104
104
|
uncontacted = this.neighborList.getUncontactedContacts(this.K)
|
|
105
|
-
if (uncontacted.length
|
|
105
|
+
if (uncontacted.length === 0) {
|
|
106
106
|
return
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -115,7 +115,7 @@ export class SimulationNode {
|
|
|
115
115
|
return
|
|
116
116
|
}
|
|
117
117
|
uncontacted = this.neighborList.getUncontactedContacts(this.ALPHA)
|
|
118
|
-
if (uncontacted.length
|
|
118
|
+
if (uncontacted.length === 0) {
|
|
119
119
|
return
|
|
120
120
|
}
|
|
121
121
|
}
|
|
@@ -25,12 +25,20 @@ describe('Layer0-Layer1', () => {
|
|
|
25
25
|
|
|
26
26
|
beforeEach(async () => {
|
|
27
27
|
|
|
28
|
-
epDhtNode = new DhtNode({ peerDescriptor: epPeerDescriptor })
|
|
28
|
+
epDhtNode = new DhtNode({ peerDescriptor: epPeerDescriptor, websocketServerEnableTls: false })
|
|
29
29
|
await epDhtNode.start()
|
|
30
30
|
await epDhtNode.joinDht([epPeerDescriptor])
|
|
31
31
|
|
|
32
|
-
node1 = new DhtNode({
|
|
33
|
-
|
|
32
|
+
node1 = new DhtNode({
|
|
33
|
+
websocketPortRange,
|
|
34
|
+
entryPoints: [epPeerDescriptor],
|
|
35
|
+
websocketServerEnableTls: false
|
|
36
|
+
})
|
|
37
|
+
node2 = new DhtNode({
|
|
38
|
+
websocketPortRange,
|
|
39
|
+
entryPoints: [epPeerDescriptor],
|
|
40
|
+
websocketServerEnableTls: false
|
|
41
|
+
})
|
|
34
42
|
|
|
35
43
|
await node1.start()
|
|
36
44
|
await node2.start()
|
|
@@ -81,9 +89,9 @@ describe('Layer0-Layer1', () => {
|
|
|
81
89
|
expect(stream2Node1.getClosestContacts()).toHaveLength(1)
|
|
82
90
|
expect(stream2Node2.getClosestContacts()).toHaveLength(1)
|
|
83
91
|
|
|
84
|
-
expect(areEqualPeerDescriptors(stream1Node1.getClosestContacts()[0], node1.
|
|
92
|
+
expect(areEqualPeerDescriptors(stream1Node1.getClosestContacts()[0], node1.getLocalPeerDescriptor())).toBe(true)
|
|
85
93
|
expect(areEqualPeerDescriptors(stream1Node2.getClosestContacts()[0], epPeerDescriptor)).toBe(true)
|
|
86
|
-
expect(areEqualPeerDescriptors(stream2Node1.getClosestContacts()[0], node2.
|
|
94
|
+
expect(areEqualPeerDescriptors(stream2Node1.getClosestContacts()[0], node2.getLocalPeerDescriptor())).toBe(true)
|
|
87
95
|
expect(areEqualPeerDescriptors(stream2Node2.getClosestContacts()[0], epPeerDescriptor)).toBe(true)
|
|
88
96
|
})
|
|
89
97
|
})
|