@streamr/dht 100.0.0-pretestnet.2 → 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} +107 -101
- 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} +17 -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} +50 -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 +47 -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 +2 -1
- package/dist/src/transport/ListeningRpcCommunicator.js.map +1 -1
- package/dist/src/transport/RoutingRpcCommunicator.d.ts +2 -1
- package/dist/src/transport/RoutingRpcCommunicator.js +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} +109 -100
- 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} +25 -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} +77 -71
- package/src/dht/routing/FindRpcRemote.ts +40 -0
- package/src/dht/routing/Router.ts +69 -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 +2 -1
- 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
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PeerDescriptor, RouteMessageAck, RouteMessageWrapper } from '../../proto/packages/dht/protos/DhtRpc';
|
|
2
|
+
import { IFindRpc } from '../../proto/packages/dht/protos/DhtRpc.server';
|
|
3
|
+
interface FindRpcLocalConfig {
|
|
4
|
+
doRouteFindRequest: (routedMessage: RouteMessageWrapper) => RouteMessageAck;
|
|
5
|
+
addContact: (contact: PeerDescriptor, setActive?: boolean) => void;
|
|
6
|
+
isMostLikelyDuplicate: (requestId: string) => boolean;
|
|
7
|
+
addToDuplicateDetector: (requestId: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare class FindRpcLocal implements IFindRpc {
|
|
10
|
+
private readonly config;
|
|
11
|
+
constructor(config: FindRpcLocalConfig);
|
|
12
|
+
routeFindRequest(routedMessage: RouteMessageWrapper): Promise<RouteMessageAck>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindRpcLocal = void 0;
|
|
4
|
+
const utils_1 = require("@streamr/utils");
|
|
5
|
+
const peerIdFromPeerDescriptor_1 = require("../../helpers/peerIdFromPeerDescriptor");
|
|
6
|
+
const RouterRpcLocal_1 = require("../routing/RouterRpcLocal");
|
|
7
|
+
const getPreviousPeer_1 = require("../routing/getPreviousPeer");
|
|
8
|
+
const logger = new utils_1.Logger(module);
|
|
9
|
+
class FindRpcLocal {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.config = config;
|
|
12
|
+
}
|
|
13
|
+
async routeFindRequest(routedMessage) {
|
|
14
|
+
if (this.config.isMostLikelyDuplicate(routedMessage.requestId)) {
|
|
15
|
+
return (0, RouterRpcLocal_1.createRouteMessageAck)(routedMessage, 'message given to routeFindRequest() service is likely a duplicate');
|
|
16
|
+
}
|
|
17
|
+
const senderKey = (0, peerIdFromPeerDescriptor_1.keyFromPeerDescriptor)((0, getPreviousPeer_1.getPreviousPeer)(routedMessage) ?? routedMessage.sourcePeer);
|
|
18
|
+
logger.trace(`Received routeFindRequest call from ${senderKey}`);
|
|
19
|
+
this.config.addContact(routedMessage.sourcePeer, true);
|
|
20
|
+
this.config.addToDuplicateDetector(routedMessage.requestId);
|
|
21
|
+
return this.config.doRouteFindRequest(routedMessage);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.FindRpcLocal = FindRpcLocal;
|
|
25
|
+
//# sourceMappingURL=FindRpcLocal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FindRpcLocal.js","sourceRoot":"","sources":["../../../../src/dht/find/FindRpcLocal.ts"],"names":[],"mappings":";;;AAAA,0CAAuC;AAGvC,qFAA8E;AAC9E,8DAAiE;AACjE,gEAA4D;AAE5D,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AASjC,MAAa,YAAY;IAIrB,YAAY,MAA0B;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,aAAkC;QACrD,IAAI,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;YAC5D,OAAO,IAAA,sCAAqB,EAAC,aAAa,EAAE,mEAAmE,CAAC,CAAA;SACnH;QACD,MAAM,SAAS,GAAG,IAAA,gDAAqB,EAAC,IAAA,iCAAe,EAAC,aAAa,CAAC,IAAI,aAAa,CAAC,UAAW,CAAC,CAAA;QACpG,MAAM,CAAC,KAAK,CAAC,uCAAuC,SAAS,EAAE,CAAC,CAAA;QAChE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,UAAW,EAAE,IAAI,CAAC,CAAA;QACvD,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAA;QAC3D,OAAO,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAA;IACxD,CAAC;CACJ;AAlBD,oCAkBC"}
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import EventEmitter from 'eventemitter3';
|
|
2
2
|
import { PeerID } from '../../helpers/PeerID';
|
|
3
|
-
import { DataEntry, PeerDescriptor
|
|
4
|
-
import { IRecursiveFindSessionService } from '../../proto/packages/dht/protos/DhtRpc.server';
|
|
5
|
-
import { Empty } from '../../proto/google/protobuf/empty';
|
|
3
|
+
import { DataEntry, PeerDescriptor } from '../../proto/packages/dht/protos/DhtRpc';
|
|
6
4
|
import { ITransport } from '../../transport/ITransport';
|
|
7
|
-
import {
|
|
8
|
-
|
|
5
|
+
import { FindResult } from './Finder';
|
|
6
|
+
import { ServiceID } from '../../types/ServiceID';
|
|
7
|
+
export interface FindSessionEvents {
|
|
9
8
|
findCompleted: (results: PeerDescriptor[]) => void;
|
|
10
9
|
}
|
|
11
|
-
export interface
|
|
12
|
-
serviceId:
|
|
10
|
+
export interface FindSessionConfig {
|
|
11
|
+
serviceId: ServiceID;
|
|
13
12
|
transport: ITransport;
|
|
14
13
|
kademliaIdToFind: Uint8Array;
|
|
15
|
-
|
|
14
|
+
localPeerId: PeerID;
|
|
16
15
|
waitedRoutingPathCompletions: number;
|
|
17
16
|
fetchData: boolean;
|
|
18
17
|
}
|
|
19
|
-
export declare class
|
|
18
|
+
export declare class FindSession extends EventEmitter<FindSessionEvents> {
|
|
20
19
|
private readonly serviceId;
|
|
21
20
|
private readonly transport;
|
|
22
21
|
private readonly kademliaIdToFind;
|
|
23
|
-
private readonly
|
|
22
|
+
private readonly localPeerId;
|
|
24
23
|
private readonly waitedRoutingPathCompletions;
|
|
25
24
|
private readonly rpcCommunicator;
|
|
26
25
|
private readonly fetchData;
|
|
@@ -31,7 +30,8 @@ export declare class RecursiveFindSession extends EventEmitter<RecursiveFindSess
|
|
|
31
30
|
private reportFindCompletedTimeout?;
|
|
32
31
|
private findCompletedEmitted;
|
|
33
32
|
private noCloserNodesReceivedCounter;
|
|
34
|
-
constructor(config:
|
|
33
|
+
constructor(config: FindSessionConfig);
|
|
34
|
+
private registerLocalRpcMethods;
|
|
35
35
|
private isFindCompleted;
|
|
36
36
|
private hasNonStaleData;
|
|
37
37
|
doSendFindResponse(routingPath: PeerDescriptor[], nodes: PeerDescriptor[], dataEntries: DataEntry[], noCloserNodesFound?: boolean): void;
|
|
@@ -39,7 +39,6 @@ export declare class RecursiveFindSession extends EventEmitter<RecursiveFindSess
|
|
|
39
39
|
private setHopAsReported;
|
|
40
40
|
private processFoundData;
|
|
41
41
|
private onNoCloserPeersFound;
|
|
42
|
-
|
|
43
|
-
getResults: () => RecursiveFindResult;
|
|
42
|
+
getResults: () => FindResult;
|
|
44
43
|
stop(): void;
|
|
45
44
|
}
|
|
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
const utils_1 = require("@streamr/utils");
|
|
6
|
+
exports.FindSession = void 0;
|
|
8
7
|
const eventemitter3_1 = __importDefault(require("eventemitter3"));
|
|
9
8
|
const PeerID_1 = require("../../helpers/PeerID");
|
|
10
9
|
const DhtRpc_1 = require("../../proto/packages/dht/protos/DhtRpc");
|
|
@@ -12,8 +11,8 @@ const ListeningRpcCommunicator_1 = require("../../transport/ListeningRpcCommunic
|
|
|
12
11
|
const Contact_1 = require("../contact/Contact");
|
|
13
12
|
const SortedContactList_1 = require("../contact/SortedContactList");
|
|
14
13
|
const peerIdFromPeerDescriptor_1 = require("../../helpers/peerIdFromPeerDescriptor");
|
|
15
|
-
const
|
|
16
|
-
class
|
|
14
|
+
const FindSessionRpcLocal_1 = require("./FindSessionRpcLocal");
|
|
15
|
+
class FindSession extends eventemitter3_1.default {
|
|
17
16
|
constructor(config) {
|
|
18
17
|
super();
|
|
19
18
|
this.foundData = new Map();
|
|
@@ -28,14 +27,22 @@ class RecursiveFindSession extends eventemitter3_1.default {
|
|
|
28
27
|
this.serviceId = config.serviceId;
|
|
29
28
|
this.transport = config.transport;
|
|
30
29
|
this.kademliaIdToFind = config.kademliaIdToFind;
|
|
31
|
-
this.
|
|
30
|
+
this.localPeerId = config.localPeerId;
|
|
32
31
|
this.waitedRoutingPathCompletions = config.waitedRoutingPathCompletions;
|
|
33
32
|
this.results = new SortedContactList_1.SortedContactList(PeerID_1.PeerID.fromValue(this.kademliaIdToFind), 10, undefined, true);
|
|
34
33
|
this.fetchData = config.fetchData;
|
|
35
34
|
this.rpcCommunicator = new ListeningRpcCommunicator_1.ListeningRpcCommunicator(this.serviceId, this.transport, {
|
|
36
35
|
rpcRequestTimeout: 15000
|
|
37
36
|
});
|
|
38
|
-
this.
|
|
37
|
+
this.registerLocalRpcMethods();
|
|
38
|
+
}
|
|
39
|
+
registerLocalRpcMethods() {
|
|
40
|
+
const rpcLocal = new FindSessionRpcLocal_1.FindSessionRpcLocal({
|
|
41
|
+
doSendFindResponse: (routingPath, nodes, dataEntries, noCloserNodesFound) => {
|
|
42
|
+
this.doSendFindResponse(routingPath, nodes, dataEntries, noCloserNodesFound);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
this.rpcCommunicator.registerRpcNotification(DhtRpc_1.FindResponse, 'sendFindResponse', (req) => rpcLocal.sendFindResponse(req));
|
|
39
46
|
}
|
|
40
47
|
isFindCompleted() {
|
|
41
48
|
const unreportedHops = new Set(this.allKnownHops);
|
|
@@ -73,14 +80,14 @@ class RecursiveFindSession extends eventemitter3_1.default {
|
|
|
73
80
|
addKnownHops(routingPath) {
|
|
74
81
|
routingPath.forEach((desc) => {
|
|
75
82
|
const newPeerId = PeerID_1.PeerID.fromValue(desc.kademliaId);
|
|
76
|
-
if (!this.
|
|
83
|
+
if (!this.localPeerId.equals(newPeerId)) {
|
|
77
84
|
this.allKnownHops.add(newPeerId.toKey());
|
|
78
85
|
}
|
|
79
86
|
});
|
|
80
87
|
}
|
|
81
88
|
setHopAsReported(desc) {
|
|
82
89
|
const newPeerId = PeerID_1.PeerID.fromValue(desc.kademliaId);
|
|
83
|
-
if (!this.
|
|
90
|
+
if (!this.localPeerId.equals(newPeerId)) {
|
|
84
91
|
this.reportedHops.add(newPeerId.toKey());
|
|
85
92
|
}
|
|
86
93
|
if (this.isFindCompleted()) {
|
|
@@ -125,11 +132,6 @@ class RecursiveFindSession extends eventemitter3_1.default {
|
|
|
125
132
|
}
|
|
126
133
|
}
|
|
127
134
|
}
|
|
128
|
-
async sendFindResponse(report) {
|
|
129
|
-
logger.trace('recursiveFindReport arrived: ' + JSON.stringify(report));
|
|
130
|
-
this.doSendFindResponse(report.routingPath, report.closestConnectedPeers, report.dataEntries, report.noCloserNodesFound);
|
|
131
|
-
return {};
|
|
132
|
-
}
|
|
133
135
|
stop() {
|
|
134
136
|
if (this.reportFindCompletedTimeout) {
|
|
135
137
|
clearTimeout(this.reportFindCompletedTimeout);
|
|
@@ -139,5 +141,5 @@ class RecursiveFindSession extends eventemitter3_1.default {
|
|
|
139
141
|
this.emit('findCompleted', []);
|
|
140
142
|
}
|
|
141
143
|
}
|
|
142
|
-
exports.
|
|
143
|
-
//# sourceMappingURL=
|
|
144
|
+
exports.FindSession = FindSession;
|
|
145
|
+
//# sourceMappingURL=FindSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FindSession.js","sourceRoot":"","sources":["../../../../src/dht/find/FindSession.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAwC;AACxC,iDAAwD;AACxD,mEAAgG;AAEhG,uFAAmF;AACnF,gDAA4C;AAC5C,oEAAgE;AAEhE,qFAA8E;AAE9E,+DAA2D;AAe3D,MAAa,WAAY,SAAQ,uBAA+B;IAgB5D,YAAY,MAAyB;QACjC,KAAK,EAAE,CAAA;QARH,cAAS,GAA2B,IAAI,GAAG,EAAE,CAAA;QAC7C,iBAAY,GAAmB,IAAI,GAAG,EAAE,CAAA;QACxC,iBAAY,GAAmB,IAAI,GAAG,EAAE,CAAA;QAExC,yBAAoB,GAAG,KAAK,CAAA;QAC5B,iCAA4B,GAAG,CAAC,CAAA;QA6HjC,eAAU,GAAG,GAAe,EAAE,CAAC,CAAC;YACnC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;YACzF,WAAW,EAAE,CAAC,IAAI,CAAC,SAAS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oBAAoB,EAAE;wBAC5B,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAA;wBACvG,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAA;qBACnC;gBACL,CAAC,EAAE,IAAI,CAAC,CAAA;aACX;SACJ;IACL,CAAC;IAOM,IAAI;QACP,IAAI,IAAI,CAAC,0BAA0B,EAAE;YACjC,YAAY,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAA;YAC7C,IAAI,CAAC,0BAA0B,GAAG,SAAS,CAAA;SAC9C;QACD,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAA;QAC9B,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;IAClC,CAAC;CACJ;AAxJD,kCAwJC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IFindSessionRpc } from '../../proto/packages/dht/protos/DhtRpc.server';
|
|
2
|
+
import { Empty } from '../../proto/google/protobuf/empty';
|
|
3
|
+
import { DataEntry, FindResponse, PeerDescriptor } from '../../proto/packages/dht/protos/DhtRpc';
|
|
4
|
+
interface FindSessionRpcLocalConfig {
|
|
5
|
+
doSendFindResponse: (routingPath: PeerDescriptor[], nodes: PeerDescriptor[], dataEntries: DataEntry[], noCloserNodesFound?: boolean) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare class FindSessionRpcLocal implements IFindSessionRpc {
|
|
8
|
+
private readonly config;
|
|
9
|
+
constructor(config: FindSessionRpcLocalConfig);
|
|
10
|
+
sendFindResponse(report: FindResponse): Promise<Empty>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindSessionRpcLocal = void 0;
|
|
4
|
+
const utils_1 = require("@streamr/utils");
|
|
5
|
+
const logger = new utils_1.Logger(module);
|
|
6
|
+
class FindSessionRpcLocal {
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.config = config;
|
|
9
|
+
}
|
|
10
|
+
async sendFindResponse(report) {
|
|
11
|
+
logger.trace('FindResponse arrived: ' + JSON.stringify(report));
|
|
12
|
+
this.config.doSendFindResponse(report.routingPath, report.closestConnectedPeers, report.dataEntries, report.noCloserNodesFound);
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.FindSessionRpcLocal = FindSessionRpcLocal;
|
|
17
|
+
//# sourceMappingURL=FindSessionRpcLocal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FindSessionRpcLocal.js","sourceRoot":"","sources":["../../../../src/dht/find/FindSessionRpcLocal.ts"],"names":[],"mappings":";;;AAGA,0CAAuC;AAEvC,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAMjC,MAAa,mBAAmB;IAI5B,YAAY,MAAiC;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,MAAoB;QACvC,MAAM,CAAC,KAAK,CAAC,wBAAwB,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;QAC/D,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAA;QAC/H,OAAO,EAAE,CAAA;IACb,CAAC;CACJ;AAbD,kDAaC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataEntry, PeerDescriptor } from '../../proto/packages/dht/protos/DhtRpc';
|
|
2
|
-
import {
|
|
2
|
+
import { IFindSessionRpcClient } from '../../proto/packages/dht/protos/DhtRpc.client';
|
|
3
3
|
import { Remote } from '../contact/Remote';
|
|
4
|
-
export declare class
|
|
4
|
+
export declare class FindSessionRpcRemote extends Remote<IFindSessionRpcClient> {
|
|
5
5
|
sendFindResponse(routingPath: PeerDescriptor[], closestNodes: PeerDescriptor[], dataEntries: DataEntry[], noCloserNodesFound: boolean): void;
|
|
6
6
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FindSessionRpcRemote = void 0;
|
|
4
4
|
const utils_1 = require("@streamr/utils");
|
|
5
5
|
const Remote_1 = require("../contact/Remote");
|
|
6
6
|
const logger = new utils_1.Logger(module);
|
|
7
|
-
class
|
|
7
|
+
class FindSessionRpcRemote extends Remote_1.Remote {
|
|
8
8
|
sendFindResponse(routingPath, closestNodes, dataEntries, noCloserNodesFound) {
|
|
9
9
|
const report = {
|
|
10
10
|
routingPath,
|
|
@@ -13,9 +13,9 @@ class RemoteRecursiveFindSession extends Remote_1.Remote {
|
|
|
13
13
|
noCloserNodesFound
|
|
14
14
|
};
|
|
15
15
|
this.getClient().sendFindResponse(report, this.formDhtRpcOptions()).catch((_e) => {
|
|
16
|
-
logger.trace('Failed to send
|
|
16
|
+
logger.trace('Failed to send FindResponse');
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
exports.
|
|
21
|
-
//# sourceMappingURL=
|
|
20
|
+
exports.FindSessionRpcRemote = FindSessionRpcRemote;
|
|
21
|
+
//# sourceMappingURL=FindSessionRpcRemote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FindSessionRpcRemote.js","sourceRoot":"","sources":["../../../../src/dht/find/FindSessionRpcRemote.ts"],"names":[],"mappings":";;;AAMA,0CAAuC;AACvC,8CAA0C;AAE1C,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAEjC,MAAa,oBAAqB,SAAQ,eAA6B;IAEnE,gBAAgB,CACZ,WAA6B,EAC7B,YAA8B,EAC9B,WAAwB,EACxB,kBAA2B;QAE3B,MAAM,MAAM,GAAiB;YACzB,WAAW;YACX,qBAAqB,EAAE,YAAY;YACnC,WAAW;YACX,kBAAkB;SACrB,CAAA;QACD,IAAI,CAAC,SAAS,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE;YAC7E,MAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;QAC/C,CAAC,CAAC,CAAA;IACN,CAAC;CACJ;AAlBD,oDAkBC"}
|
|
@@ -1,52 +1,49 @@
|
|
|
1
|
-
import { DataEntry, PeerDescriptor
|
|
1
|
+
import { DataEntry, PeerDescriptor } from '../../proto/packages/dht/protos/DhtRpc';
|
|
2
2
|
import { PeerID, PeerIDKey } from '../../helpers/PeerID';
|
|
3
3
|
import { IRouter } from '../routing/Router';
|
|
4
4
|
import { RoutingRpcCommunicator } from '../../transport/RoutingRpcCommunicator';
|
|
5
|
-
import {
|
|
5
|
+
import { DhtNodeRpcRemote } from '../DhtNodeRpcRemote';
|
|
6
6
|
import { ITransport } from '../../transport/ITransport';
|
|
7
7
|
import { LocalDataStore } from '../store/LocalDataStore';
|
|
8
|
-
import {
|
|
9
|
-
interface
|
|
8
|
+
import { ServiceID } from '../../types/ServiceID';
|
|
9
|
+
interface FinderConfig {
|
|
10
10
|
rpcCommunicator: RoutingRpcCommunicator;
|
|
11
11
|
sessionTransport: ITransport;
|
|
12
|
-
connections: Map<PeerIDKey,
|
|
12
|
+
connections: Map<PeerIDKey, DhtNodeRpcRemote>;
|
|
13
13
|
router: IRouter;
|
|
14
|
-
|
|
15
|
-
serviceId:
|
|
14
|
+
localPeerDescriptor: PeerDescriptor;
|
|
15
|
+
serviceId: ServiceID;
|
|
16
16
|
localDataStore: LocalDataStore;
|
|
17
17
|
addContact: (contact: PeerDescriptor, setActive?: boolean) => void;
|
|
18
18
|
isPeerCloserToIdThanSelf: (peer1: PeerDescriptor, compareToId: PeerID) => boolean;
|
|
19
19
|
}
|
|
20
|
-
interface
|
|
21
|
-
|
|
20
|
+
export interface IFinder {
|
|
21
|
+
startFind(idToFind: Uint8Array, fetchData?: boolean): Promise<FindResult>;
|
|
22
22
|
}
|
|
23
|
-
export interface
|
|
24
|
-
}
|
|
25
|
-
export interface RecursiveFindResult {
|
|
23
|
+
export interface FindResult {
|
|
26
24
|
closestNodes: Array<PeerDescriptor>;
|
|
27
25
|
dataEntries?: Array<DataEntry>;
|
|
28
26
|
}
|
|
29
|
-
export declare class
|
|
27
|
+
export declare class Finder implements IFinder {
|
|
30
28
|
private readonly rpcCommunicator;
|
|
31
29
|
private readonly sessionTransport;
|
|
32
30
|
private readonly connections;
|
|
33
31
|
private readonly router;
|
|
34
|
-
private readonly
|
|
32
|
+
private readonly localPeerDescriptor;
|
|
35
33
|
private readonly serviceId;
|
|
36
34
|
private readonly localDataStore;
|
|
37
|
-
private readonly addContact;
|
|
38
35
|
private readonly isPeerCloserToIdThanSelf;
|
|
39
36
|
private ongoingSessions;
|
|
40
37
|
private stopped;
|
|
41
|
-
constructor(config:
|
|
42
|
-
|
|
38
|
+
constructor(config: FinderConfig);
|
|
39
|
+
private registerLocalRpcMethods;
|
|
40
|
+
startFind(idToFind: Uint8Array, fetchData?: boolean, excludedPeer?: PeerDescriptor): Promise<FindResult>;
|
|
43
41
|
private wrapFindRequest;
|
|
44
42
|
private findAndReportLocalData;
|
|
45
43
|
private findLocalData;
|
|
46
44
|
private sendFindResponse;
|
|
47
|
-
private
|
|
45
|
+
private doRouteFindRequest;
|
|
48
46
|
private getClosestConnections;
|
|
49
|
-
findRecursively(routedMessage: RouteMessageWrapper): Promise<RouteMessageAck>;
|
|
50
47
|
stop(): void;
|
|
51
48
|
}
|
|
52
49
|
export {};
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Finder = void 0;
|
|
4
4
|
const DhtRpc_1 = require("../../proto/packages/dht/protos/DhtRpc");
|
|
5
5
|
const PeerID_1 = require("../../helpers/PeerID");
|
|
6
6
|
const Router_1 = require("../routing/Router");
|
|
7
7
|
const RoutingSession_1 = require("../routing/RoutingSession");
|
|
8
8
|
const peerIdFromPeerDescriptor_1 = require("../../helpers/peerIdFromPeerDescriptor");
|
|
9
9
|
const utils_1 = require("@streamr/utils");
|
|
10
|
-
const
|
|
10
|
+
const FindSessionRpcRemote_1 = require("./FindSessionRpcRemote");
|
|
11
11
|
const uuid_1 = require("uuid");
|
|
12
|
-
const
|
|
12
|
+
const FindSession_1 = require("./FindSession");
|
|
13
13
|
const ListeningRpcCommunicator_1 = require("../../transport/ListeningRpcCommunicator");
|
|
14
14
|
const DhtRpc_client_1 = require("../../proto/packages/dht/protos/DhtRpc.client");
|
|
15
15
|
const proto_rpc_1 = require("@streamr/proto-rpc");
|
|
16
16
|
const SortedContactList_1 = require("../contact/SortedContactList");
|
|
17
|
+
const getPreviousPeer_1 = require("../routing/getPreviousPeer");
|
|
18
|
+
const RouterRpcLocal_1 = require("../routing/RouterRpcLocal");
|
|
19
|
+
const FindRpcLocal_1 = require("./FindRpcLocal");
|
|
17
20
|
const logger = new utils_1.Logger(module);
|
|
18
|
-
class
|
|
21
|
+
class Finder {
|
|
19
22
|
constructor(config) {
|
|
20
23
|
this.ongoingSessions = new Map();
|
|
21
24
|
this.stopped = false;
|
|
@@ -23,43 +26,58 @@ class RecursiveFinder {
|
|
|
23
26
|
this.sessionTransport = config.sessionTransport;
|
|
24
27
|
this.connections = config.connections;
|
|
25
28
|
this.router = config.router;
|
|
26
|
-
this.
|
|
29
|
+
this.localPeerDescriptor = config.localPeerDescriptor;
|
|
27
30
|
this.serviceId = config.serviceId;
|
|
28
31
|
this.localDataStore = config.localDataStore;
|
|
29
|
-
this.addContact = config.addContact;
|
|
30
32
|
this.isPeerCloserToIdThanSelf = config.isPeerCloserToIdThanSelf;
|
|
31
|
-
this.
|
|
33
|
+
this.registerLocalRpcMethods(config);
|
|
32
34
|
}
|
|
33
|
-
|
|
35
|
+
registerLocalRpcMethods(config) {
|
|
36
|
+
const rpcLocal = new FindRpcLocal_1.FindRpcLocal({
|
|
37
|
+
doRouteFindRequest: (routedMessage) => this.doRouteFindRequest(routedMessage),
|
|
38
|
+
addContact: (contact, setActive) => config.addContact(contact, setActive),
|
|
39
|
+
isMostLikelyDuplicate: (requestId) => this.router.isMostLikelyDuplicate(requestId),
|
|
40
|
+
addToDuplicateDetector: (requestId) => this.router.addToDuplicateDetector(requestId)
|
|
41
|
+
});
|
|
42
|
+
this.rpcCommunicator.registerRpcMethod(DhtRpc_1.RouteMessageWrapper, DhtRpc_1.RouteMessageAck, 'routeFindRequest', async (routedMessage) => {
|
|
43
|
+
if (this.stopped) {
|
|
44
|
+
return (0, RouterRpcLocal_1.createRouteMessageAck)(routedMessage, 'routeFindRequest() service is not running');
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return rpcLocal.routeFindRequest(routedMessage);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
async startFind(idToFind, fetchData = false, excludedPeer) {
|
|
34
52
|
if (this.stopped) {
|
|
35
53
|
return { closestNodes: [] };
|
|
36
54
|
}
|
|
37
55
|
const sessionId = (0, uuid_1.v4)();
|
|
38
|
-
const
|
|
56
|
+
const session = new FindSession_1.FindSession({
|
|
39
57
|
serviceId: sessionId,
|
|
40
58
|
transport: this.sessionTransport,
|
|
41
59
|
kademliaIdToFind: idToFind,
|
|
42
|
-
|
|
60
|
+
localPeerId: (0, peerIdFromPeerDescriptor_1.peerIdFromPeerDescriptor)(this.localPeerDescriptor),
|
|
43
61
|
waitedRoutingPathCompletions: this.connections.size > 1 ? 2 : 1,
|
|
44
62
|
fetchData
|
|
45
63
|
});
|
|
46
64
|
if (this.connections.size === 0) {
|
|
47
65
|
const data = this.localDataStore.getEntry(PeerID_1.PeerID.fromValue(idToFind));
|
|
48
|
-
|
|
49
|
-
return
|
|
66
|
+
session.doSendFindResponse([this.localPeerDescriptor], [this.localPeerDescriptor], data ? Array.from(data.values()) : [], true);
|
|
67
|
+
return session.getResults();
|
|
50
68
|
}
|
|
51
69
|
const routeMessage = this.wrapFindRequest(idToFind, sessionId, fetchData);
|
|
52
|
-
this.ongoingSessions.set(sessionId,
|
|
70
|
+
this.ongoingSessions.set(sessionId, session);
|
|
53
71
|
try {
|
|
54
|
-
await (0, utils_1.runAndWaitForEvents3)([() => this.
|
|
72
|
+
await (0, utils_1.runAndWaitForEvents3)([() => this.doRouteFindRequest(routeMessage, excludedPeer)], [[session, 'findCompleted']], 15000);
|
|
55
73
|
}
|
|
56
74
|
catch (err) {
|
|
57
|
-
logger.debug(`
|
|
75
|
+
logger.debug(`doRouteFindRequest failed with error ${err}`);
|
|
58
76
|
}
|
|
59
|
-
this.findAndReportLocalData(idToFind, fetchData, [], this.
|
|
77
|
+
this.findAndReportLocalData(idToFind, fetchData, [], this.localPeerDescriptor, sessionId);
|
|
60
78
|
this.ongoingSessions.delete(sessionId);
|
|
61
|
-
|
|
62
|
-
return
|
|
79
|
+
session.stop();
|
|
80
|
+
return session.getResults();
|
|
63
81
|
}
|
|
64
82
|
wrapFindRequest(idToFind, sessionId, fetchData) {
|
|
65
83
|
const targetDescriptor = {
|
|
@@ -71,7 +89,7 @@ class RecursiveFinder {
|
|
|
71
89
|
fetchData
|
|
72
90
|
};
|
|
73
91
|
const msg = {
|
|
74
|
-
messageType: DhtRpc_1.MessageType.
|
|
92
|
+
messageType: DhtRpc_1.MessageType.FIND_REQUEST,
|
|
75
93
|
messageId: (0, uuid_1.v4)(),
|
|
76
94
|
serviceId: this.serviceId,
|
|
77
95
|
body: {
|
|
@@ -83,7 +101,7 @@ class RecursiveFinder {
|
|
|
83
101
|
message: msg,
|
|
84
102
|
requestId: (0, uuid_1.v4)(),
|
|
85
103
|
destinationPeer: targetDescriptor,
|
|
86
|
-
sourcePeer: this.
|
|
104
|
+
sourcePeer: this.localPeerDescriptor,
|
|
87
105
|
reachableThrough: [],
|
|
88
106
|
routingPath: []
|
|
89
107
|
};
|
|
@@ -107,34 +125,34 @@ class RecursiveFinder {
|
|
|
107
125
|
}
|
|
108
126
|
sendFindResponse(routingPath, targetPeerDescriptor, serviceId, closestNodes, data, noCloserNodesFound = false) {
|
|
109
127
|
const dataEntries = data ? Array.from(data.values(), DhtRpc_1.DataEntry.create.bind(DhtRpc_1.DataEntry)) : [];
|
|
110
|
-
const isOwnNode = (0, peerIdFromPeerDescriptor_1.areEqualPeerDescriptors)(this.
|
|
128
|
+
const isOwnNode = (0, peerIdFromPeerDescriptor_1.areEqualPeerDescriptors)(this.localPeerDescriptor, targetPeerDescriptor);
|
|
111
129
|
if (isOwnNode && this.ongoingSessions.has(serviceId)) {
|
|
112
130
|
this.ongoingSessions.get(serviceId)
|
|
113
131
|
.doSendFindResponse(routingPath, closestNodes, dataEntries, noCloserNodesFound);
|
|
114
132
|
}
|
|
115
133
|
else {
|
|
116
134
|
const remoteCommunicator = new ListeningRpcCommunicator_1.ListeningRpcCommunicator(serviceId, this.sessionTransport, { rpcRequestTimeout: 15000 });
|
|
117
|
-
const
|
|
118
|
-
|
|
135
|
+
const rpcRemote = new FindSessionRpcRemote_1.FindSessionRpcRemote(this.localPeerDescriptor, targetPeerDescriptor, serviceId, (0, proto_rpc_1.toProtoRpcClient)(new DhtRpc_client_1.FindSessionRpcClient(remoteCommunicator.getRpcClientTransport())), 10000);
|
|
136
|
+
rpcRemote.sendFindResponse(routingPath, closestNodes, dataEntries, noCloserNodesFound);
|
|
119
137
|
remoteCommunicator.destroy();
|
|
120
138
|
}
|
|
121
139
|
}
|
|
122
|
-
|
|
140
|
+
doRouteFindRequest(routedMessage, excludedPeer) {
|
|
123
141
|
if (this.stopped) {
|
|
124
|
-
return (0,
|
|
142
|
+
return (0, RouterRpcLocal_1.createRouteMessageAck)(routedMessage, 'DhtNode Stopped');
|
|
125
143
|
}
|
|
126
144
|
const idToFind = (0, peerIdFromPeerDescriptor_1.peerIdFromPeerDescriptor)(routedMessage.destinationPeer);
|
|
127
145
|
const msg = routedMessage.message;
|
|
128
146
|
const findRequest = msg?.body.oneofKind === 'findRequest' ? msg.body.findRequest : undefined;
|
|
129
147
|
const closestPeersToDestination = this.getClosestConnections(routedMessage.destinationPeer.kademliaId, 5);
|
|
130
148
|
const data = this.findLocalData(idToFind.value, findRequest.fetchData);
|
|
131
|
-
if ((0, peerIdFromPeerDescriptor_1.areEqualPeerDescriptors)(this.
|
|
149
|
+
if ((0, peerIdFromPeerDescriptor_1.areEqualPeerDescriptors)(this.localPeerDescriptor, routedMessage.destinationPeer)) {
|
|
132
150
|
this.sendFindResponse(routedMessage.routingPath, routedMessage.sourcePeer, findRequest.sessionId, closestPeersToDestination, data, true);
|
|
133
|
-
return (0,
|
|
151
|
+
return (0, RouterRpcLocal_1.createRouteMessageAck)(routedMessage);
|
|
134
152
|
}
|
|
135
|
-
const ack = this.router.doRouteMessage(routedMessage, RoutingSession_1.RoutingMode.
|
|
153
|
+
const ack = this.router.doRouteMessage(routedMessage, RoutingSession_1.RoutingMode.FIND, excludedPeer);
|
|
136
154
|
if (ack.error === Router_1.RoutingErrors.NO_CANDIDATES_FOUND) {
|
|
137
|
-
logger.trace(`
|
|
155
|
+
logger.trace(`routeFindRequest Node found no candidates`);
|
|
138
156
|
this.sendFindResponse(routedMessage.routingPath, routedMessage.sourcePeer, findRequest.sessionId, closestPeersToDestination, data, true);
|
|
139
157
|
}
|
|
140
158
|
else if (ack.error) {
|
|
@@ -142,7 +160,7 @@ class RecursiveFinder {
|
|
|
142
160
|
}
|
|
143
161
|
else {
|
|
144
162
|
const noCloserContactsFound = (closestPeersToDestination.length > 0
|
|
145
|
-
&& routedMessage
|
|
163
|
+
&& (0, getPreviousPeer_1.getPreviousPeer)(routedMessage)
|
|
146
164
|
&& !this.isPeerCloserToIdThanSelf(closestPeersToDestination[0], idToFind));
|
|
147
165
|
this.sendFindResponse(routedMessage.routingPath, routedMessage.sourcePeer, findRequest.sessionId, closestPeersToDestination, data, noCloserContactsFound);
|
|
148
166
|
}
|
|
@@ -154,20 +172,6 @@ class RecursiveFinder {
|
|
|
154
172
|
closestPeers.addContacts(connectedPeers);
|
|
155
173
|
return closestPeers.getClosestContacts(limit).map((peer) => peer.getPeerDescriptor());
|
|
156
174
|
}
|
|
157
|
-
// IRouterRpc method
|
|
158
|
-
async findRecursively(routedMessage) {
|
|
159
|
-
if (this.stopped) {
|
|
160
|
-
return (0, Router_1.createRouteMessageAck)(routedMessage, 'findRecursively() service is not running');
|
|
161
|
-
}
|
|
162
|
-
else if (this.router.isMostLikelyDuplicate(routedMessage.requestId)) {
|
|
163
|
-
return (0, Router_1.createRouteMessageAck)(routedMessage, 'message given to findRecursively() service is likely a duplicate');
|
|
164
|
-
}
|
|
165
|
-
const senderKey = (0, peerIdFromPeerDescriptor_1.keyFromPeerDescriptor)(routedMessage.previousPeer || routedMessage.sourcePeer);
|
|
166
|
-
logger.trace(`Received findRecursively call from ${senderKey}`);
|
|
167
|
-
this.addContact(routedMessage.sourcePeer, true);
|
|
168
|
-
this.router.addToDuplicateDetector(routedMessage.requestId);
|
|
169
|
-
return this.doFindRecursevily(routedMessage);
|
|
170
|
-
}
|
|
171
175
|
stop() {
|
|
172
176
|
this.stopped = true;
|
|
173
177
|
this.ongoingSessions.forEach((session, _id) => {
|
|
@@ -176,5 +180,5 @@ class RecursiveFinder {
|
|
|
176
180
|
this.ongoingSessions.clear();
|
|
177
181
|
}
|
|
178
182
|
}
|
|
179
|
-
exports.
|
|
180
|
-
//# sourceMappingURL=
|
|
183
|
+
exports.Finder = Finder;
|
|
184
|
+
//# sourceMappingURL=Finder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Finder.js","s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IFindRpcClient } from '../../proto/packages/dht/protos/DhtRpc.client';
|
|
4
|
+
export declare class FindRpcRemote extends Remote<IFindRpcClient> {
|
|
5
|
+
routeFindRequest(params: RouteMessageWrapper): Promise<boolean>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindRpcRemote = void 0;
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
const peerIdFromPeerDescriptor_1 = require("../../helpers/peerIdFromPeerDescriptor");
|
|
6
|
+
const Remote_1 = require("../contact/Remote");
|
|
7
|
+
const utils_1 = require("@streamr/utils");
|
|
8
|
+
const getPreviousPeer_1 = require("./getPreviousPeer");
|
|
9
|
+
const logger = new utils_1.Logger(module);
|
|
10
|
+
class FindRpcRemote extends Remote_1.Remote {
|
|
11
|
+
async routeFindRequest(params) {
|
|
12
|
+
const message = {
|
|
13
|
+
destinationPeer: params.destinationPeer,
|
|
14
|
+
sourcePeer: params.sourcePeer,
|
|
15
|
+
message: params.message,
|
|
16
|
+
requestId: params.requestId ?? (0, uuid_1.v4)(),
|
|
17
|
+
reachableThrough: params.reachableThrough ?? [],
|
|
18
|
+
routingPath: params.routingPath
|
|
19
|
+
};
|
|
20
|
+
const options = this.formDhtRpcOptions();
|
|
21
|
+
try {
|
|
22
|
+
const ack = await this.getClient().routeFindRequest(message, options);
|
|
23
|
+
if (ack.error.length > 0) {
|
|
24
|
+
logger.debug('Next hop responded with error ' + ack.error);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
const previousPeer = (0, getPreviousPeer_1.getPreviousPeer)(params);
|
|
30
|
+
const fromNode = previousPeer
|
|
31
|
+
? (0, peerIdFromPeerDescriptor_1.keyFromPeerDescriptor)(previousPeer)
|
|
32
|
+
: (0, peerIdFromPeerDescriptor_1.keyFromPeerDescriptor)(params.sourcePeer);
|
|
33
|
+
// eslint-disable-next-line max-len
|
|
34
|
+
logger.debug(`Failed to send routeFindRequest message from ${fromNode} to ${(0, peerIdFromPeerDescriptor_1.keyFromPeerDescriptor)(this.getPeerDescriptor())} with: ${err}`);
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.FindRpcRemote = FindRpcRemote;
|
|
41
|
+
//# sourceMappingURL=FindRpcRemote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FindRpcRemote.js","sourceRoot":"","sources":["../../../../src/dht/routing/FindRpcRemote.ts"],"names":[],"mappings":";;;AACA,+BAAyB;AACzB,qFAA8E;AAC9E,8CAA0C;AAC1C,0CAAuC;AAEvC,uDAAmD;AAEnD,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAEjC,MAAa,aAAc,SAAQ,eAAsB;IAErD,KAAK,CAAC,gBAAgB,CAAC,MAA2B;QAC9C,MAAM,OAAO,GAAwB;YACjC,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,IAAA,SAAE,GAAE;YACnC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,IAAI,EAAE;YAC/C,WAAW,EAAE,MAAM,CAAC,WAAW;SAClC,CAAA;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;QACxC,IAAI;YACA,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YACrE,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;gBACtB,MAAM,CAAC,KAAK,CAAC,gCAAgC,GAAG,GAAG,CAAC,KAAK,C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