@streamr/dht 100.0.0-testnet-one.4 → 100.0.0-testnet-two.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/dist/package.json +66 -0
  2. package/dist/src/connection/ConnectionLockHandler.d.ts +11 -11
  3. package/dist/src/connection/ConnectionLockHandler.js.map +1 -1
  4. package/dist/src/connection/ConnectionLockRpcLocal.d.ts +3 -3
  5. package/dist/src/connection/ConnectionLockRpcLocal.js +4 -4
  6. package/dist/src/connection/ConnectionLockRpcLocal.js.map +1 -1
  7. package/dist/src/connection/ConnectionLockRpcRemote.d.ts +3 -5
  8. package/dist/src/connection/ConnectionLockRpcRemote.js +4 -7
  9. package/dist/src/connection/ConnectionLockRpcRemote.js.map +1 -1
  10. package/dist/src/connection/ConnectionManager.d.ts +4 -6
  11. package/dist/src/connection/ConnectionManager.js +48 -46
  12. package/dist/src/connection/ConnectionManager.js.map +1 -1
  13. package/dist/src/connection/ConnectorFacade.d.ts +2 -2
  14. package/dist/src/connection/ConnectorFacade.js +2 -1
  15. package/dist/src/connection/ConnectorFacade.js.map +1 -1
  16. package/dist/src/connection/Handshaker.d.ts +1 -1
  17. package/dist/src/connection/Handshaker.js +14 -5
  18. package/dist/src/connection/Handshaker.js.map +1 -1
  19. package/dist/src/connection/ManagedConnection.d.ts +4 -7
  20. package/dist/src/connection/ManagedConnection.js +9 -13
  21. package/dist/src/connection/ManagedConnection.js.map +1 -1
  22. package/dist/src/connection/connectivityChecker.js +1 -0
  23. package/dist/src/connection/connectivityChecker.js.map +1 -1
  24. package/dist/src/connection/simulator/Simulator.d.ts +0 -3
  25. package/dist/src/connection/simulator/Simulator.js +3 -51
  26. package/dist/src/connection/simulator/Simulator.js.map +1 -1
  27. package/dist/src/connection/simulator/SimulatorConnector.js +5 -5
  28. package/dist/src/connection/simulator/SimulatorConnector.js.map +1 -1
  29. package/dist/src/connection/webrtc/NodeWebrtcConnection.js +2 -2
  30. package/dist/src/connection/webrtc/NodeWebrtcConnection.js.map +1 -1
  31. package/dist/src/connection/webrtc/WebrtcConnector.d.ts +0 -1
  32. package/dist/src/connection/webrtc/WebrtcConnector.js +7 -9
  33. package/dist/src/connection/webrtc/WebrtcConnector.js.map +1 -1
  34. package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.d.ts +2 -2
  35. package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js +21 -14
  36. package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js.map +1 -1
  37. package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.d.ts +2 -5
  38. package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js +1 -4
  39. package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js.map +1 -1
  40. package/dist/src/connection/websocket/AutoCertifierClientFacade.d.ts +1 -2
  41. package/dist/src/connection/websocket/AutoCertifierClientFacade.js +3 -4
  42. package/dist/src/connection/websocket/AutoCertifierClientFacade.js.map +1 -1
  43. package/dist/src/connection/websocket/ClientWebsocket.js.map +1 -1
  44. package/dist/src/connection/websocket/WebsocketConnector.d.ts +2 -7
  45. package/dist/src/connection/websocket/WebsocketConnector.js +48 -44
  46. package/dist/src/connection/websocket/WebsocketConnector.js.map +1 -1
  47. package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.d.ts +3 -2
  48. package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js +8 -10
  49. package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js.map +1 -1
  50. package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.d.ts +3 -6
  51. package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.js +0 -3
  52. package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.js.map +1 -1
  53. package/dist/src/connection/websocket/WebsocketServer.d.ts +1 -4
  54. package/dist/src/connection/websocket/WebsocketServer.js +11 -12
  55. package/dist/src/connection/websocket/WebsocketServer.js.map +1 -1
  56. package/dist/src/dht/DhtNode.d.ts +10 -13
  57. package/dist/src/dht/DhtNode.js +41 -54
  58. package/dist/src/dht/DhtNode.js.map +1 -1
  59. package/dist/src/dht/DhtNodeRpcLocal.d.ts +2 -3
  60. package/dist/src/dht/DhtNodeRpcLocal.js +1 -1
  61. package/dist/src/dht/DhtNodeRpcLocal.js.map +1 -1
  62. package/dist/src/dht/DhtNodeRpcRemote.d.ts +7 -7
  63. package/dist/src/dht/DhtNodeRpcRemote.js +9 -11
  64. package/dist/src/dht/DhtNodeRpcRemote.js.map +1 -1
  65. package/dist/src/dht/ExternalApiRpcLocal.d.ts +5 -4
  66. package/dist/src/dht/ExternalApiRpcLocal.js +3 -2
  67. package/dist/src/dht/ExternalApiRpcLocal.js.map +1 -1
  68. package/dist/src/dht/ExternalApiRpcRemote.d.ts +2 -2
  69. package/dist/src/dht/ExternalApiRpcRemote.js +2 -0
  70. package/dist/src/dht/ExternalApiRpcRemote.js.map +1 -1
  71. package/dist/src/dht/PeerManager.d.ts +13 -14
  72. package/dist/src/dht/PeerManager.js +45 -60
  73. package/dist/src/dht/PeerManager.js.map +1 -1
  74. package/dist/src/dht/contact/Contact.d.ts +2 -2
  75. package/dist/src/dht/contact/Contact.js +2 -2
  76. package/dist/src/dht/contact/Contact.js.map +1 -1
  77. package/dist/src/dht/contact/ContactList.d.ts +7 -7
  78. package/dist/src/dht/contact/ContactList.js +3 -3
  79. package/dist/src/dht/contact/ContactList.js.map +1 -1
  80. package/dist/src/dht/contact/RandomContactList.d.ts +4 -4
  81. package/dist/src/dht/contact/RandomContactList.js +12 -11
  82. package/dist/src/dht/contact/RandomContactList.js.map +1 -1
  83. package/dist/src/dht/contact/RpcRemote.d.ts +7 -4
  84. package/dist/src/dht/contact/RpcRemote.js +5 -2
  85. package/dist/src/dht/contact/RpcRemote.js.map +1 -1
  86. package/dist/src/dht/contact/SortedContactList.d.ts +13 -13
  87. package/dist/src/dht/contact/SortedContactList.js +33 -29
  88. package/dist/src/dht/contact/SortedContactList.js.map +1 -1
  89. package/dist/src/dht/discovery/DiscoverySession.d.ts +2 -4
  90. package/dist/src/dht/discovery/DiscoverySession.js +19 -23
  91. package/dist/src/dht/discovery/DiscoverySession.js.map +1 -1
  92. package/dist/src/dht/discovery/PeerDiscovery.d.ts +2 -5
  93. package/dist/src/dht/discovery/PeerDiscovery.js +12 -20
  94. package/dist/src/dht/discovery/PeerDiscovery.js.map +1 -1
  95. package/dist/src/dht/recursive-operation/RecursiveOperationManager.d.ts +36 -0
  96. package/dist/src/dht/recursive-operation/RecursiveOperationManager.js +165 -0
  97. package/dist/src/dht/recursive-operation/RecursiveOperationManager.js.map +1 -0
  98. package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.d.ts +14 -0
  99. package/dist/src/dht/{find/FindRpcLocal.js → recursive-operation/RecursiveOperationRpcLocal.js} +7 -7
  100. package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js.map +1 -0
  101. package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.d.ts +6 -0
  102. package/dist/src/dht/{routing/FindRpcRemote.js → recursive-operation/RecursiveOperationRpcRemote.js} +11 -11
  103. package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js.map +1 -0
  104. package/dist/src/dht/recursive-operation/RecursiveOperationSession.d.ts +42 -0
  105. package/dist/src/dht/recursive-operation/RecursiveOperationSession.js +182 -0
  106. package/dist/src/dht/recursive-operation/RecursiveOperationSession.js.map +1 -0
  107. package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.d.ts +12 -0
  108. package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js +17 -0
  109. package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js.map +1 -0
  110. package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.d.ts +6 -0
  111. package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js +21 -0
  112. package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js.map +1 -0
  113. package/dist/src/dht/routing/Router.d.ts +4 -19
  114. package/dist/src/dht/routing/Router.js +41 -33
  115. package/dist/src/dht/routing/Router.js.map +1 -1
  116. package/dist/src/dht/routing/RouterRpcLocal.js +6 -5
  117. package/dist/src/dht/routing/RouterRpcLocal.js.map +1 -1
  118. package/dist/src/dht/routing/RouterRpcRemote.d.ts +2 -2
  119. package/dist/src/dht/routing/RouterRpcRemote.js +7 -7
  120. package/dist/src/dht/routing/RouterRpcRemote.js.map +1 -1
  121. package/dist/src/dht/routing/RoutingSession.d.ts +20 -16
  122. package/dist/src/dht/routing/RoutingSession.js +37 -45
  123. package/dist/src/dht/routing/RoutingSession.js.map +1 -1
  124. package/dist/src/dht/store/LocalDataStore.d.ts +11 -13
  125. package/dist/src/dht/store/LocalDataStore.js +36 -56
  126. package/dist/src/dht/store/LocalDataStore.js.map +1 -1
  127. package/dist/src/dht/store/StoreManager.d.ts +33 -0
  128. package/dist/src/dht/store/StoreManager.js +186 -0
  129. package/dist/src/dht/store/StoreManager.js.map +1 -0
  130. package/dist/src/dht/store/StoreRpcLocal.d.ts +8 -40
  131. package/dist/src/dht/store/StoreRpcLocal.js +13 -229
  132. package/dist/src/dht/store/StoreRpcLocal.js.map +1 -1
  133. package/dist/src/dht/store/StoreRpcRemote.d.ts +5 -5
  134. package/dist/src/dht/store/StoreRpcRemote.js +4 -5
  135. package/dist/src/dht/store/StoreRpcRemote.js.map +1 -1
  136. package/dist/src/exports.d.ts +2 -0
  137. package/dist/src/exports.js.map +1 -1
  138. package/dist/src/helpers/MapWithTtl.d.ts +14 -0
  139. package/dist/src/helpers/MapWithTtl.js +59 -0
  140. package/dist/src/helpers/MapWithTtl.js.map +1 -0
  141. package/dist/src/helpers/PeerID.d.ts +2 -0
  142. package/dist/src/helpers/PeerID.js +4 -0
  143. package/dist/src/helpers/PeerID.js.map +1 -1
  144. package/dist/src/helpers/nodeId.d.ts +5 -0
  145. package/dist/src/helpers/nodeId.js +18 -1
  146. package/dist/src/helpers/nodeId.js.map +1 -1
  147. package/dist/src/helpers/peerIdFromPeerDescriptor.d.ts +2 -1
  148. package/dist/src/helpers/peerIdFromPeerDescriptor.js +2 -1
  149. package/dist/src/helpers/peerIdFromPeerDescriptor.js.map +1 -1
  150. package/dist/src/helpers/protoClasses.js +2 -3
  151. package/dist/src/helpers/protoClasses.js.map +1 -1
  152. package/dist/src/helpers/versionCompatibility.d.ts +2 -0
  153. package/dist/src/helpers/versionCompatibility.js +18 -0
  154. package/dist/src/helpers/versionCompatibility.js.map +1 -0
  155. package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +21 -22
  156. package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +18 -18
  157. package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
  158. package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +49 -65
  159. package/dist/src/proto/packages/dht/protos/DhtRpc.js +43 -58
  160. package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
  161. package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +11 -12
  162. package/dist/src/rpc-protocol/DhtCallContext.d.ts +2 -1
  163. package/dist/src/rpc-protocol/DhtCallContext.js.map +1 -1
  164. package/dist/src/rpc-protocol/DhtRpcOptions.d.ts +2 -1
  165. package/dist/src/transport/ITransport.d.ts +9 -1
  166. package/dist/src/transport/ITransport.js +5 -0
  167. package/dist/src/transport/ITransport.js.map +1 -1
  168. package/dist/src/transport/ListeningRpcCommunicator.js +1 -1
  169. package/dist/src/transport/ListeningRpcCommunicator.js.map +1 -1
  170. package/dist/src/transport/RoutingRpcCommunicator.d.ts +2 -1
  171. package/dist/src/transport/RoutingRpcCommunicator.js +16 -11
  172. package/dist/src/transport/RoutingRpcCommunicator.js.map +1 -1
  173. package/jest.config.js +4 -1
  174. package/karma-setup.js +2 -0
  175. package/karma.config.js +11 -7
  176. package/package.json +6 -7
  177. package/protos/DhtRpc.proto +20 -24
  178. package/src/connection/ConnectionLockHandler.ts +15 -15
  179. package/src/connection/ConnectionLockRpcLocal.ts +8 -9
  180. package/src/connection/ConnectionLockRpcRemote.ts +7 -16
  181. package/src/connection/ConnectionManager.ts +58 -55
  182. package/src/connection/ConnectorFacade.ts +3 -0
  183. package/src/connection/Handshaker.ts +21 -6
  184. package/src/connection/ManagedConnection.ts +20 -34
  185. package/src/connection/connectivityChecker.ts +1 -0
  186. package/src/connection/simulator/Simulator.ts +5 -36
  187. package/src/connection/simulator/SimulatorConnector.ts +8 -8
  188. package/src/connection/webrtc/BrowserWebrtcConnection.ts +0 -3
  189. package/src/connection/webrtc/NodeWebrtcConnection.ts +3 -4
  190. package/src/connection/webrtc/WebrtcConnector.ts +11 -13
  191. package/src/connection/webrtc/WebrtcConnectorRpcLocal.ts +25 -18
  192. package/src/connection/webrtc/WebrtcConnectorRpcRemote.ts +3 -13
  193. package/src/connection/websocket/AutoCertifierClientFacade.ts +4 -6
  194. package/src/connection/websocket/ClientWebsocket.ts +1 -0
  195. package/src/connection/websocket/WebsocketConnector.ts +57 -61
  196. package/src/connection/websocket/WebsocketConnectorRpcLocal.ts +11 -13
  197. package/src/connection/websocket/WebsocketConnectorRpcRemote.ts +4 -15
  198. package/src/connection/websocket/WebsocketServer.ts +14 -17
  199. package/src/dht/DhtNode.ts +69 -71
  200. package/src/dht/DhtNodeRpcLocal.ts +1 -3
  201. package/src/dht/DhtNodeRpcRemote.ts +14 -18
  202. package/src/dht/ExternalApiRpcLocal.ts +16 -6
  203. package/src/dht/ExternalApiRpcRemote.ts +5 -3
  204. package/src/dht/PeerManager.ts +73 -90
  205. package/src/dht/contact/Contact.ts +5 -4
  206. package/src/dht/contact/ContactList.ts +9 -9
  207. package/src/dht/contact/RandomContactList.ts +14 -14
  208. package/src/dht/contact/RpcRemote.ts +10 -7
  209. package/src/dht/contact/SortedContactList.ts +48 -45
  210. package/src/dht/discovery/DiscoverySession.ts +25 -27
  211. package/src/dht/discovery/PeerDiscovery.ts +16 -37
  212. package/src/dht/recursive-operation/RecursiveOperationManager.ts +240 -0
  213. package/src/dht/{find/FindRpcLocal.ts → recursive-operation/RecursiveOperationRpcLocal.ts} +9 -9
  214. package/src/dht/{routing/FindRpcRemote.ts → recursive-operation/RecursiveOperationRpcRemote.ts} +10 -10
  215. package/src/dht/recursive-operation/RecursiveOperationSession.ts +224 -0
  216. package/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.ts +25 -0
  217. package/src/dht/{find/FindSessionRpcRemote.ts → recursive-operation/RecursiveOperationSessionRpcRemote.ts} +8 -8
  218. package/src/dht/routing/Router.ts +45 -64
  219. package/src/dht/routing/RouterRpcLocal.ts +7 -6
  220. package/src/dht/routing/RouterRpcRemote.ts +9 -10
  221. package/src/dht/routing/RoutingSession.ts +59 -68
  222. package/src/dht/store/LocalDataStore.ts +47 -66
  223. package/src/dht/store/StoreManager.ts +217 -0
  224. package/src/dht/store/StoreRpcLocal.ts +26 -302
  225. package/src/dht/store/StoreRpcRemote.ts +9 -11
  226. package/src/exports.ts +2 -0
  227. package/src/helpers/MapWithTtl.ts +71 -0
  228. package/src/helpers/PeerID.ts +5 -0
  229. package/src/helpers/nodeId.ts +20 -0
  230. package/src/helpers/peerIdFromPeerDescriptor.ts +5 -3
  231. package/src/helpers/protoClasses.ts +4 -6
  232. package/src/helpers/versionCompatibility.ts +13 -0
  233. package/src/proto/packages/dht/protos/DhtRpc.client.ts +31 -32
  234. package/src/proto/packages/dht/protos/DhtRpc.server.ts +11 -12
  235. package/src/proto/packages/dht/protos/DhtRpc.ts +67 -90
  236. package/src/rpc-protocol/DhtCallContext.ts +2 -1
  237. package/src/rpc-protocol/DhtRpcOptions.ts +2 -1
  238. package/src/transport/ITransport.ts +10 -1
  239. package/src/transport/ListeningRpcCommunicator.ts +1 -1
  240. package/src/transport/RoutingRpcCommunicator.ts +18 -12
  241. package/test/benchmark/Find.test.ts +8 -21
  242. package/test/benchmark/KademliaCorrectness.test.ts +11 -20
  243. package/test/benchmark/SortedContactListBenchmark.test.ts +9 -9
  244. package/test/benchmark/kademlia-simulation/Contact.ts +9 -8
  245. package/test/benchmark/kademlia-simulation/KademliaSimulation.ts +2 -2
  246. package/test/benchmark/kademlia-simulation/SimulationNode.ts +17 -17
  247. package/test/end-to-end/Layer0-Layer1.test.ts +10 -14
  248. package/test/end-to-end/Layer0.test.ts +15 -18
  249. package/test/end-to-end/Layer0MixedConnectionTypes.test.ts +7 -9
  250. package/test/end-to-end/Layer0Webrtc-Layer1.test.ts +4 -10
  251. package/test/end-to-end/Layer0Webrtc.test.ts +5 -6
  252. package/test/end-to-end/Layer1-Scale-WebSocket.test.ts +8 -16
  253. package/test/end-to-end/Layer1-Scale-Webrtc.test.ts +6 -13
  254. package/test/end-to-end/WebsocketConnectionRequest.test.ts +5 -6
  255. package/test/end-to-end/memory-leak.test.ts +6 -8
  256. package/test/integration/ConnectionLocking.test.ts +6 -13
  257. package/test/integration/ConnectionManager.test.ts +26 -43
  258. package/test/integration/DhtJoinPeerDiscovery.test.ts +5 -10
  259. package/test/integration/DhtNodeExternalAPI.test.ts +16 -22
  260. package/test/integration/DhtNodeRpcRemote.test.ts +13 -22
  261. package/test/integration/DhtRpc.test.ts +13 -18
  262. package/test/integration/Find.test.ts +10 -10
  263. package/test/integration/Layer1-scale.test.ts +17 -28
  264. package/test/integration/Mock-Layer1-Layer0.test.ts +25 -43
  265. package/test/integration/MultipleEntryPointJoining.test.ts +7 -7
  266. package/test/integration/ReplicateData.test.ts +28 -30
  267. package/test/integration/RouteMessage.test.ts +30 -27
  268. package/test/integration/RouterRpcRemote.test.ts +12 -18
  269. package/test/integration/RpcErrors.test.ts +8 -21
  270. package/test/integration/ScaleDownDht.test.ts +11 -10
  271. package/test/integration/SimultaneousConnections.test.ts +43 -67
  272. package/test/integration/Store.test.ts +23 -36
  273. package/test/integration/StoreAndDelete.test.ts +30 -50
  274. package/test/integration/StoreOnDhtWithTwoNodes.test.ts +16 -37
  275. package/test/integration/StoreRpcRemote.test.ts +20 -30
  276. package/test/integration/WebrtcConnectionManagement.test.ts +3 -13
  277. package/test/integration/WebrtcConnectorRpc.test.ts +3 -9
  278. package/test/integration/WebsocketConnectionManagement.test.ts +7 -10
  279. package/test/integration/WebsocketConnectorRpc.test.ts +8 -17
  280. package/test/unit/ConnectivityHelpers.test.ts +9 -17
  281. package/test/unit/DuplicateDetector.test.ts +7 -4
  282. package/test/unit/LocalDataStore.test.ts +66 -77
  283. package/test/unit/PeerManager.test.ts +31 -0
  284. package/test/unit/RandomContactList.test.ts +13 -8
  285. package/test/unit/{Finder.test.ts → RecursiveOperationManager.test.ts} +38 -43
  286. package/test/unit/RecursiveOperationSession.test.ts +68 -0
  287. package/test/unit/Router.test.ts +15 -22
  288. package/test/unit/RoutingSession.test.ts +23 -25
  289. package/test/unit/SortedContactList.test.ts +41 -26
  290. package/test/unit/StoreManager.test.ts +132 -0
  291. package/test/unit/WebsocketConnector.test.ts +27 -35
  292. package/test/unit/customMatchers.test.ts +16 -0
  293. package/test/unit/versionCompatibility.test.ts +16 -0
  294. package/test/utils/FakeTransport.ts +44 -0
  295. package/test/utils/customMatchers.ts +70 -0
  296. package/test/utils/mock/MockRpcCommunicator.ts +7 -0
  297. package/test/utils/mock/Router.ts +3 -2
  298. package/test/utils/mock/mockDataEntry.ts +36 -0
  299. package/test/utils/utils.ts +49 -87
  300. package/tsconfig.browser.json +2 -1
  301. package/tsconfig.jest.json +2 -1
  302. package/tsconfig.node.json +2 -1
  303. package/dist/src/dht/find/FindRpcLocal.d.ts +0 -14
  304. package/dist/src/dht/find/FindRpcLocal.js.map +0 -1
  305. package/dist/src/dht/find/FindSession.d.ts +0 -44
  306. package/dist/src/dht/find/FindSession.js +0 -150
  307. package/dist/src/dht/find/FindSession.js.map +0 -1
  308. package/dist/src/dht/find/FindSessionRpcLocal.d.ts +0 -12
  309. package/dist/src/dht/find/FindSessionRpcLocal.js +0 -17
  310. package/dist/src/dht/find/FindSessionRpcLocal.js.map +0 -1
  311. package/dist/src/dht/find/FindSessionRpcRemote.d.ts +0 -6
  312. package/dist/src/dht/find/FindSessionRpcRemote.js +0 -21
  313. package/dist/src/dht/find/FindSessionRpcRemote.js.map +0 -1
  314. package/dist/src/dht/find/Finder.d.ts +0 -49
  315. package/dist/src/dht/find/Finder.js +0 -197
  316. package/dist/src/dht/find/Finder.js.map +0 -1
  317. package/dist/src/dht/routing/FindRpcRemote.d.ts +0 -6
  318. package/dist/src/dht/routing/FindRpcRemote.js.map +0 -1
  319. package/src/dht/find/FindSession.ts +0 -183
  320. package/src/dht/find/FindSessionRpcLocal.ts +0 -25
  321. package/src/dht/find/Finder.ts +0 -295
