@streamr/dht 0.0.1-tatum.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (344) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc +3 -0
  3. package/README.md +38 -0
  4. package/dist/src/connection/Connection.d.ts +11 -0
  5. package/dist/src/connection/Connection.js +23 -0
  6. package/dist/src/connection/Connection.js.map +1 -0
  7. package/dist/src/connection/ConnectionLockHandler.d.ts +23 -0
  8. package/dist/src/connection/ConnectionLockHandler.js +94 -0
  9. package/dist/src/connection/ConnectionLockHandler.js.map +1 -0
  10. package/dist/src/connection/ConnectionManager.d.ts +94 -0
  11. package/dist/src/connection/ConnectionManager.js +554 -0
  12. package/dist/src/connection/ConnectionManager.js.map +1 -0
  13. package/dist/src/connection/ConnectivityChecker.d.ts +17 -0
  14. package/dist/src/connection/ConnectivityChecker.js +187 -0
  15. package/dist/src/connection/ConnectivityChecker.js.map +1 -0
  16. package/dist/src/connection/Handshaker.d.ts +19 -0
  17. package/dist/src/connection/Handshaker.js +77 -0
  18. package/dist/src/connection/Handshaker.js.map +1 -0
  19. package/dist/src/connection/IConnection.d.ts +38 -0
  20. package/dist/src/connection/IConnection.js +19 -0
  21. package/dist/src/connection/IConnection.js.map +1 -0
  22. package/dist/src/connection/IConnectionSource.d.ts +4 -0
  23. package/dist/src/connection/IConnectionSource.js +3 -0
  24. package/dist/src/connection/IConnectionSource.js.map +1 -0
  25. package/dist/src/connection/ManagedConnection.d.ts +60 -0
  26. package/dist/src/connection/ManagedConnection.js +352 -0
  27. package/dist/src/connection/ManagedConnection.js.map +1 -0
  28. package/dist/src/connection/ManagedWebRtcConnection.d.ts +7 -0
  29. package/dist/src/connection/ManagedWebRtcConnection.js +20 -0
  30. package/dist/src/connection/ManagedWebRtcConnection.js.map +1 -0
  31. package/dist/src/connection/RemoteConnectionLocker.d.ts +14 -0
  32. package/dist/src/connection/RemoteConnectionLocker.js +93 -0
  33. package/dist/src/connection/RemoteConnectionLocker.js.map +1 -0
  34. package/dist/src/connection/Simulator/Simulator.d.ts +42 -0
  35. package/dist/src/connection/Simulator/Simulator.js +325 -0
  36. package/dist/src/connection/Simulator/Simulator.js.map +1 -0
  37. package/dist/src/connection/Simulator/SimulatorConnection.d.ts +19 -0
  38. package/dist/src/connection/Simulator/SimulatorConnection.js +118 -0
  39. package/dist/src/connection/Simulator/SimulatorConnection.js.map +1 -0
  40. package/dist/src/connection/Simulator/SimulatorConnector.d.ts +17 -0
  41. package/dist/src/connection/Simulator/SimulatorConnector.js +72 -0
  42. package/dist/src/connection/Simulator/SimulatorConnector.js.map +1 -0
  43. package/dist/src/connection/Simulator/SimulatorTransport.d.ts +6 -0
  44. package/dist/src/connection/Simulator/SimulatorTransport.js +11 -0
  45. package/dist/src/connection/Simulator/SimulatorTransport.js.map +1 -0
  46. package/dist/src/connection/Simulator/pings.d.ts +21 -0
  47. package/dist/src/connection/Simulator/pings.js +61 -0
  48. package/dist/src/connection/Simulator/pings.js.map +1 -0
  49. package/dist/src/connection/WebRTC/IWebRtcConnection.d.ts +20 -0
  50. package/dist/src/connection/WebRTC/IWebRtcConnection.js +9 -0
  51. package/dist/src/connection/WebRTC/IWebRtcConnection.js.map +1 -0
  52. package/dist/src/connection/WebRTC/NodeWebRtcConnection.d.ts +47 -0
  53. package/dist/src/connection/WebRTC/NodeWebRtcConnection.js +233 -0
  54. package/dist/src/connection/WebRTC/NodeWebRtcConnection.js.map +1 -0
  55. package/dist/src/connection/WebRTC/RemoteWebrtcConnector.d.ts +12 -0
  56. package/dist/src/connection/WebRTC/RemoteWebrtcConnector.js +74 -0
  57. package/dist/src/connection/WebRTC/RemoteWebrtcConnector.js.map +1 -0
  58. package/dist/src/connection/WebRTC/WebRtcConnector.d.ts +47 -0
  59. package/dist/src/connection/WebRTC/WebRtcConnector.js +227 -0
  60. package/dist/src/connection/WebRTC/WebRtcConnector.js.map +1 -0
  61. package/dist/src/connection/WebRTC/iceServerAsString.d.ts +2 -0
  62. package/dist/src/connection/WebRTC/iceServerAsString.js +18 -0
  63. package/dist/src/connection/WebRTC/iceServerAsString.js.map +1 -0
  64. package/dist/src/connection/WebSocket/ClientWebSocket.d.ts +15 -0
  65. package/dist/src/connection/WebSocket/ClientWebSocket.js +113 -0
  66. package/dist/src/connection/WebSocket/ClientWebSocket.js.map +1 -0
  67. package/dist/src/connection/WebSocket/RemoteWebSocketConnector.d.ts +9 -0
  68. package/dist/src/connection/WebSocket/RemoteWebSocketConnector.js +63 -0
  69. package/dist/src/connection/WebSocket/RemoteWebSocketConnector.js.map +1 -0
  70. package/dist/src/connection/WebSocket/ServerWebSocket.d.ts +18 -0
  71. package/dist/src/connection/WebSocket/ServerWebSocket.js +103 -0
  72. package/dist/src/connection/WebSocket/ServerWebSocket.js.map +1 -0
  73. package/dist/src/connection/WebSocket/WebSocketConnector.d.ts +31 -0
  74. package/dist/src/connection/WebSocket/WebSocketConnector.js +202 -0
  75. package/dist/src/connection/WebSocket/WebSocketConnector.js.map +1 -0
  76. package/dist/src/connection/WebSocket/WebSocketServer.d.ts +9 -0
  77. package/dist/src/connection/WebSocket/WebSocketServer.js +101 -0
  78. package/dist/src/connection/WebSocket/WebSocketServer.js.map +1 -0
  79. package/dist/src/dht/DhtNode.d.ts +153 -0
  80. package/dist/src/dht/DhtNode.js +599 -0
  81. package/dist/src/dht/DhtNode.js.map +1 -0
  82. package/dist/src/dht/DhtPeer.d.ts +18 -0
  83. package/dist/src/dht/DhtPeer.js +74 -0
  84. package/dist/src/dht/DhtPeer.js.map +1 -0
  85. package/dist/src/dht/ExternalApi.d.ts +8 -0
  86. package/dist/src/dht/ExternalApi.js +26 -0
  87. package/dist/src/dht/ExternalApi.js.map +1 -0
  88. package/dist/src/dht/RemoteExternalApi.d.ts +6 -0
  89. package/dist/src/dht/RemoteExternalApi.js +26 -0
  90. package/dist/src/dht/RemoteExternalApi.js.map +1 -0
  91. package/dist/src/dht/contact/Contact.d.ts +22 -0
  92. package/dist/src/dht/contact/Contact.js +25 -0
  93. package/dist/src/dht/contact/Contact.js.map +1 -0
  94. package/dist/src/dht/contact/RandomContactList.d.ts +20 -0
  95. package/dist/src/dht/contact/RandomContactList.js +78 -0
  96. package/dist/src/dht/contact/RandomContactList.js.map +1 -0
  97. package/dist/src/dht/contact/Remote.d.ts +15 -0
  98. package/dist/src/dht/contact/Remote.js +24 -0
  99. package/dist/src/dht/contact/Remote.js.map +1 -0
  100. package/dist/src/dht/contact/SortedContactList.d.ts +35 -0
  101. package/dist/src/dht/contact/SortedContactList.js +156 -0
  102. package/dist/src/dht/contact/SortedContactList.js.map +1 -0
  103. package/dist/src/dht/discovery/DiscoverySession.d.ts +36 -0
  104. package/dist/src/dht/discovery/DiscoverySession.js +116 -0
  105. package/dist/src/dht/discovery/DiscoverySession.js.map +1 -0
  106. package/dist/src/dht/discovery/PeerDiscovery.d.ts +42 -0
  107. package/dist/src/dht/discovery/PeerDiscovery.js +157 -0
  108. package/dist/src/dht/discovery/PeerDiscovery.js.map +1 -0
  109. package/dist/src/dht/find/RecursiveFindSession.d.ts +46 -0
  110. package/dist/src/dht/find/RecursiveFindSession.js +142 -0
  111. package/dist/src/dht/find/RecursiveFindSession.js.map +1 -0
  112. package/dist/src/dht/find/RecursiveFinder.d.ts +54 -0
  113. package/dist/src/dht/find/RecursiveFinder.js +180 -0
  114. package/dist/src/dht/find/RecursiveFinder.js.map +1 -0
  115. package/dist/src/dht/find/RemoteRecursiveFindSession.d.ts +6 -0
  116. package/dist/src/dht/find/RemoteRecursiveFindSession.js +25 -0
  117. package/dist/src/dht/find/RemoteRecursiveFindSession.js.map +1 -0
  118. package/dist/src/dht/routing/DuplicateDetector.d.ts +13 -0
  119. package/dist/src/dht/routing/DuplicateDetector.js +41 -0
  120. package/dist/src/dht/routing/DuplicateDetector.js.map +1 -0
  121. package/dist/src/dht/routing/RemoteRouter.d.ts +8 -0
  122. package/dist/src/dht/routing/RemoteRouter.js +106 -0
  123. package/dist/src/dht/routing/RemoteRouter.js.map +1 -0
  124. package/dist/src/dht/routing/Router.d.ts +60 -0
  125. package/dist/src/dht/routing/Router.js +207 -0
  126. package/dist/src/dht/routing/Router.js.map +1 -0
  127. package/dist/src/dht/routing/RoutingSession.d.ts +42 -0
  128. package/dist/src/dht/routing/RoutingSession.js +178 -0
  129. package/dist/src/dht/routing/RoutingSession.js.map +1 -0
  130. package/dist/src/dht/store/DataStore.d.ts +45 -0
  131. package/dist/src/dht/store/DataStore.js +244 -0
  132. package/dist/src/dht/store/DataStore.js.map +1 -0
  133. package/dist/src/dht/store/LocalDataStore.d.ts +19 -0
  134. package/dist/src/dht/store/LocalDataStore.js +104 -0
  135. package/dist/src/dht/store/LocalDataStore.js.map +1 -0
  136. package/dist/src/dht/store/RemoteStore.d.ts +8 -0
  137. package/dist/src/dht/store/RemoteStore.js +44 -0
  138. package/dist/src/dht/store/RemoteStore.js.map +1 -0
  139. package/dist/src/exports.d.ts +19 -0
  140. package/dist/src/exports.js +41 -0
  141. package/dist/src/exports.js.map +1 -0
  142. package/dist/src/helpers/AddressTools.d.ts +2 -0
  143. package/dist/src/helpers/AddressTools.js +31 -0
  144. package/dist/src/helpers/AddressTools.js.map +1 -0
  145. package/dist/src/helpers/PeerID.d.ts +25 -0
  146. package/dist/src/helpers/PeerID.js +84 -0
  147. package/dist/src/helpers/PeerID.js.map +1 -0
  148. package/dist/src/helpers/UUID.d.ts +7 -0
  149. package/dist/src/helpers/UUID.js +32 -0
  150. package/dist/src/helpers/UUID.js.map +1 -0
  151. package/dist/src/helpers/debugHelpers.d.ts +3 -0
  152. package/dist/src/helpers/debugHelpers.js +11 -0
  153. package/dist/src/helpers/debugHelpers.js.map +1 -0
  154. package/dist/src/helpers/errors.d.ts +72 -0
  155. package/dist/src/helpers/errors.js +95 -0
  156. package/dist/src/helpers/errors.js.map +1 -0
  157. package/dist/src/helpers/peerIdFromPeerDescriptor.d.ts +5 -0
  158. package/dist/src/helpers/peerIdFromPeerDescriptor.js +17 -0
  159. package/dist/src/helpers/peerIdFromPeerDescriptor.js.map +1 -0
  160. package/dist/src/helpers/protoClasses.d.ts +2 -0
  161. package/dist/src/helpers/protoClasses.js +35 -0
  162. package/dist/src/helpers/protoClasses.js.map +1 -0
  163. package/dist/src/helpers/protoToString.d.ts +2 -0
  164. package/dist/src/helpers/protoToString.js +20 -0
  165. package/dist/src/helpers/protoToString.js.map +1 -0
  166. package/dist/src/proto/google/protobuf/any.d.ts +173 -0
  167. package/dist/src/proto/google/protobuf/any.js +155 -0
  168. package/dist/src/proto/google/protobuf/any.js.map +1 -0
  169. package/dist/src/proto/google/protobuf/empty.d.ts +32 -0
  170. package/dist/src/proto/google/protobuf/empty.js +34 -0
  171. package/dist/src/proto/google/protobuf/empty.js.map +1 -0
  172. package/dist/src/proto/google/protobuf/timestamp.d.ts +149 -0
  173. package/dist/src/proto/google/protobuf/timestamp.js +136 -0
  174. package/dist/src/proto/google/protobuf/timestamp.js.map +1 -0
  175. package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +320 -0
  176. package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +245 -0
  177. package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -0
  178. package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +1089 -0
  179. package/dist/src/proto/packages/dht/protos/DhtRpc.js +710 -0
  180. package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -0
  181. package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +145 -0
  182. package/dist/src/proto/packages/dht/protos/DhtRpc.server.js +3 -0
  183. package/dist/src/proto/packages/dht/protos/DhtRpc.server.js.map +1 -0
  184. package/dist/src/proto/packages/proto-rpc/protos/ProtoRpc.d.ts +87 -0
  185. package/dist/src/proto/packages/proto-rpc/protos/ProtoRpc.js +66 -0
  186. package/dist/src/proto/packages/proto-rpc/protos/ProtoRpc.js.map +1 -0
  187. package/dist/src/proto/tests.d.ts +39 -0
  188. package/dist/src/proto/tests.js +34 -0
  189. package/dist/src/proto/tests.js.map +1 -0
  190. package/dist/src/rpc-protocol/DhtCallContext.d.ts +12 -0
  191. package/dist/src/rpc-protocol/DhtCallContext.js +8 -0
  192. package/dist/src/rpc-protocol/DhtCallContext.js.map +1 -0
  193. package/dist/src/rpc-protocol/DhtRpcOptions.d.ts +8 -0
  194. package/dist/src/rpc-protocol/DhtRpcOptions.js +3 -0
  195. package/dist/src/rpc-protocol/DhtRpcOptions.js.map +1 -0
  196. package/dist/src/transport/ITransport.d.ts +22 -0
  197. package/dist/src/transport/ITransport.js +3 -0
  198. package/dist/src/transport/ITransport.js.map +1 -0
  199. package/dist/src/transport/ListeningRpcCommunicator.d.ts +6 -0
  200. package/dist/src/transport/ListeningRpcCommunicator.js +14 -0
  201. package/dist/src/transport/ListeningRpcCommunicator.js.map +1 -0
  202. package/dist/src/transport/RoutingRpcCommunicator.d.ts +8 -0
  203. package/dist/src/transport/RoutingRpcCommunicator.js +52 -0
  204. package/dist/src/transport/RoutingRpcCommunicator.js.map +1 -0
  205. package/jest.config.js +2 -0
  206. package/karma.config.js +20 -0
  207. package/package.json +64 -0
  208. package/proto.sh +3 -0
  209. package/protos/DhtRpc.proto +330 -0
  210. package/protos/tests.proto +16 -0
  211. package/src/connection/Connection.ts +23 -0
  212. package/src/connection/ConnectionLockHandler.ts +105 -0
  213. package/src/connection/ConnectionManager.ts +676 -0
  214. package/src/connection/ConnectivityChecker.ts +173 -0
  215. package/src/connection/Handshaker.ts +92 -0
  216. package/src/connection/IConnection.ts +47 -0
  217. package/src/connection/IConnectionSource.ts +6 -0
  218. package/src/connection/ManagedConnection.ts +398 -0
  219. package/src/connection/ManagedWebRtcConnection.ts +27 -0
  220. package/src/connection/RemoteConnectionLocker.ts +88 -0
  221. package/src/connection/Simulator/Simulator.ts +399 -0
  222. package/src/connection/Simulator/SimulatorConnection.ts +137 -0
  223. package/src/connection/Simulator/SimulatorConnector.ts +104 -0
  224. package/src/connection/Simulator/SimulatorTransport.ts +9 -0
  225. package/src/connection/Simulator/pings.ts +42 -0
  226. package/src/connection/WebRTC/BrowserWebRtcConnection.ts +227 -0
  227. package/src/connection/WebRTC/IWebRtcConnection.ts +24 -0
  228. package/src/connection/WebRTC/NodeWebRtcConnection.ts +256 -0
  229. package/src/connection/WebRTC/RemoteWebrtcConnector.ts +93 -0
  230. package/src/connection/WebRTC/WebRtcConnector.ts +306 -0
  231. package/src/connection/WebRTC/iceServerAsString.ts +15 -0
  232. package/src/connection/WebSocket/ClientWebSocket.ts +118 -0
  233. package/src/connection/WebSocket/RemoteWebSocketConnector.ts +49 -0
  234. package/src/connection/WebSocket/ServerWebSocket.ts +119 -0
  235. package/src/connection/WebSocket/WebSocketConnector.ts +264 -0
  236. package/src/connection/WebSocket/WebSocketServer.ts +97 -0
  237. package/src/dht/DhtNode.ts +776 -0
  238. package/src/dht/DhtPeer.ts +96 -0
  239. package/src/dht/ExternalApi.ts +29 -0
  240. package/src/dht/RemoteExternalApi.ts +25 -0
  241. package/src/dht/contact/Contact.ts +36 -0
  242. package/src/dht/contact/RandomContactList.ts +92 -0
  243. package/src/dht/contact/Remote.ts +40 -0
  244. package/src/dht/contact/SortedContactList.ts +196 -0
  245. package/src/dht/discovery/DiscoverySession.ts +150 -0
  246. package/src/dht/discovery/PeerDiscovery.ts +162 -0
  247. package/src/dht/find/RecursiveFindSession.ts +178 -0
  248. package/src/dht/find/RecursiveFinder.ts +272 -0
  249. package/src/dht/find/RemoteRecursiveFindSession.ts +33 -0
  250. package/src/dht/routing/DuplicateDetector.ts +53 -0
  251. package/src/dht/routing/RemoteRouter.ts +115 -0
  252. package/src/dht/routing/Router.ts +266 -0
  253. package/src/dht/routing/RoutingSession.ts +222 -0
  254. package/src/dht/store/DataStore.ts +321 -0
  255. package/src/dht/store/LocalDataStore.ts +114 -0
  256. package/src/dht/store/RemoteStore.ts +58 -0
  257. package/src/exports.ts +19 -0
  258. package/src/helpers/AddressTools.ts +26 -0
  259. package/src/helpers/PeerID.ts +95 -0
  260. package/src/helpers/UUID.ts +30 -0
  261. package/src/helpers/debugHelpers.ts +9 -0
  262. package/src/helpers/errors.ts +49 -0
  263. package/src/helpers/peerIdFromPeerDescriptor.ts +14 -0
  264. package/src/helpers/protoClasses.ts +63 -0
  265. package/src/helpers/protoToString.ts +21 -0
  266. package/src/proto/google/protobuf/any.ts +319 -0
  267. package/src/proto/google/protobuf/empty.ts +84 -0
  268. package/src/proto/google/protobuf/timestamp.ts +281 -0
  269. package/src/proto/packages/dht/protos/DhtRpc.client.ts +373 -0
  270. package/src/proto/packages/dht/protos/DhtRpc.server.ts +148 -0
  271. package/src/proto/packages/dht/protos/DhtRpc.ts +1399 -0
  272. package/src/proto/packages/proto-rpc/protos/ProtoRpc.ts +108 -0
  273. package/src/proto/tests.ts +52 -0
  274. package/src/rpc-protocol/DhtCallContext.ts +15 -0
  275. package/src/rpc-protocol/DhtRpcOptions.ts +9 -0
  276. package/src/transport/ITransport.ts +31 -0
  277. package/src/transport/ListeningRpcCommunicator.ts +14 -0
  278. package/src/transport/RoutingRpcCommunicator.ts +59 -0
  279. package/src/types/glogal.d.ts +1 -0
  280. package/src/types/textencoding.d.ts +7 -0
  281. package/test/RandomGraphSimulation.ts +52 -0
  282. package/test/benchmark/KademliaCorrectness.test.ts +115 -0
  283. package/test/benchmark/RecursiveFind.test.ts +87 -0
  284. package/test/benchmark/any.test.ts +28 -0
  285. package/test/benchmark/kademlia-simulation/Contact.ts +32 -0
  286. package/test/benchmark/kademlia-simulation/KademliaSimulation.ts +94 -0
  287. package/test/benchmark/kademlia-simulation/SimulationNode.ts +125 -0
  288. package/test/data/generateGroundTruthData.ts +70 -0
  289. package/test/end-to-end/Layer0-Layer1.test.ts +87 -0
  290. package/test/end-to-end/Layer0.test.ts +60 -0
  291. package/test/end-to-end/Layer0MixedConnectionTypes.test.ts +94 -0
  292. package/test/end-to-end/Layer0WebRTC-Layer1.test.ts +134 -0
  293. package/test/end-to-end/Layer0WebRTC.test.ts +98 -0
  294. package/test/end-to-end/Layer1-Scale-WebRTC.test.ts +69 -0
  295. package/test/end-to-end/Layer1-Scale-WebSocket.test.ts +73 -0
  296. package/test/end-to-end/WebSocketConnectionRequest.test.ts +62 -0
  297. package/test/integration/ConnectionLocking.test.ts +166 -0
  298. package/test/integration/ConnectionManager.test.ts +291 -0
  299. package/test/integration/DhtNodeExternalAPI.test.ts +43 -0
  300. package/test/integration/DhtPeer.test.ts +73 -0
  301. package/test/integration/DhtRpc.test.ts +131 -0
  302. package/test/integration/DhtWithMockConnectionLatencies.test.ts +46 -0
  303. package/test/integration/DhtWithMockConnections.test.ts +46 -0
  304. package/test/integration/DhtWithRealConnectionLatencies.test.ts +47 -0
  305. package/test/integration/Layer1-scale.test.ts +200 -0
  306. package/test/integration/MigrateData.test.ts +203 -0
  307. package/test/integration/Mock-Layer1-Layer0.test.ts +106 -0
  308. package/test/integration/MultipleEntryPointJoining.test.ts +105 -0
  309. package/test/integration/RecursiveFind.test.ts +50 -0
  310. package/test/integration/RemoteRouter.test.ts +83 -0
  311. package/test/integration/RemoteStore.test.ts +66 -0
  312. package/test/integration/RouteMessage.test.ts +254 -0
  313. package/test/integration/RpcErrors.test.ts +153 -0
  314. package/test/integration/ScaleDownDht.test.ts +66 -0
  315. package/test/integration/SimultaneousConnections.test.ts +308 -0
  316. package/test/integration/Store.test.ts +72 -0
  317. package/test/integration/StoreAndDelete.test.ts +93 -0
  318. package/test/integration/StoreOnDhtWithTwoNodes.test.ts +71 -0
  319. package/test/integration/WebRtcConnectionManagement.test.ts +205 -0
  320. package/test/integration/WebRtcConnectorRpc.test.ts +145 -0
  321. package/test/integration/WebSocket.test.ts +64 -0
  322. package/test/integration/WebSocketConnectionManagement.test.ts +131 -0
  323. package/test/integration/WebSocketConnectorRpc.test.ts +86 -0
  324. package/test/kademlia-simulation/data/nodeids.json +13002 -0
  325. package/test/kademlia-simulation/data/orderedneighbors.json +1001 -0
  326. package/test/unit/AddressTools.test.ts +40 -0
  327. package/test/unit/DuplicateDetector.test.ts +29 -0
  328. package/test/unit/LocalDataStore.test.ts +107 -0
  329. package/test/unit/PeerID.test.ts +22 -0
  330. package/test/unit/ProtobufMessage.test.ts +21 -0
  331. package/test/unit/RandomContactList.test.ts +87 -0
  332. package/test/unit/RecursiveFinder.test.ts +112 -0
  333. package/test/unit/Router.test.ts +124 -0
  334. package/test/unit/SortedContactList.test.ts +127 -0
  335. package/test/unit/UUID.test.ts +49 -0
  336. package/test/unit/WebSocketServer.test.ts +42 -0
  337. package/test/utils/mock/RecursiveFinder.ts +19 -0
  338. package/test/utils/mock/Router.ts +53 -0
  339. package/test/utils/mock/Transport.ts +26 -0
  340. package/test/utils/utils.ts +311 -0
  341. package/tsconfig.browser.json +15 -0
  342. package/tsconfig.jest.json +19 -0
  343. package/tsconfig.json +3 -0
  344. package/tsconfig.node.json +18 -0
@@ -0,0 +1,281 @@
1
+ // @generated by protobuf-ts 2.8.2 with parameter server_generic,generate_dependencies,long_type_number
2
+ // @generated from protobuf file "google/protobuf/timestamp.proto" (package "google.protobuf", syntax proto3)
3
+ // tslint:disable
4
+ //
5
+ // Protocol Buffers - Google's data interchange format
6
+ // Copyright 2008 Google Inc. All rights reserved.
7
+ // https://developers.google.com/protocol-buffers/
8
+ //
9
+ // Redistribution and use in source and binary forms, with or without
10
+ // modification, are permitted provided that the following conditions are
11
+ // met:
12
+ //
13
+ // * Redistributions of source code must retain the above copyright
14
+ // notice, this list of conditions and the following disclaimer.
15
+ // * Redistributions in binary form must reproduce the above
16
+ // copyright notice, this list of conditions and the following disclaimer
17
+ // in the documentation and/or other materials provided with the
18
+ // distribution.
19
+ // * Neither the name of Google Inc. nor the names of its
20
+ // contributors may be used to endorse or promote products derived from
21
+ // this software without specific prior written permission.
22
+ //
23
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ //
35
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
36
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
37
+ import { WireType } from "@protobuf-ts/runtime";
38
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
39
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
40
+ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
41
+ import type { PartialMessage } from "@protobuf-ts/runtime";
42
+ import { reflectionMergePartial } from "@protobuf-ts/runtime";
43
+ import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
44
+ import { typeofJsonValue } from "@protobuf-ts/runtime";
45
+ import type { JsonValue } from "@protobuf-ts/runtime";
46
+ import type { JsonReadOptions } from "@protobuf-ts/runtime";
47
+ import type { JsonWriteOptions } from "@protobuf-ts/runtime";
48
+ import { PbLong } from "@protobuf-ts/runtime";
49
+ import { MessageType } from "@protobuf-ts/runtime";
50
+ /**
51
+ * A Timestamp represents a point in time independent of any time zone or local
52
+ * calendar, encoded as a count of seconds and fractions of seconds at
53
+ * nanosecond resolution. The count is relative to an epoch at UTC midnight on
54
+ * January 1, 1970, in the proleptic Gregorian calendar which extends the
55
+ * Gregorian calendar backwards to year one.
56
+ *
57
+ * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
58
+ * second table is needed for interpretation, using a [24-hour linear
59
+ * smear](https://developers.google.com/time/smear).
60
+ *
61
+ * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
62
+ * restricting to that range, we ensure that we can convert to and from [RFC
63
+ * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
64
+ *
65
+ * # Examples
66
+ *
67
+ * Example 1: Compute Timestamp from POSIX `time()`.
68
+ *
69
+ * Timestamp timestamp;
70
+ * timestamp.set_seconds(time(NULL));
71
+ * timestamp.set_nanos(0);
72
+ *
73
+ * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
74
+ *
75
+ * struct timeval tv;
76
+ * gettimeofday(&tv, NULL);
77
+ *
78
+ * Timestamp timestamp;
79
+ * timestamp.set_seconds(tv.tv_sec);
80
+ * timestamp.set_nanos(tv.tv_usec * 1000);
81
+ *
82
+ * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
83
+ *
84
+ * FILETIME ft;
85
+ * GetSystemTimeAsFileTime(&ft);
86
+ * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
87
+ *
88
+ * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
89
+ * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
90
+ * Timestamp timestamp;
91
+ * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
92
+ * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
93
+ *
94
+ * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
95
+ *
96
+ * long millis = System.currentTimeMillis();
97
+ *
98
+ * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
99
+ * .setNanos((int) ((millis % 1000) * 1000000)).build();
100
+ *
101
+ *
102
+ * Example 5: Compute Timestamp from current time in Python.
103
+ *
104
+ * timestamp = Timestamp()
105
+ * timestamp.GetCurrentTime()
106
+ *
107
+ * # JSON Mapping
108
+ *
109
+ * In JSON format, the Timestamp type is encoded as a string in the
110
+ * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
111
+ * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
112
+ * where {year} is always expressed using four digits while {month}, {day},
113
+ * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
114
+ * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
115
+ * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
116
+ * is required. A proto3 JSON serializer should always use UTC (as indicated by
117
+ * "Z") when printing the Timestamp type and a proto3 JSON parser should be
118
+ * able to accept both UTC and other timezones (as indicated by an offset).
119
+ *
120
+ * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
121
+ * 01:30 UTC on January 15, 2017.
122
+ *
123
+ * In JavaScript, one can convert a Date object to this format using the
124
+ * standard
125
+ * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
126
+ * method. In Python, a standard `datetime.datetime` object can be converted
127
+ * to this format using
128
+ * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
129
+ * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
130
+ * the Joda Time's [`ISODateTimeFormat.dateTime()`](
131
+ * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
132
+ * ) to obtain a formatter capable of generating timestamps in this format.
133
+ *
134
+ *
135
+ *
136
+ * @generated from protobuf message google.protobuf.Timestamp
137
+ */
138
+ export interface Timestamp {
139
+ /**
140
+ * Represents seconds of UTC time since Unix epoch
141
+ * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
142
+ * 9999-12-31T23:59:59Z inclusive.
143
+ *
144
+ * @generated from protobuf field: int64 seconds = 1;
145
+ */
146
+ seconds: number;
147
+ /**
148
+ * Non-negative fractions of a second at nanosecond resolution. Negative
149
+ * second values with fractions must still have non-negative nanos values
150
+ * that count forward in time. Must be from 0 to 999,999,999
151
+ * inclusive.
152
+ *
153
+ * @generated from protobuf field: int32 nanos = 2;
154
+ */
155
+ nanos: number;
156
+ }
157
+ // @generated message type with reflection information, may provide speed optimized methods
158
+ class Timestamp$Type extends MessageType<Timestamp> {
159
+ constructor() {
160
+ super("google.protobuf.Timestamp", [
161
+ { no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
162
+ { no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
163
+ ]);
164
+ }
165
+ /**
166
+ * Creates a new `Timestamp` for the current time.
167
+ */
168
+ now(): Timestamp {
169
+ const msg = this.create();
170
+ const ms = Date.now();
171
+ msg.seconds = PbLong.from(Math.floor(ms / 1000)).toNumber();
172
+ msg.nanos = (ms % 1000) * 1000000;
173
+ return msg;
174
+ }
175
+ /**
176
+ * Converts a `Timestamp` to a JavaScript Date.
177
+ */
178
+ toDate(message: Timestamp): Date {
179
+ return new Date(PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000));
180
+ }
181
+ /**
182
+ * Converts a JavaScript Date to a `Timestamp`.
183
+ */
184
+ fromDate(date: Date): Timestamp {
185
+ const msg = this.create();
186
+ const ms = date.getTime();
187
+ msg.seconds = PbLong.from(Math.floor(ms / 1000)).toNumber();
188
+ msg.nanos = (ms % 1000) * 1000000;
189
+ return msg;
190
+ }
191
+ /**
192
+ * In JSON format, the `Timestamp` type is encoded as a string
193
+ * in the RFC 3339 format.
194
+ */
195
+ internalJsonWrite(message: Timestamp, options: JsonWriteOptions): JsonValue {
196
+ let ms = PbLong.from(message.seconds).toNumber() * 1000;
197
+ if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
198
+ throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
199
+ if (message.nanos < 0)
200
+ throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");
201
+ let z = "Z";
202
+ if (message.nanos > 0) {
203
+ let nanosStr = (message.nanos + 1000000000).toString().substring(1);
204
+ if (nanosStr.substring(3) === "000000")
205
+ z = "." + nanosStr.substring(0, 3) + "Z";
206
+ else if (nanosStr.substring(6) === "000")
207
+ z = "." + nanosStr.substring(0, 6) + "Z";
208
+ else
209
+ z = "." + nanosStr + "Z";
210
+ }
211
+ return new Date(ms).toISOString().replace(".000Z", z);
212
+ }
213
+ /**
214
+ * In JSON format, the `Timestamp` type is encoded as a string
215
+ * in the RFC 3339 format.
216
+ */
217
+ internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Timestamp): Timestamp {
218
+ if (typeof json !== "string")
219
+ throw new Error("Unable to parse Timestamp from JSON " + typeofJsonValue(json) + ".");
220
+ let matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
221
+ if (!matches)
222
+ throw new Error("Unable to parse Timestamp from JSON. Invalid format.");
223
+ let ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z"));
224
+ if (Number.isNaN(ms))
225
+ throw new Error("Unable to parse Timestamp from JSON. Invalid value.");
226
+ if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
227
+ throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
228
+ if (!target)
229
+ target = this.create();
230
+ target.seconds = PbLong.from(ms / 1000).toNumber();
231
+ target.nanos = 0;
232
+ if (matches[7])
233
+ target.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000);
234
+ return target;
235
+ }
236
+ create(value?: PartialMessage<Timestamp>): Timestamp {
237
+ const message = { seconds: 0, nanos: 0 };
238
+ globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
239
+ if (value !== undefined)
240
+ reflectionMergePartial<Timestamp>(this, message, value);
241
+ return message;
242
+ }
243
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Timestamp): Timestamp {
244
+ let message = target ?? this.create(), end = reader.pos + length;
245
+ while (reader.pos < end) {
246
+ let [fieldNo, wireType] = reader.tag();
247
+ switch (fieldNo) {
248
+ case /* int64 seconds */ 1:
249
+ message.seconds = reader.int64().toNumber();
250
+ break;
251
+ case /* int32 nanos */ 2:
252
+ message.nanos = reader.int32();
253
+ break;
254
+ default:
255
+ let u = options.readUnknownField;
256
+ if (u === "throw")
257
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
258
+ let d = reader.skip(wireType);
259
+ if (u !== false)
260
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
261
+ }
262
+ }
263
+ return message;
264
+ }
265
+ internalBinaryWrite(message: Timestamp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
266
+ /* int64 seconds = 1; */
267
+ if (message.seconds !== 0)
268
+ writer.tag(1, WireType.Varint).int64(message.seconds);
269
+ /* int32 nanos = 2; */
270
+ if (message.nanos !== 0)
271
+ writer.tag(2, WireType.Varint).int32(message.nanos);
272
+ let u = options.writeUnknownFields;
273
+ if (u !== false)
274
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
275
+ return writer;
276
+ }
277
+ }
278
+ /**
279
+ * @generated MessageType for protobuf message google.protobuf.Timestamp
280
+ */
281
+ export const Timestamp = new Timestamp$Type();
@@ -0,0 +1,373 @@
1
+ // @generated by protobuf-ts 2.8.2 with parameter server_generic,generate_dependencies,long_type_number
2
+ // @generated from protobuf file "packages/dht/protos/DhtRpc.proto" (package "dht", syntax proto3)
3
+ // tslint:disable
4
+ import { ExternalApiService } from "./DhtRpc";
5
+ import type { FindDataResponse } from "./DhtRpc";
6
+ import type { FindDataRequest } from "./DhtRpc";
7
+ import { ConnectionLocker } from "./DhtRpc";
8
+ import type { DisconnectNoticeResponse } from "./DhtRpc";
9
+ import type { DisconnectNotice } from "./DhtRpc";
10
+ import type { UnlockRequest } from "./DhtRpc";
11
+ import type { LockResponse } from "./DhtRpc";
12
+ import type { LockRequest } from "./DhtRpc";
13
+ import { WebRtcConnectorService } from "./DhtRpc";
14
+ import type { IceCandidate } from "./DhtRpc";
15
+ import type { RtcAnswer } from "./DhtRpc";
16
+ import type { RtcOffer } from "./DhtRpc";
17
+ import type { WebRtcConnectionRequest } from "./DhtRpc";
18
+ import { WebSocketConnectorService } from "./DhtRpc";
19
+ import type { WebSocketConnectionResponse } from "./DhtRpc";
20
+ import type { WebSocketConnectionRequest } from "./DhtRpc";
21
+ import { RecursiveFindSessionService } from "./DhtRpc";
22
+ import type { RecursiveFindReport } from "./DhtRpc";
23
+ import { StoreService } from "./DhtRpc";
24
+ import type { DeleteDataResponse } from "./DhtRpc";
25
+ import type { DeleteDataRequest } from "./DhtRpc";
26
+ import type { MigrateDataResponse } from "./DhtRpc";
27
+ import type { MigrateDataRequest } from "./DhtRpc";
28
+ import type { StoreDataResponse } from "./DhtRpc";
29
+ import type { StoreDataRequest } from "./DhtRpc";
30
+ import { RoutingService } from "./DhtRpc";
31
+ import type { RouteMessageAck } from "./DhtRpc";
32
+ import type { RouteMessageWrapper } from "./DhtRpc";
33
+ import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
34
+ import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
35
+ import { DhtRpcService } from "./DhtRpc";
36
+ import type { Empty } from "../../../google/protobuf/empty";
37
+ import type { LeaveNotice } from "./DhtRpc";
38
+ import type { PingResponse } from "./DhtRpc";
39
+ import type { PingRequest } from "./DhtRpc";
40
+ import { stackIntercept } from "@protobuf-ts/runtime-rpc";
41
+ import type { ClosestPeersResponse } from "./DhtRpc";
42
+ import type { ClosestPeersRequest } from "./DhtRpc";
43
+ import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
44
+ import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
45
+ /**
46
+ * @generated from protobuf service dht.DhtRpcService
47
+ */
48
+ export interface IDhtRpcServiceClient {
49
+ /**
50
+ * @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse);
51
+ */
52
+ getClosestPeers(input: ClosestPeersRequest, options?: RpcOptions): UnaryCall<ClosestPeersRequest, ClosestPeersResponse>;
53
+ /**
54
+ * @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse);
55
+ */
56
+ ping(input: PingRequest, options?: RpcOptions): UnaryCall<PingRequest, PingResponse>;
57
+ /**
58
+ * @generated from protobuf rpc: leaveNotice(dht.LeaveNotice) returns (google.protobuf.Empty);
59
+ */
60
+ leaveNotice(input: LeaveNotice, options?: RpcOptions): UnaryCall<LeaveNotice, Empty>;
61
+ }
62
+ /**
63
+ * @generated from protobuf service dht.DhtRpcService
64
+ */
65
+ export class DhtRpcServiceClient implements IDhtRpcServiceClient, ServiceInfo {
66
+ typeName = DhtRpcService.typeName;
67
+ methods = DhtRpcService.methods;
68
+ options = DhtRpcService.options;
69
+ constructor(private readonly _transport: RpcTransport) {
70
+ }
71
+ /**
72
+ * @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse);
73
+ */
74
+ getClosestPeers(input: ClosestPeersRequest, options?: RpcOptions): UnaryCall<ClosestPeersRequest, ClosestPeersResponse> {
75
+ const method = this.methods[0], opt = this._transport.mergeOptions(options);
76
+ return stackIntercept<ClosestPeersRequest, ClosestPeersResponse>("unary", this._transport, method, opt, input);
77
+ }
78
+ /**
79
+ * @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse);
80
+ */
81
+ ping(input: PingRequest, options?: RpcOptions): UnaryCall<PingRequest, PingResponse> {
82
+ const method = this.methods[1], opt = this._transport.mergeOptions(options);
83
+ return stackIntercept<PingRequest, PingResponse>("unary", this._transport, method, opt, input);
84
+ }
85
+ /**
86
+ * @generated from protobuf rpc: leaveNotice(dht.LeaveNotice) returns (google.protobuf.Empty);
87
+ */
88
+ leaveNotice(input: LeaveNotice, options?: RpcOptions): UnaryCall<LeaveNotice, Empty> {
89
+ const method = this.methods[2], opt = this._transport.mergeOptions(options);
90
+ return stackIntercept<LeaveNotice, Empty>("unary", this._transport, method, opt, input);
91
+ }
92
+ }
93
+ /**
94
+ * @generated from protobuf service dht.RoutingService
95
+ */
96
+ export interface IRoutingServiceClient {
97
+ /**
98
+ * @generated from protobuf rpc: routeMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
99
+ */
100
+ routeMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall<RouteMessageWrapper, RouteMessageAck>;
101
+ /**
102
+ * @generated from protobuf rpc: forwardMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
103
+ */
104
+ forwardMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall<RouteMessageWrapper, RouteMessageAck>;
105
+ /**
106
+ * @generated from protobuf rpc: findRecursively(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
107
+ */
108
+ findRecursively(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall<RouteMessageWrapper, RouteMessageAck>;
109
+ }
110
+ /**
111
+ * @generated from protobuf service dht.RoutingService
112
+ */
113
+ export class RoutingServiceClient implements IRoutingServiceClient, ServiceInfo {
114
+ typeName = RoutingService.typeName;
115
+ methods = RoutingService.methods;
116
+ options = RoutingService.options;
117
+ constructor(private readonly _transport: RpcTransport) {
118
+ }
119
+ /**
120
+ * @generated from protobuf rpc: routeMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
121
+ */
122
+ routeMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall<RouteMessageWrapper, RouteMessageAck> {
123
+ const method = this.methods[0], opt = this._transport.mergeOptions(options);
124
+ return stackIntercept<RouteMessageWrapper, RouteMessageAck>("unary", this._transport, method, opt, input);
125
+ }
126
+ /**
127
+ * @generated from protobuf rpc: forwardMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
128
+ */
129
+ forwardMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall<RouteMessageWrapper, RouteMessageAck> {
130
+ const method = this.methods[1], opt = this._transport.mergeOptions(options);
131
+ return stackIntercept<RouteMessageWrapper, RouteMessageAck>("unary", this._transport, method, opt, input);
132
+ }
133
+ /**
134
+ * @generated from protobuf rpc: findRecursively(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
135
+ */
136
+ findRecursively(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall<RouteMessageWrapper, RouteMessageAck> {
137
+ const method = this.methods[2], opt = this._transport.mergeOptions(options);
138
+ return stackIntercept<RouteMessageWrapper, RouteMessageAck>("unary", this._transport, method, opt, input);
139
+ }
140
+ }
141
+ /**
142
+ * @generated from protobuf service dht.StoreService
143
+ */
144
+ export interface IStoreServiceClient {
145
+ /**
146
+ * @generated from protobuf rpc: storeData(dht.StoreDataRequest) returns (dht.StoreDataResponse);
147
+ */
148
+ storeData(input: StoreDataRequest, options?: RpcOptions): UnaryCall<StoreDataRequest, StoreDataResponse>;
149
+ /**
150
+ * @generated from protobuf rpc: migrateData(dht.MigrateDataRequest) returns (dht.MigrateDataResponse);
151
+ */
152
+ migrateData(input: MigrateDataRequest, options?: RpcOptions): UnaryCall<MigrateDataRequest, MigrateDataResponse>;
153
+ /**
154
+ * @generated from protobuf rpc: deleteData(dht.DeleteDataRequest) returns (dht.DeleteDataResponse);
155
+ */
156
+ deleteData(input: DeleteDataRequest, options?: RpcOptions): UnaryCall<DeleteDataRequest, DeleteDataResponse>;
157
+ }
158
+ /**
159
+ * @generated from protobuf service dht.StoreService
160
+ */
161
+ export class StoreServiceClient implements IStoreServiceClient, ServiceInfo {
162
+ typeName = StoreService.typeName;
163
+ methods = StoreService.methods;
164
+ options = StoreService.options;
165
+ constructor(private readonly _transport: RpcTransport) {
166
+ }
167
+ /**
168
+ * @generated from protobuf rpc: storeData(dht.StoreDataRequest) returns (dht.StoreDataResponse);
169
+ */
170
+ storeData(input: StoreDataRequest, options?: RpcOptions): UnaryCall<StoreDataRequest, StoreDataResponse> {
171
+ const method = this.methods[0], opt = this._transport.mergeOptions(options);
172
+ return stackIntercept<StoreDataRequest, StoreDataResponse>("unary", this._transport, method, opt, input);
173
+ }
174
+ /**
175
+ * @generated from protobuf rpc: migrateData(dht.MigrateDataRequest) returns (dht.MigrateDataResponse);
176
+ */
177
+ migrateData(input: MigrateDataRequest, options?: RpcOptions): UnaryCall<MigrateDataRequest, MigrateDataResponse> {
178
+ const method = this.methods[1], opt = this._transport.mergeOptions(options);
179
+ return stackIntercept<MigrateDataRequest, MigrateDataResponse>("unary", this._transport, method, opt, input);
180
+ }
181
+ /**
182
+ * @generated from protobuf rpc: deleteData(dht.DeleteDataRequest) returns (dht.DeleteDataResponse);
183
+ */
184
+ deleteData(input: DeleteDataRequest, options?: RpcOptions): UnaryCall<DeleteDataRequest, DeleteDataResponse> {
185
+ const method = this.methods[2], opt = this._transport.mergeOptions(options);
186
+ return stackIntercept<DeleteDataRequest, DeleteDataResponse>("unary", this._transport, method, opt, input);
187
+ }
188
+ }
189
+ /**
190
+ * @generated from protobuf service dht.RecursiveFindSessionService
191
+ */
192
+ export interface IRecursiveFindSessionServiceClient {
193
+ /**
194
+ * @generated from protobuf rpc: reportRecursiveFindResult(dht.RecursiveFindReport) returns (google.protobuf.Empty);
195
+ */
196
+ reportRecursiveFindResult(input: RecursiveFindReport, options?: RpcOptions): UnaryCall<RecursiveFindReport, Empty>;
197
+ }
198
+ /**
199
+ * @generated from protobuf service dht.RecursiveFindSessionService
200
+ */
201
+ export class RecursiveFindSessionServiceClient implements IRecursiveFindSessionServiceClient, ServiceInfo {
202
+ typeName = RecursiveFindSessionService.typeName;
203
+ methods = RecursiveFindSessionService.methods;
204
+ options = RecursiveFindSessionService.options;
205
+ constructor(private readonly _transport: RpcTransport) {
206
+ }
207
+ /**
208
+ * @generated from protobuf rpc: reportRecursiveFindResult(dht.RecursiveFindReport) returns (google.protobuf.Empty);
209
+ */
210
+ reportRecursiveFindResult(input: RecursiveFindReport, options?: RpcOptions): UnaryCall<RecursiveFindReport, Empty> {
211
+ const method = this.methods[0], opt = this._transport.mergeOptions(options);
212
+ return stackIntercept<RecursiveFindReport, Empty>("unary", this._transport, method, opt, input);
213
+ }
214
+ }
215
+ /**
216
+ * @generated from protobuf service dht.WebSocketConnectorService
217
+ */
218
+ export interface IWebSocketConnectorServiceClient {
219
+ /**
220
+ * @generated from protobuf rpc: requestConnection(dht.WebSocketConnectionRequest) returns (dht.WebSocketConnectionResponse);
221
+ */
222
+ requestConnection(input: WebSocketConnectionRequest, options?: RpcOptions): UnaryCall<WebSocketConnectionRequest, WebSocketConnectionResponse>;
223
+ }
224
+ /**
225
+ * @generated from protobuf service dht.WebSocketConnectorService
226
+ */
227
+ export class WebSocketConnectorServiceClient implements IWebSocketConnectorServiceClient, ServiceInfo {
228
+ typeName = WebSocketConnectorService.typeName;
229
+ methods = WebSocketConnectorService.methods;
230
+ options = WebSocketConnectorService.options;
231
+ constructor(private readonly _transport: RpcTransport) {
232
+ }
233
+ /**
234
+ * @generated from protobuf rpc: requestConnection(dht.WebSocketConnectionRequest) returns (dht.WebSocketConnectionResponse);
235
+ */
236
+ requestConnection(input: WebSocketConnectionRequest, options?: RpcOptions): UnaryCall<WebSocketConnectionRequest, WebSocketConnectionResponse> {
237
+ const method = this.methods[0], opt = this._transport.mergeOptions(options);
238
+ return stackIntercept<WebSocketConnectionRequest, WebSocketConnectionResponse>("unary", this._transport, method, opt, input);
239
+ }
240
+ }
241
+ /**
242
+ * @generated from protobuf service dht.WebRtcConnectorService
243
+ */
244
+ export interface IWebRtcConnectorServiceClient {
245
+ /**
246
+ * @generated from protobuf rpc: requestConnection(dht.WebRtcConnectionRequest) returns (google.protobuf.Empty);
247
+ */
248
+ requestConnection(input: WebRtcConnectionRequest, options?: RpcOptions): UnaryCall<WebRtcConnectionRequest, Empty>;
249
+ /**
250
+ * @generated from protobuf rpc: rtcOffer(dht.RtcOffer) returns (google.protobuf.Empty);
251
+ */
252
+ rtcOffer(input: RtcOffer, options?: RpcOptions): UnaryCall<RtcOffer, Empty>;
253
+ /**
254
+ * @generated from protobuf rpc: rtcAnswer(dht.RtcAnswer) returns (google.protobuf.Empty);
255
+ */
256
+ rtcAnswer(input: RtcAnswer, options?: RpcOptions): UnaryCall<RtcAnswer, Empty>;
257
+ /**
258
+ * @generated from protobuf rpc: iceCandidate(dht.IceCandidate) returns (google.protobuf.Empty);
259
+ */
260
+ iceCandidate(input: IceCandidate, options?: RpcOptions): UnaryCall<IceCandidate, Empty>;
261
+ }
262
+ /**
263
+ * @generated from protobuf service dht.WebRtcConnectorService
264
+ */
265
+ export class WebRtcConnectorServiceClient implements IWebRtcConnectorServiceClient, ServiceInfo {
266
+ typeName = WebRtcConnectorService.typeName;
267
+ methods = WebRtcConnectorService.methods;
268
+ options = WebRtcConnectorService.options;
269
+ constructor(private readonly _transport: RpcTransport) {
270
+ }
271
+ /**
272
+ * @generated from protobuf rpc: requestConnection(dht.WebRtcConnectionRequest) returns (google.protobuf.Empty);
273
+ */
274
+ requestConnection(input: WebRtcConnectionRequest, options?: RpcOptions): UnaryCall<WebRtcConnectionRequest, Empty> {
275
+ const method = this.methods[0], opt = this._transport.mergeOptions(options);
276
+ return stackIntercept<WebRtcConnectionRequest, Empty>("unary", this._transport, method, opt, input);
277
+ }
278
+ /**
279
+ * @generated from protobuf rpc: rtcOffer(dht.RtcOffer) returns (google.protobuf.Empty);
280
+ */
281
+ rtcOffer(input: RtcOffer, options?: RpcOptions): UnaryCall<RtcOffer, Empty> {
282
+ const method = this.methods[1], opt = this._transport.mergeOptions(options);
283
+ return stackIntercept<RtcOffer, Empty>("unary", this._transport, method, opt, input);
284
+ }
285
+ /**
286
+ * @generated from protobuf rpc: rtcAnswer(dht.RtcAnswer) returns (google.protobuf.Empty);
287
+ */
288
+ rtcAnswer(input: RtcAnswer, options?: RpcOptions): UnaryCall<RtcAnswer, Empty> {
289
+ const method = this.methods[2], opt = this._transport.mergeOptions(options);
290
+ return stackIntercept<RtcAnswer, Empty>("unary", this._transport, method, opt, input);
291
+ }
292
+ /**
293
+ * @generated from protobuf rpc: iceCandidate(dht.IceCandidate) returns (google.protobuf.Empty);
294
+ */
295
+ iceCandidate(input: IceCandidate, options?: RpcOptions): UnaryCall<IceCandidate, Empty> {
296
+ const method = this.methods[3], opt = this._transport.mergeOptions(options);
297
+ return stackIntercept<IceCandidate, Empty>("unary", this._transport, method, opt, input);
298
+ }
299
+ }
300
+ /**
301
+ * @generated from protobuf service dht.ConnectionLocker
302
+ */
303
+ export interface IConnectionLockerClient {
304
+ /**
305
+ * @generated from protobuf rpc: lockRequest(dht.LockRequest) returns (dht.LockResponse);
306
+ */
307
+ lockRequest(input: LockRequest, options?: RpcOptions): UnaryCall<LockRequest, LockResponse>;
308
+ /**
309
+ * @generated from protobuf rpc: unlockRequest(dht.UnlockRequest) returns (google.protobuf.Empty);
310
+ */
311
+ unlockRequest(input: UnlockRequest, options?: RpcOptions): UnaryCall<UnlockRequest, Empty>;
312
+ /**
313
+ * @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (dht.DisconnectNoticeResponse);
314
+ */
315
+ gracefulDisconnect(input: DisconnectNotice, options?: RpcOptions): UnaryCall<DisconnectNotice, DisconnectNoticeResponse>;
316
+ }
317
+ /**
318
+ * @generated from protobuf service dht.ConnectionLocker
319
+ */
320
+ export class ConnectionLockerClient implements IConnectionLockerClient, ServiceInfo {
321
+ typeName = ConnectionLocker.typeName;
322
+ methods = ConnectionLocker.methods;
323
+ options = ConnectionLocker.options;
324
+ constructor(private readonly _transport: RpcTransport) {
325
+ }
326
+ /**
327
+ * @generated from protobuf rpc: lockRequest(dht.LockRequest) returns (dht.LockResponse);
328
+ */
329
+ lockRequest(input: LockRequest, options?: RpcOptions): UnaryCall<LockRequest, LockResponse> {
330
+ const method = this.methods[0], opt = this._transport.mergeOptions(options);
331
+ return stackIntercept<LockRequest, LockResponse>("unary", this._transport, method, opt, input);
332
+ }
333
+ /**
334
+ * @generated from protobuf rpc: unlockRequest(dht.UnlockRequest) returns (google.protobuf.Empty);
335
+ */
336
+ unlockRequest(input: UnlockRequest, options?: RpcOptions): UnaryCall<UnlockRequest, Empty> {
337
+ const method = this.methods[1], opt = this._transport.mergeOptions(options);
338
+ return stackIntercept<UnlockRequest, Empty>("unary", this._transport, method, opt, input);
339
+ }
340
+ /**
341
+ * @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (dht.DisconnectNoticeResponse);
342
+ */
343
+ gracefulDisconnect(input: DisconnectNotice, options?: RpcOptions): UnaryCall<DisconnectNotice, DisconnectNoticeResponse> {
344
+ const method = this.methods[2], opt = this._transport.mergeOptions(options);
345
+ return stackIntercept<DisconnectNotice, DisconnectNoticeResponse>("unary", this._transport, method, opt, input);
346
+ }
347
+ }
348
+ /**
349
+ * @generated from protobuf service dht.ExternalApiService
350
+ */
351
+ export interface IExternalApiServiceClient {
352
+ /**
353
+ * @generated from protobuf rpc: findData(dht.FindDataRequest) returns (dht.FindDataResponse);
354
+ */
355
+ findData(input: FindDataRequest, options?: RpcOptions): UnaryCall<FindDataRequest, FindDataResponse>;
356
+ }
357
+ /**
358
+ * @generated from protobuf service dht.ExternalApiService
359
+ */
360
+ export class ExternalApiServiceClient implements IExternalApiServiceClient, ServiceInfo {
361
+ typeName = ExternalApiService.typeName;
362
+ methods = ExternalApiService.methods;
363
+ options = ExternalApiService.options;
364
+ constructor(private readonly _transport: RpcTransport) {
365
+ }
366
+ /**
367
+ * @generated from protobuf rpc: findData(dht.FindDataRequest) returns (dht.FindDataResponse);
368
+ */
369
+ findData(input: FindDataRequest, options?: RpcOptions): UnaryCall<FindDataRequest, FindDataResponse> {
370
+ const method = this.methods[0], opt = this._transport.mergeOptions(options);
371
+ return stackIntercept<FindDataRequest, FindDataResponse>("unary", this._transport, method, opt, input);
372
+ }
373
+ }