@@ -18,15 +18,14 @@ import type { RtcAnswer } from "./DhtRpc";
18
18
  import type { RtcOffer } from "./DhtRpc";
19
19
  import type { WebrtcConnectionRequest } from "./DhtRpc";
20
20
  import { WebsocketConnectorRpc } from "./DhtRpc";
21
- import type { WebsocketConnectionResponse } from "./DhtRpc";
22
21
  import type { WebsocketConnectionRequest } from "./DhtRpc";
23
- import { FindSessionRpc } from "./DhtRpc";
24
- import type { FindResponse } from "./DhtRpc";
22
+ import { RecursiveOperationSessionRpc } from "./DhtRpc";
23
+ import type { RecursiveOperationResponse } from "./DhtRpc";
25
24
  import { StoreRpc } from "./DhtRpc";
26
25
  import type { ReplicateDataRequest } from "./DhtRpc";
27
26
  import type { StoreDataResponse } from "./DhtRpc";
28
27
  import type { StoreDataRequest } from "./DhtRpc";
29
- import { FindRpc } from "./DhtRpc";
28
+ import { RecursiveOperationRpc } from "./DhtRpc";
30
29
  import { RouterRpc } from "./DhtRpc";
31
30
  import type { RouteMessageAck } from "./DhtRpc";
32
31
  import type { RouteMessageWrapper } from "./DhtRpc";
@@ -128,27 +127,27 @@ export class RouterRpcClient implements IRouterRpcClient, ServiceInfo {
128
127
  }
129
128
  }
130
129
  /**
131
- * @generated from protobuf service dht.FindRpc
130
+ * @generated from protobuf service dht.RecursiveOperationRpc
132
131
  */
133
- export interface IFindRpcClient {
132
+ export interface IRecursiveOperationRpcClient {
134
133
  /**
135
- * @generated from protobuf rpc: routeFindRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
134
+ * @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
136
135
  */
137
- routeFindRequest(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall<RouteMessageWrapper, RouteMessageAck>;
136
+ routeRequest(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall<RouteMessageWrapper, RouteMessageAck>;
138
137
  }
139
138
  /**
140
- * @generated from protobuf service dht.FindRpc
139
+ * @generated from protobuf service dht.RecursiveOperationRpc
141
140
  */
142
- export class FindRpcClient implements IFindRpcClient, ServiceInfo {
143
- typeName = FindRpc.typeName;
144
- methods = FindRpc.methods;
145
- options = FindRpc.options;
141
+ export class RecursiveOperationRpcClient implements IRecursiveOperationRpcClient, ServiceInfo {
142
+ typeName = RecursiveOperationRpc.typeName;
143
+ methods = RecursiveOperationRpc.methods;
144
+ options = RecursiveOperationRpc.options;
146
145
  constructor(private readonly _transport: RpcTransport) {
147
146
  }
148
147
  /**
149
- * @generated from protobuf rpc: routeFindRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
148
+ * @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
150
149
  */
151
- routeFindRequest(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall<RouteMessageWrapper, RouteMessageAck> {
150
+ routeRequest(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall<RouteMessageWrapper, RouteMessageAck> {
152
151
  const method = this.methods[0], opt = this._transport.mergeOptions(options);
153
152
  return stackIntercept<RouteMessageWrapper, RouteMessageAck>("unary", this._transport, method, opt, input);
154
153
  }
@@ -191,29 +190,29 @@ export class StoreRpcClient implements IStoreRpcClient, ServiceInfo {
191
190
  }
192
191
  }
193
192
  /**
194
- * @generated from protobuf service dht.FindSessionRpc
193
+ * @generated from protobuf service dht.RecursiveOperationSessionRpc
195
194
  */
196
- export interface IFindSessionRpcClient {
195
+ export interface IRecursiveOperationSessionRpcClient {
197
196
  /**
198
- * @generated from protobuf rpc: sendFindResponse(dht.FindResponse) returns (google.protobuf.Empty);
197
+ * @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty);
199
198
  */
200
- sendFindResponse(input: FindResponse, options?: RpcOptions): UnaryCall<FindResponse, Empty>;
199
+ sendResponse(input: RecursiveOperationResponse, options?: RpcOptions): UnaryCall<RecursiveOperationResponse, Empty>;
201
200
  }
202
201
  /**
203
- * @generated from protobuf service dht.FindSessionRpc
202
+ * @generated from protobuf service dht.RecursiveOperationSessionRpc
204
203
  */
205
- export class FindSessionRpcClient implements IFindSessionRpcClient, ServiceInfo {
206
- typeName = FindSessionRpc.typeName;
207
- methods = FindSessionRpc.methods;
208
- options = FindSessionRpc.options;
204
+ export class RecursiveOperationSessionRpcClient implements IRecursiveOperationSessionRpcClient, ServiceInfo {
205
+ typeName = RecursiveOperationSessionRpc.typeName;
206
+ methods = RecursiveOperationSessionRpc.methods;
207
+ options = RecursiveOperationSessionRpc.options;
209
208
  constructor(private readonly _transport: RpcTransport) {
210
209
  }
211
210
  /**
212
- * @generated from protobuf rpc: sendFindResponse(dht.FindResponse) returns (google.protobuf.Empty);
211
+ * @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty);
213
212
  */
214
- sendFindResponse(input: FindResponse, options?: RpcOptions): UnaryCall<FindResponse, Empty> {
213
+ sendResponse(input: RecursiveOperationResponse, options?: RpcOptions): UnaryCall<RecursiveOperationResponse, Empty> {
215
214
  const method = this.methods[0], opt = this._transport.mergeOptions(options);
216
- return stackIntercept<FindResponse, Empty>("unary", this._transport, method, opt, input);
215
+ return stackIntercept<RecursiveOperationResponse, Empty>("unary", this._transport, method, opt, input);
217
216
  }
218
217
  }
219
218
  /**
@@ -221,9 +220,9 @@ export class FindSessionRpcClient implements IFindSessionRpcClient, ServiceInfo
221
220
  */
222
221
  export interface IWebsocketConnectorRpcClient {
223
222
  /**
224
- * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (dht.WebsocketConnectionResponse);
223
+ * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty);
225
224
  */
226
- requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall<WebsocketConnectionRequest, WebsocketConnectionResponse>;
225
+ requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall<WebsocketConnectionRequest, Empty>;
227
226
  }
228
227
  /**
229
228
  * @generated from protobuf service dht.WebsocketConnectorRpc
@@ -235,11 +234,11 @@ export class WebsocketConnectorRpcClient implements IWebsocketConnectorRpcClient
235
234
  constructor(private readonly _transport: RpcTransport) {
236
235
  }
237
236
  /**
238
- * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (dht.WebsocketConnectionResponse);
237
+ * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty);
239
238
  */
240
- requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall<WebsocketConnectionRequest, WebsocketConnectionResponse> {
239
+ requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall<WebsocketConnectionRequest, Empty> {
241
240
  const method = this.methods[0], opt = this._transport.mergeOptions(options);
242
- return stackIntercept<WebsocketConnectionRequest, WebsocketConnectionResponse>("unary", this._transport, method, opt, input);
241
+ return stackIntercept<WebsocketConnectionRequest, Empty>("unary", this._transport, method, opt, input);
243
242
  }
244
243
  }
245
244
  /**
@@ -14,9 +14,8 @@ import { IceCandidate } from "./DhtRpc";
14
14
  import { RtcAnswer } from "./DhtRpc";
15
15
  import { RtcOffer } from "./DhtRpc";
16
16
  import { WebrtcConnectionRequest } from "./DhtRpc";
17
- import { WebsocketConnectionResponse } from "./DhtRpc";
18
17
  import { WebsocketConnectionRequest } from "./DhtRpc";
19
- import { FindResponse } from "./DhtRpc";
18
+ import { RecursiveOperationResponse } from "./DhtRpc";
20
19
  import { ReplicateDataRequest } from "./DhtRpc";
21
20
  import { StoreDataResponse } from "./DhtRpc";
22
21
  import { StoreDataRequest } from "./DhtRpc";
@@ -60,13 +59,13 @@ export interface IRouterRpc<T = ServerCallContext> {
60
59
  forwardMessage(request: RouteMessageWrapper, context: T): Promise<RouteMessageAck>;
61
60
  }
62
61
  /**
63
- * @generated from protobuf service dht.FindRpc
62
+ * @generated from protobuf service dht.RecursiveOperationRpc
64
63
  */
65
- export interface IFindRpc<T = ServerCallContext> {
64
+ export interface IRecursiveOperationRpc<T = ServerCallContext> {
66
65
  /**
67
- * @generated from protobuf rpc: routeFindRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
66
+ * @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
68
67
  */
69
- routeFindRequest(request: RouteMessageWrapper, context: T): Promise<RouteMessageAck>;
68
+ routeRequest(request: RouteMessageWrapper, context: T): Promise<RouteMessageAck>;
70
69
  }
71
70
  /**
72
71
  * @generated from protobuf service dht.StoreRpc
@@ -82,22 +81,22 @@ export interface IStoreRpc<T = ServerCallContext> {
82
81
  replicateData(request: ReplicateDataRequest, context: T): Promise<Empty>;
83
82
  }
84
83
  /**
85
- * @generated from protobuf service dht.FindSessionRpc
84
+ * @generated from protobuf service dht.RecursiveOperationSessionRpc
86
85
  */
87
- export interface IFindSessionRpc<T = ServerCallContext> {
86
+ export interface IRecursiveOperationSessionRpc<T = ServerCallContext> {
88
87
  /**
89
- * @generated from protobuf rpc: sendFindResponse(dht.FindResponse) returns (google.protobuf.Empty);
88
+ * @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty);
90
89
  */
91
- sendFindResponse(request: FindResponse, context: T): Promise<Empty>;
90
+ sendResponse(request: RecursiveOperationResponse, context: T): Promise<Empty>;
92
91
  }
93
92
  /**
94
93
  * @generated from protobuf service dht.WebsocketConnectorRpc
95
94
  */
96
95
  export interface IWebsocketConnectorRpc<T = ServerCallContext> {
97
96
  /**
98
- * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (dht.WebsocketConnectionResponse);
97
+ * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty);
99
98
  */
100
- requestConnection(request: WebsocketConnectionRequest, context: T): Promise<WebsocketConnectionResponse>;
99
+ requestConnection(request: WebsocketConnectionRequest, context: T): Promise<Empty>;
101
100
  }
102
101
  /**
103
102
  * @generated from protobuf service dht.WebrtcConnectorRpc
@@ -22,9 +22,9 @@ export interface StoreDataRequest {
22
22
  */
23
23
  data?: Any;
24
24
  /**
25
- * @generated from protobuf field: dht.PeerDescriptor creator = 3;
25
+ * @generated from protobuf field: bytes creator = 3;
26
26
  */
27
- creator?: PeerDescriptor;
27
+ creator: Uint8Array;
28
28
  /**
29
29
  * @generated from protobuf field: google.protobuf.Timestamp createdAt = 4;
30
30
  */
@@ -38,10 +38,6 @@ export interface StoreDataRequest {
38
38
  * @generated from protobuf message dht.StoreDataResponse
39
39
  */
40
40
  export interface StoreDataResponse {
41
- /**
42
- * @generated from protobuf field: string error = 1;
43
- */
44
- error: string;
45
41
  }
46
42
  /**
47
43
  * @generated from protobuf message dht.ExternalStoreDataRequest
@@ -87,9 +83,9 @@ export interface DataEntry {
87
83
  */
88
84
  data?: Any;
89
85
  /**
90
- * @generated from protobuf field: dht.PeerDescriptor creator = 3;
86
+ * @generated from protobuf field: bytes creator = 3;
91
87
  */
92
- creator?: PeerDescriptor;
88
+ creator: Uint8Array;
93
89
  /**
94
90
  * @generated from protobuf field: google.protobuf.Timestamp createdAt = 4;
95
91
  */
@@ -138,22 +134,22 @@ export interface ClosestPeersResponse {
138
134
  requestId: string;
139
135
  }
140
136
  /**
141
- * @generated from protobuf message dht.FindRequest
137
+ * @generated from protobuf message dht.RecursiveOperationRequest
142
138
  */
143
- export interface FindRequest {
139
+ export interface RecursiveOperationRequest {
144
140
  /**
145
141
  * @generated from protobuf field: string sessionId = 1;
146
142
  */
147
143
  sessionId: string;
148
144
  /**
149
- * @generated from protobuf field: dht.FindAction action = 2;
145
+ * @generated from protobuf field: dht.RecursiveOperation operation = 2;
150
146
  */
151
- action: FindAction;
147
+ operation: RecursiveOperation;
152
148
  }
153
149
  /**
154
- * @generated from protobuf message dht.FindResponse
150
+ * @generated from protobuf message dht.RecursiveOperationResponse
155
151
  */
156
- export interface FindResponse {
152
+ export interface RecursiveOperationResponse {
157
153
  /**
158
154
  * @generated from protobuf field: repeated dht.PeerDescriptor closestConnectedPeers = 1;
159
155
  */
@@ -193,10 +189,6 @@ export interface PingResponse {
193
189
  * @generated from protobuf message dht.LeaveNotice
194
190
  */
195
191
  export interface LeaveNotice {
196
- /**
197
- * @generated from protobuf field: string serviceId = 1;
198
- */
199
- serviceId: string;
200
192
  }
201
193
  /**
202
194
  * @generated from protobuf message dht.PeerDescriptor
@@ -249,17 +241,17 @@ export interface ConnectivityMethod {
249
241
  */
250
242
  export interface RouteMessageWrapper {
251
243
  /**
252
- * @generated from protobuf field: dht.PeerDescriptor sourcePeer = 1;
244
+ * @generated from protobuf field: string requestId = 1;
253
245
  */
254
- sourcePeer?: PeerDescriptor;
246
+ requestId: string;
255
247
  /**
256
- * @generated from protobuf field: string requestId = 2;
248
+ * @generated from protobuf field: dht.PeerDescriptor sourcePeer = 2;
257
249
  */
258
- requestId: string;
250
+ sourcePeer?: PeerDescriptor;
259
251
  /**
260
- * @generated from protobuf field: dht.PeerDescriptor destinationPeer = 3;
252
+ * @generated from protobuf field: bytes target = 3;
261
253
  */
262
- destinationPeer?: PeerDescriptor;
254
+ target: Uint8Array;
263
255
  /**
264
256
  * @generated from protobuf field: dht.Message message = 4;
265
257
  */
@@ -338,6 +330,10 @@ export interface HandshakeRequest {
338
330
  * @generated from protobuf field: optional dht.PeerDescriptor targetPeerDescriptor = 2;
339
331
  */
340
332
  targetPeerDescriptor?: PeerDescriptor;
333
+ /**
334
+ * @generated from protobuf field: string version = 3;
335
+ */
336
+ version: string;
341
337
  }
342
338
  /**
343
339
  * @generated from protobuf message dht.HandshakeResponse
@@ -351,6 +347,10 @@ export interface HandshakeResponse {
351
347
  * @generated from protobuf field: optional dht.HandshakeError error = 2;
352
348
  */
353
349
  error?: HandshakeError;
350
+ /**
351
+ * @generated from protobuf field: string version = 3;
352
+ */
353
+ version: string;
354
354
  }
355
355
  /**
356
356
  * @generated from protobuf message dht.Message
@@ -410,11 +410,11 @@ export interface Message {
410
410
  */
411
411
  rpcMessage: RpcMessage;
412
412
  } | {
413
- oneofKind: "findRequest";
413
+ oneofKind: "recursiveOperationRequest";
414
414
  /**
415
- * @generated from protobuf field: dht.FindRequest findRequest = 11;
415
+ * @generated from protobuf field: dht.RecursiveOperationRequest recursiveOperationRequest = 11;
416
416
  */
417
- findRequest: FindRequest;
417
+ recursiveOperationRequest: RecursiveOperationRequest;
418
418
  } | {
419
419
  oneofKind: undefined;
420
420
  };
@@ -428,15 +428,6 @@ export interface Message {
428
428
  */
429
429
  export interface WebsocketConnectionRequest {
430
430
  }
431
- /**
432
- * @generated from protobuf message dht.WebsocketConnectionResponse
433
- */
434
- export interface WebsocketConnectionResponse {
435
- /**
436
- * @generated from protobuf field: bool accepted = 1;
437
- */
438
- accepted: boolean;
439
- }
440
431
  /**
441
432
  * WebRTC
442
433
  *
@@ -547,13 +538,13 @@ export interface ExternalFindDataResponse {
547
538
  entries: DataEntry[];
548
539
  }
549
540
  /**
550
- * @generated from protobuf enum dht.FindAction
541
+ * @generated from protobuf enum dht.RecursiveOperation
551
542
  */
552
- export enum FindAction {
543
+ export enum RecursiveOperation {
553
544
  /**
554
- * @generated from protobuf enum value: NODE = 0;
545
+ * @generated from protobuf enum value: FIND_NODE = 0;
555
546
  */
556
- NODE = 0,
547
+ FIND_NODE = 0,
557
548
  /**
558
549
  * @generated from protobuf enum value: FETCH_DATA = 1;
559
550
  */
@@ -574,11 +565,7 @@ export enum NodeType {
574
565
  /**
575
566
  * @generated from protobuf enum value: BROWSER = 1;
576
567
  */
577
- BROWSER = 1,
578
- /**
579
- * @generated from protobuf enum value: VIRTUAL = 3;
580
- */
581
- VIRTUAL = 3
568
+ BROWSER = 1
582
569
  }
583
570
  /**
584
571
  * @generated from protobuf enum dht.RpcResponseError
@@ -632,7 +619,11 @@ export enum HandshakeError {
632
619
  /**
633
620
  * @generated from protobuf enum value: INVALID_TARGET_PEER_DESCRIPTOR = 1;
634
621
  */
635
- INVALID_TARGET_PEER_DESCRIPTOR = 1
622
+ INVALID_TARGET_PEER_DESCRIPTOR = 1,
623
+ /**
624
+ * @generated from protobuf enum value: UNSUPPORTED_VERSION = 2;
625
+ */
626
+ UNSUPPORTED_VERSION = 2
636
627
  }
637
628
  // Wraps all messages
638
629
 
@@ -661,9 +652,9 @@ export enum MessageType {
661
652
  */
662
653
  HANDSHAKE_RESPONSE = 4,
663
654
  /**
664
- * @generated from protobuf enum value: FIND_REQUEST = 5;
655
+ * @generated from protobuf enum value: RECURSIVE_OPERATION_REQUEST = 5;
665
656
  */
666
- FIND_REQUEST = 5
657
+ RECURSIVE_OPERATION_REQUEST = 5
667
658
  }
668
659
  /**
669
660
  * @generated from protobuf enum dht.DisconnectMode
@@ -684,7 +675,7 @@ class StoreDataRequest$Type extends MessageType$<StoreDataRequest> {
684
675
  super("dht.StoreDataRequest", [
685
676
  { no: 1, name: "key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
686
677
  { no: 2, name: "data", kind: "message", T: () => Any },
687
- { no: 3, name: "creator", kind: "message", T: () => PeerDescriptor },
678
+ { no: 3, name: "creator", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
688
679
  { no: 4, name: "createdAt", kind: "message", T: () => Timestamp },
689
680
  { no: 5, name: "ttl", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }
690
681
  ]);
@@ -697,9 +688,7 @@ export const StoreDataRequest = new StoreDataRequest$Type();
697
688
  // @generated message type with reflection information, may provide speed optimized methods
698
689
  class StoreDataResponse$Type extends MessageType$<StoreDataResponse> {
699
690
  constructor() {
700
- super("dht.StoreDataResponse", [
701
- { no: 1, name: "error", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
702
- ]);
691
+ super("dht.StoreDataResponse", []);
703
692
  }
704
693
  }
705
694
  /**
@@ -749,7 +738,7 @@ class DataEntry$Type extends MessageType$<DataEntry> {
749
738
  super("dht.DataEntry", [
750
739
  { no: 1, name: "key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
751
740
  { no: 2, name: "data", kind: "message", T: () => Any },
752
- { no: 3, name: "creator", kind: "message", T: () => PeerDescriptor },
741
+ { no: 3, name: "creator", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
753
742
  { no: 4, name: "createdAt", kind: "message", T: () => Timestamp },
754
743
  { no: 5, name: "storedAt", kind: "message", T: () => Timestamp },
755
744
  { no: 6, name: "ttl", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
@@ -789,22 +778,22 @@ class ClosestPeersResponse$Type extends MessageType$<ClosestPeersResponse> {
789
778
  */
790
779
  export const ClosestPeersResponse = new ClosestPeersResponse$Type();
791
780
  // @generated message type with reflection information, may provide speed optimized methods
792
- class FindRequest$Type extends MessageType$<FindRequest> {
781
+ class RecursiveOperationRequest$Type extends MessageType$<RecursiveOperationRequest> {
793
782
  constructor() {
794
- super("dht.FindRequest", [
783
+ super("dht.RecursiveOperationRequest", [
795
784
  { no: 1, name: "sessionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
796
- { no: 2, name: "action", kind: "enum", T: () => ["dht.FindAction", FindAction] }
785
+ { no: 2, name: "operation", kind: "enum", T: () => ["dht.RecursiveOperation", RecursiveOperation] }
797
786
  ]);
798
787
  }
799
788
  }
800
789
  /**
801
- * @generated MessageType for protobuf message dht.FindRequest
790
+ * @generated MessageType for protobuf message dht.RecursiveOperationRequest
802
791
  */
803
- export const FindRequest = new FindRequest$Type();
792
+ export const RecursiveOperationRequest = new RecursiveOperationRequest$Type();
804
793
  // @generated message type with reflection information, may provide speed optimized methods
805
- class FindResponse$Type extends MessageType$<FindResponse> {
794
+ class RecursiveOperationResponse$Type extends MessageType$<RecursiveOperationResponse> {
806
795
  constructor() {
807
- super("dht.FindResponse", [
796
+ super("dht.RecursiveOperationResponse", [
808
797
  { no: 1, name: "closestConnectedPeers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor },
809
798
  { no: 2, name: "dataEntries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => DataEntry },
810
799
  { no: 3, name: "noCloserNodesFound", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
@@ -813,9 +802,9 @@ class FindResponse$Type extends MessageType$<FindResponse> {
813
802
  }
814
803
  }
815
804
  /**
816
- * @generated MessageType for protobuf message dht.FindResponse
805
+ * @generated MessageType for protobuf message dht.RecursiveOperationResponse
817
806
  */
818
- export const FindResponse = new FindResponse$Type();
807
+ export const RecursiveOperationResponse = new RecursiveOperationResponse$Type();
819
808
  // @generated message type with reflection information, may provide speed optimized methods
820
809
  class PingRequest$Type extends MessageType$<PingRequest> {
821
810
  constructor() {
@@ -843,9 +832,7 @@ export const PingResponse = new PingResponse$Type();
843
832
  // @generated message type with reflection information, may provide speed optimized methods
844
833
  class LeaveNotice$Type extends MessageType$<LeaveNotice> {
845
834
  constructor() {
846
- super("dht.LeaveNotice", [
847
- { no: 1, name: "serviceId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
848
- ]);
835
+ super("dht.LeaveNotice", []);
849
836
  }
850
837
  }
851
838
  /**
@@ -887,9 +874,9 @@ export const ConnectivityMethod = new ConnectivityMethod$Type();
887
874
  class RouteMessageWrapper$Type extends MessageType$<RouteMessageWrapper> {
888
875
  constructor() {
889
876
  super("dht.RouteMessageWrapper", [
890
- { no: 1, name: "sourcePeer", kind: "message", T: () => PeerDescriptor },
891
- { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
892
- { no: 3, name: "destinationPeer", kind: "message", T: () => PeerDescriptor },
877
+ { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
878
+ { no: 2, name: "sourcePeer", kind: "message", T: () => PeerDescriptor },
879
+ { no: 3, name: "target", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
893
880
  { no: 4, name: "message", kind: "message", T: () => Message },
894
881
  { no: 5, name: "reachableThrough", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor },
895
882
  { no: 6, name: "routingPath", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }
@@ -947,7 +934,8 @@ class HandshakeRequest$Type extends MessageType$<HandshakeRequest> {
947
934
  constructor() {
948
935
  super("dht.HandshakeRequest", [
949
936
  { no: 1, name: "sourcePeerDescriptor", kind: "message", T: () => PeerDescriptor },
950
- { no: 2, name: "targetPeerDescriptor", kind: "message", T: () => PeerDescriptor }
937
+ { no: 2, name: "targetPeerDescriptor", kind: "message", T: () => PeerDescriptor },
938
+ { no: 3, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
951
939
  ]);
952
940
  }
953
941
  }
@@ -960,7 +948,8 @@ class HandshakeResponse$Type extends MessageType$<HandshakeResponse> {
960
948
  constructor() {
961
949
  super("dht.HandshakeResponse", [
962
950
  { no: 1, name: "sourcePeerDescriptor", kind: "message", T: () => PeerDescriptor },
963
- { no: 2, name: "error", kind: "enum", opt: true, T: () => ["dht.HandshakeError", HandshakeError] }
951
+ { no: 2, name: "error", kind: "enum", opt: true, T: () => ["dht.HandshakeError", HandshakeError] },
952
+ { no: 3, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
964
953
  ]);
965
954
  }
966
955
  }
@@ -982,7 +971,7 @@ class Message$Type extends MessageType$<Message> {
982
971
  { no: 8, name: "handshakeRequest", kind: "message", oneof: "body", T: () => HandshakeRequest },
983
972
  { no: 9, name: "handshakeResponse", kind: "message", oneof: "body", T: () => HandshakeResponse },
984
973
  { no: 10, name: "rpcMessage", kind: "message", oneof: "body", T: () => RpcMessage },
985
- { no: 11, name: "findRequest", kind: "message", oneof: "body", T: () => FindRequest }
974
+ { no: 11, name: "recursiveOperationRequest", kind: "message", oneof: "body", T: () => RecursiveOperationRequest }
986
975
  ]);
987
976
  }
988
977
  }
@@ -1001,18 +990,6 @@ class WebsocketConnectionRequest$Type extends MessageType$<WebsocketConnectionRe
1001
990
  */
1002
991
  export const WebsocketConnectionRequest = new WebsocketConnectionRequest$Type();
1003
992
  // @generated message type with reflection information, may provide speed optimized methods
1004
- class WebsocketConnectionResponse$Type extends MessageType$<WebsocketConnectionResponse> {
1005
- constructor() {
1006
- super("dht.WebsocketConnectionResponse", [
1007
- { no: 1, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
1008
- ]);
1009
- }
1010
- }
1011
- /**
1012
- * @generated MessageType for protobuf message dht.WebsocketConnectionResponse
1013
- */
1014
- export const WebsocketConnectionResponse = new WebsocketConnectionResponse$Type();
1015
- // @generated message type with reflection information, may provide speed optimized methods
1016
993
  class WebrtcConnectionRequest$Type extends MessageType$<WebrtcConnectionRequest> {
1017
994
  constructor() {
1018
995
  super("dht.WebrtcConnectionRequest", []);
@@ -1160,10 +1137,10 @@ export const RouterRpc = new ServiceType("dht.RouterRpc", [
1160
1137
  { name: "forwardMessage", options: {}, I: RouteMessageWrapper, O: RouteMessageAck }
1161
1138
  ]);
1162
1139
  /**
1163
- * @generated ServiceType for protobuf service dht.FindRpc
1140
+ * @generated ServiceType for protobuf service dht.RecursiveOperationRpc
1164
1141
  */
1165
- export const FindRpc = new ServiceType("dht.FindRpc", [
1166
- { name: "routeFindRequest", options: {}, I: RouteMessageWrapper, O: RouteMessageAck }
1142
+ export const RecursiveOperationRpc = new ServiceType("dht.RecursiveOperationRpc", [
1143
+ { name: "routeRequest", options: {}, I: RouteMessageWrapper, O: RouteMessageAck }
1167
1144
  ]);
1168
1145
  /**
1169
1146
  * @generated ServiceType for protobuf service dht.StoreRpc
@@ -1173,16 +1150,16 @@ export const StoreRpc = new ServiceType("dht.StoreRpc", [
1173
1150
  { name: "replicateData", options: {}, I: ReplicateDataRequest, O: Empty }
1174
1151
  ]);
1175
1152
  /**
1176
- * @generated ServiceType for protobuf service dht.FindSessionRpc
1153
+ * @generated ServiceType for protobuf service dht.RecursiveOperationSessionRpc
1177
1154
  */
1178
- export const FindSessionRpc = new ServiceType("dht.FindSessionRpc", [
1179
- { name: "sendFindResponse", options: {}, I: FindResponse, O: Empty }
1155
+ export const RecursiveOperationSessionRpc = new ServiceType("dht.RecursiveOperationSessionRpc", [
1156
+ { name: "sendResponse", options: {}, I: RecursiveOperationResponse, O: Empty }
1180
1157
  ]);
1181
1158
  /**
1182
1159
  * @generated ServiceType for protobuf service dht.WebsocketConnectorRpc
1183
1160
  */
1184
1161
  export const WebsocketConnectorRpc = new ServiceType("dht.WebsocketConnectorRpc", [
1185
- { name: "requestConnection", options: {}, I: WebsocketConnectionRequest, O: WebsocketConnectionResponse }
1162
+ { name: "requestConnection", options: {}, I: WebsocketConnectionRequest, O: Empty }
1186
1163
  ]);
1187
1164
  /**
1188
1165
  * @generated ServiceType for protobuf service dht.WebrtcConnectorRpc
@@ -8,7 +8,8 @@ export class DhtCallContext extends ProtoCallContext implements DhtRpcOptions {
8
8
  sourceDescriptor?: PeerDescriptor
9
9
  notification?: boolean
10
10
  clientId?: number
11
- doNotConnect?: boolean
11
+ connect?: boolean
12
+ sendIfStopped?: boolean
12
13
  //used in incoming calls
13
14
  incomingSourceDescriptor?: PeerDescriptor
14
15
  }
@@ -5,5 +5,6 @@ export interface DhtRpcOptions extends ProtoRpcOptions {
5
5
  targetDescriptor?: PeerDescriptor
6
6
  sourceDescriptor?: PeerDescriptor
7
7
  clientId?: number
8
- doNotConnect?: boolean
8
+ connect?: boolean
9
+ sendIfStopped?: boolean
9
10
  }
@@ -4,7 +4,16 @@ export interface TransportEvents {
4
4
  disconnected: (peerDescriptor: PeerDescriptor, gracefulLeave: boolean) => void
5
5
  message: (message: Message) => void
6
6
  connected: (peerDescriptor: PeerDescriptor) => void
7
+ }
8
+
9
+ export interface SendOptions {
10
+ connect: boolean
11
+ sendIfStopped: boolean
12
+ }
7
13
 
14
+ export const DEFAULT_SEND_OPTIONS = {
15
+ connect: true,
16
+ sendIfStopped: false
8
17
  }
9
18
 
10
19
  export interface ITransport {
@@ -21,7 +30,7 @@ export interface ITransport {
21
30
  off<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor) => void): void
22
31
  off<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor, gracefulLeave: boolean) => void): void
23
32
 
24
- send(msg: Message, doNotConnect?: boolean): Promise<void>
33
+ send(msg: Message, opts?: SendOptions): Promise<void>
25
34
  getLocalPeerDescriptor(): PeerDescriptor
26
35
  getAllConnectionPeerDescriptors(): PeerDescriptor[]
27
36
  stop(): void | Promise<void>
@@ -9,7 +9,7 @@ export class ListeningRpcCommunicator extends RoutingRpcCommunicator {
9
9
  private readonly listener: (msg: Message) => void
10
10
 
11
11
  constructor(ownServiceId: ServiceID, transport: ITransport, config?: RpcCommunicatorConfig) {
12
- super(ownServiceId, transport.send, config)
12
+ super(ownServiceId, (msg, opts) => transport.send(msg, opts), config)
13
13
  this.listener = (msg: Message) => {
14
14
  this.handleMessageFromPeer(msg)
15
15
  }