@streamr/dht 100.2.5-beta.1 → 101.0.0-beta.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 (231) hide show
  1. package/dist/package.json +7 -7
  2. package/dist/src/connection/ConnectionLockRpcLocal.d.ts +3 -3
  3. package/dist/src/connection/ConnectionLockRpcLocal.js +8 -8
  4. package/dist/src/connection/ConnectionLockRpcLocal.js.map +1 -1
  5. package/dist/src/connection/ConnectionLockRpcRemote.js +1 -1
  6. package/dist/src/connection/ConnectionLockRpcRemote.js.map +1 -1
  7. package/dist/src/connection/ConnectionManager.d.ts +4 -6
  8. package/dist/src/connection/ConnectionManager.js +128 -103
  9. package/dist/src/connection/ConnectionManager.js.map +1 -1
  10. package/dist/src/connection/ConnectorFacade.d.ts +15 -14
  11. package/dist/src/connection/ConnectorFacade.js +70 -52
  12. package/dist/src/connection/ConnectorFacade.js.map +1 -1
  13. package/dist/src/connection/Handshaker.d.ts +9 -2
  14. package/dist/src/connection/Handshaker.js +117 -27
  15. package/dist/src/connection/Handshaker.js.map +1 -1
  16. package/dist/src/connection/ManagedConnection.d.ts +13 -38
  17. package/dist/src/connection/ManagedConnection.js +31 -252
  18. package/dist/src/connection/ManagedConnection.js.map +1 -1
  19. package/dist/src/connection/OutputBuffer.d.ts +9 -0
  20. package/dist/src/connection/OutputBuffer.js +26 -0
  21. package/dist/src/connection/OutputBuffer.js.map +1 -0
  22. package/dist/src/connection/PendingConnection.d.ts +19 -0
  23. package/dist/src/connection/PendingConnection.js +59 -0
  24. package/dist/src/connection/PendingConnection.js.map +1 -0
  25. package/dist/src/connection/connectivityChecker.js +3 -3
  26. package/dist/src/connection/connectivityChecker.js.map +1 -1
  27. package/dist/src/connection/connectivityRequestHandler.js +2 -2
  28. package/dist/src/connection/connectivityRequestHandler.js.map +1 -1
  29. package/dist/src/connection/simulator/Simulator.d.ts +1 -3
  30. package/dist/src/connection/simulator/Simulator.js +1 -4
  31. package/dist/src/connection/simulator/Simulator.js.map +1 -1
  32. package/dist/src/connection/simulator/SimulatorConnection.js +1 -2
  33. package/dist/src/connection/simulator/SimulatorConnection.js.map +1 -1
  34. package/dist/src/connection/simulator/SimulatorConnector.d.ts +3 -3
  35. package/dist/src/connection/simulator/SimulatorConnector.js +28 -21
  36. package/dist/src/connection/simulator/SimulatorConnector.js.map +1 -1
  37. package/dist/src/connection/webrtc/NodeWebrtcConnection.d.ts +1 -6
  38. package/dist/src/connection/webrtc/NodeWebrtcConnection.js +3 -20
  39. package/dist/src/connection/webrtc/NodeWebrtcConnection.js.map +1 -1
  40. package/dist/src/connection/webrtc/WebrtcConnector.d.ts +11 -6
  41. package/dist/src/connection/webrtc/WebrtcConnector.js +57 -42
  42. package/dist/src/connection/webrtc/WebrtcConnector.js.map +1 -1
  43. package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.d.ts +8 -10
  44. package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js +21 -44
  45. package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js.map +1 -1
  46. package/dist/src/connection/websocket/AbstractWebsocketClientConnection.js +8 -2
  47. package/dist/src/connection/websocket/AbstractWebsocketClientConnection.js.map +1 -1
  48. package/dist/src/connection/websocket/AutoCertifierClientFacade.d.ts +3 -3
  49. package/dist/src/connection/websocket/AutoCertifierClientFacade.js +8 -8
  50. package/dist/src/connection/websocket/AutoCertifierClientFacade.js.map +1 -1
  51. package/dist/src/connection/websocket/NodeWebsocketClientConnection.js +1 -1
  52. package/dist/src/connection/websocket/NodeWebsocketClientConnection.js.map +1 -1
  53. package/dist/src/connection/websocket/WebsocketClientConnector.d.ts +26 -0
  54. package/dist/src/connection/websocket/WebsocketClientConnector.js +86 -0
  55. package/dist/src/connection/websocket/WebsocketClientConnector.js.map +1 -0
  56. package/dist/src/connection/websocket/WebsocketClientConnectorRpcLocal.d.ts +19 -0
  57. package/dist/src/connection/websocket/WebsocketClientConnectorRpcLocal.js +23 -0
  58. package/dist/src/connection/websocket/WebsocketClientConnectorRpcLocal.js.map +1 -0
  59. package/dist/src/connection/websocket/WebsocketClientConnectorRpcRemote.d.ts +5 -0
  60. package/dist/src/connection/websocket/{WebsocketConnectorRpcRemote.js → WebsocketClientConnectorRpcRemote.js} +4 -4
  61. package/dist/src/connection/websocket/WebsocketClientConnectorRpcRemote.js.map +1 -0
  62. package/dist/src/connection/websocket/WebsocketServer.d.ts +8 -5
  63. package/dist/src/connection/websocket/WebsocketServer.js +11 -11
  64. package/dist/src/connection/websocket/WebsocketServer.js.map +1 -1
  65. package/dist/src/connection/websocket/{WebsocketConnector.d.ts → WebsocketServerConnector.d.ts} +16 -21
  66. package/dist/src/connection/websocket/{WebsocketConnector.js → WebsocketServerConnector.js} +112 -160
  67. package/dist/src/connection/websocket/WebsocketServerConnector.js.map +1 -0
  68. package/dist/src/dht/DhtNode.d.ts +4 -4
  69. package/dist/src/dht/DhtNode.js +85 -84
  70. package/dist/src/dht/DhtNode.js.map +1 -1
  71. package/dist/src/dht/DhtNodeRpcLocal.d.ts +3 -3
  72. package/dist/src/dht/DhtNodeRpcLocal.js +9 -9
  73. package/dist/src/dht/DhtNodeRpcLocal.js.map +1 -1
  74. package/dist/src/dht/ExternalApiRpcLocal.d.ts +3 -3
  75. package/dist/src/dht/ExternalApiRpcLocal.js +5 -5
  76. package/dist/src/dht/ExternalApiRpcLocal.js.map +1 -1
  77. package/dist/src/dht/ExternalApiRpcRemote.js +2 -2
  78. package/dist/src/dht/ExternalApiRpcRemote.js.map +1 -1
  79. package/dist/src/dht/PeerManager.d.ts +4 -4
  80. package/dist/src/dht/PeerManager.js +22 -22
  81. package/dist/src/dht/PeerManager.js.map +1 -1
  82. package/dist/src/dht/contact/SortedContactList.d.ts +3 -3
  83. package/dist/src/dht/contact/SortedContactList.js +9 -9
  84. package/dist/src/dht/contact/SortedContactList.js.map +1 -1
  85. package/dist/src/dht/discovery/DiscoverySession.d.ts +3 -3
  86. package/dist/src/dht/discovery/DiscoverySession.js +21 -21
  87. package/dist/src/dht/discovery/DiscoverySession.js.map +1 -1
  88. package/dist/src/dht/discovery/PeerDiscovery.d.ts +3 -3
  89. package/dist/src/dht/discovery/PeerDiscovery.js +46 -44
  90. package/dist/src/dht/discovery/PeerDiscovery.js.map +1 -1
  91. package/dist/src/dht/discovery/RingDiscoverySession.d.ts +3 -3
  92. package/dist/src/dht/discovery/RingDiscoverySession.js +19 -19
  93. package/dist/src/dht/discovery/RingDiscoverySession.js.map +1 -1
  94. package/dist/src/dht/recursive-operation/RecursiveOperationManager.d.ts +3 -3
  95. package/dist/src/dht/recursive-operation/RecursiveOperationManager.js +33 -33
  96. package/dist/src/dht/recursive-operation/RecursiveOperationManager.js.map +1 -1
  97. package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.d.ts +3 -3
  98. package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js +8 -8
  99. package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js.map +1 -1
  100. package/dist/src/dht/recursive-operation/RecursiveOperationSession.d.ts +4 -4
  101. package/dist/src/dht/recursive-operation/RecursiveOperationSession.js +24 -24
  102. package/dist/src/dht/recursive-operation/RecursiveOperationSession.js.map +1 -1
  103. package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.d.ts +4 -4
  104. package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js +5 -5
  105. package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js.map +1 -1
  106. package/dist/src/dht/routing/Router.d.ts +3 -3
  107. package/dist/src/dht/routing/Router.js +20 -20
  108. package/dist/src/dht/routing/Router.js.map +1 -1
  109. package/dist/src/dht/routing/RouterRpcLocal.d.ts +3 -3
  110. package/dist/src/dht/routing/RouterRpcLocal.js +16 -16
  111. package/dist/src/dht/routing/RouterRpcLocal.js.map +1 -1
  112. package/dist/src/dht/routing/RoutingSession.d.ts +3 -3
  113. package/dist/src/dht/routing/RoutingSession.js +24 -24
  114. package/dist/src/dht/routing/RoutingSession.js.map +1 -1
  115. package/dist/src/dht/store/StoreManager.d.ts +3 -3
  116. package/dist/src/dht/store/StoreManager.js +25 -25
  117. package/dist/src/dht/store/StoreManager.js.map +1 -1
  118. package/dist/src/dht/store/StoreRpcLocal.d.ts +3 -3
  119. package/dist/src/dht/store/StoreRpcLocal.js +12 -12
  120. package/dist/src/dht/store/StoreRpcLocal.js.map +1 -1
  121. package/dist/src/exports.d.ts +3 -0
  122. package/dist/src/exports.js +5 -1
  123. package/dist/src/exports.js.map +1 -1
  124. package/dist/src/proto/google/protobuf/any.d.ts +5 -8
  125. package/dist/src/proto/google/protobuf/any.js.map +1 -1
  126. package/dist/src/proto/google/protobuf/empty.d.ts +1 -0
  127. package/dist/src/proto/google/protobuf/empty.js.map +1 -1
  128. package/dist/src/proto/google/protobuf/timestamp.d.ts +1 -10
  129. package/dist/src/proto/google/protobuf/timestamp.js.map +1 -1
  130. package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +4 -4
  131. package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +8 -8
  132. package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
  133. package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +3 -3
  134. package/dist/src/proto/packages/dht/protos/DhtRpc.js +4 -4
  135. package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
  136. package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +2 -2
  137. package/dist/src/proto/packages/proto-rpc/protos/ProtoRpc.js +1 -1
  138. package/dist/src/transport/ListeningRpcCommunicator.d.ts +2 -2
  139. package/dist/src/transport/ListeningRpcCommunicator.js +2 -2
  140. package/dist/src/transport/ListeningRpcCommunicator.js.map +1 -1
  141. package/dist/src/transport/RoutingRpcCommunicator.d.ts +2 -2
  142. package/dist/src/transport/RoutingRpcCommunicator.js +2 -2
  143. package/dist/src/transport/RoutingRpcCommunicator.js.map +1 -1
  144. package/package.json +7 -7
  145. package/protos/DhtRpc.proto +1 -1
  146. package/src/connection/ConnectionLockRpcLocal.ts +9 -9
  147. package/src/connection/ConnectionLockRpcRemote.ts +1 -1
  148. package/src/connection/ConnectionManager.ts +153 -111
  149. package/src/connection/ConnectorFacade.ts +84 -61
  150. package/src/connection/Handshaker.ts +131 -27
  151. package/src/connection/ManagedConnection.ts +41 -304
  152. package/src/connection/OutputBuffer.ts +28 -0
  153. package/src/connection/PendingConnection.ts +68 -0
  154. package/src/connection/connectivityChecker.ts +2 -2
  155. package/src/connection/connectivityRequestHandler.ts +1 -1
  156. package/src/connection/simulator/Simulator.ts +1 -5
  157. package/src/connection/simulator/SimulatorConnection.ts +1 -2
  158. package/src/connection/simulator/SimulatorConnector.ts +34 -33
  159. package/src/connection/webrtc/BrowserWebrtcConnection.ts +0 -6
  160. package/src/connection/webrtc/NodeWebrtcConnection.ts +3 -24
  161. package/src/connection/webrtc/WebrtcConnector.ts +73 -62
  162. package/src/connection/webrtc/WebrtcConnectorRpcLocal.ts +26 -56
  163. package/src/connection/websocket/AbstractWebsocketClientConnection.ts +8 -2
  164. package/src/connection/websocket/AutoCertifierClientFacade.ts +11 -11
  165. package/src/connection/websocket/NodeWebsocketClientConnection.ts +1 -1
  166. package/src/connection/websocket/WebsocketClientConnector.ts +119 -0
  167. package/src/connection/websocket/WebsocketClientConnectorRpcLocal.ts +39 -0
  168. package/src/connection/websocket/{WebsocketConnectorRpcRemote.ts → WebsocketClientConnectorRpcRemote.ts} +2 -2
  169. package/src/connection/websocket/WebsocketServer.ts +18 -14
  170. package/src/connection/websocket/{WebsocketConnector.ts → WebsocketServerConnector.ts} +128 -205
  171. package/src/dht/DhtNode.ts +90 -89
  172. package/src/dht/DhtNodeRpcLocal.ts +11 -11
  173. package/src/dht/ExternalApiRpcLocal.ts +6 -6
  174. package/src/dht/ExternalApiRpcRemote.ts +2 -2
  175. package/src/dht/PeerManager.ts +24 -24
  176. package/src/dht/contact/SortedContactList.ts +10 -10
  177. package/src/dht/discovery/DiscoverySession.ts +24 -24
  178. package/src/dht/discovery/PeerDiscovery.ts +47 -45
  179. package/src/dht/discovery/RingDiscoverySession.ts +23 -23
  180. package/src/dht/recursive-operation/RecursiveOperationManager.ts +36 -36
  181. package/src/dht/recursive-operation/RecursiveOperationRpcLocal.ts +9 -9
  182. package/src/dht/recursive-operation/RecursiveOperationSession.ts +25 -25
  183. package/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.ts +7 -7
  184. package/src/dht/routing/Router.ts +21 -21
  185. package/src/dht/routing/RouterRpcLocal.ts +17 -17
  186. package/src/dht/routing/RoutingSession.ts +26 -26
  187. package/src/dht/store/StoreManager.ts +27 -27
  188. package/src/dht/store/StoreRpcLocal.ts +13 -13
  189. package/src/exports.ts +3 -0
  190. package/src/proto/google/protobuf/any.ts +6 -9
  191. package/src/proto/google/protobuf/empty.ts +2 -1
  192. package/src/proto/google/protobuf/timestamp.ts +2 -11
  193. package/src/proto/packages/dht/protos/DhtRpc.client.ts +9 -9
  194. package/src/proto/packages/dht/protos/DhtRpc.server.ts +3 -3
  195. package/src/proto/packages/dht/protos/DhtRpc.ts +4 -4
  196. package/src/proto/packages/proto-rpc/protos/ProtoRpc.ts +1 -1
  197. package/src/transport/ListeningRpcCommunicator.ts +3 -3
  198. package/src/transport/RoutingRpcCommunicator.ts +3 -3
  199. package/test/end-to-end/Layer0Webrtc.test.ts +0 -10
  200. package/test/integration/ConnectionManager.test.ts +3 -2
  201. package/test/integration/GeoIpConnectivityChecking.test.ts +1 -1
  202. package/test/integration/SimultaneousConnections.test.ts +2 -2
  203. package/test/integration/WebrtcConnectionManagement.test.ts +2 -10
  204. package/test/integration/{WebsocketConnectorRpc.test.ts → WebsocketClientConnectorRpc.test.ts} +9 -9
  205. package/test/integration/WebsocketConnectionManagement.test.ts +11 -29
  206. package/test/unit/ConnectionManager.test.ts +64 -0
  207. package/test/unit/DiscoverySession.test.ts +1 -1
  208. package/test/unit/Handshaker.test.ts +169 -0
  209. package/test/unit/ManagedConnection.test.ts +58 -0
  210. package/test/unit/PendingConnection.test.ts +57 -0
  211. package/test/unit/WebrtcConnector.test.ts +56 -0
  212. package/test/unit/{WebsocketConnector.test.ts → WebsocketClientConnector.test.ts} +56 -11
  213. package/test/unit/WebsocketServerConnector.test.ts +102 -0
  214. package/test/utils/FakeConnectorFacade.ts +41 -0
  215. package/test/utils/mock/MockConnection.ts +26 -0
  216. package/test/utils/utils.ts +2 -2
  217. package/dist/src/connection/IConnectionSource.d.ts +0 -4
  218. package/dist/src/connection/IConnectionSource.js +0 -3
  219. package/dist/src/connection/IConnectionSource.js.map +0 -1
  220. package/dist/src/connection/webrtc/ManagedWebrtcConnection.d.ts +0 -7
  221. package/dist/src/connection/webrtc/ManagedWebrtcConnection.js +0 -20
  222. package/dist/src/connection/webrtc/ManagedWebrtcConnection.js.map +0 -1
  223. package/dist/src/connection/websocket/WebsocketConnector.js.map +0 -1
  224. package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.d.ts +0 -19
  225. package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js +0 -23
  226. package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js.map +0 -1
  227. package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.d.ts +0 -5
  228. package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.js.map +0 -1
  229. package/src/connection/IConnectionSource.ts +0 -6
  230. package/src/connection/webrtc/ManagedWebrtcConnection.ts +0 -27
  231. package/src/connection/websocket/WebsocketConnectorRpcLocal.ts +0 -39
@@ -11,7 +11,7 @@ import { sample } from 'lodash'
11
11
  import { MarkRequired } from 'ts-essentials'
12
12
  import { ConnectionLocker, ConnectionManager, PortRange, TlsCertificate } from '../connection/ConnectionManager'
13
13
  import { ConnectionsView } from '../connection/ConnectionsView'
14
- import { DefaultConnectorFacade, DefaultConnectorFacadeConfig } from '../connection/ConnectorFacade'
14
+ import { DefaultConnectorFacade, DefaultConnectorFacadeOptions } from '../connection/ConnectorFacade'
15
15
  import { IceServer } from '../connection/webrtc/WebrtcConnector'
16
16
  import { isBrowserEnvironment } from '../helpers/browser/isBrowserEnvironment'
17
17
  import { createPeerDescriptor } from '../helpers/createPeerDescriptor'
@@ -67,7 +67,7 @@ export interface DhtNodeEvents {
67
67
  export interface DhtNodeOptions {
68
68
  serviceId?: ServiceID
69
69
  joinParallelism?: number
70
- maxNeighborListSize?: number
70
+ maxContactCount?: number
71
71
  numberOfNodesPerKBucket?: number
72
72
  joinNoProgressLimit?: number
73
73
  peerDiscoveryQueryBatchSize?: number
@@ -96,7 +96,6 @@ export interface DhtNodeOptions {
96
96
  webrtcAllowPrivateAddresses?: boolean
97
97
  webrtcDatachannelBufferThresholdLow?: number
98
98
  webrtcDatachannelBufferThresholdHigh?: number
99
- webrtcNewConnectionTimeout?: number
100
99
  webrtcPortRange?: PortRange
101
100
  maxMessageSize?: number
102
101
  maxConnections?: number
@@ -110,7 +109,7 @@ export interface DhtNodeOptions {
110
109
  type StrictDhtNodeOptions = MarkRequired<DhtNodeOptions,
111
110
  'serviceId' |
112
111
  'joinParallelism' |
113
- 'maxNeighborListSize' |
112
+ 'maxContactCount' |
114
113
  'numberOfNodesPerKBucket' |
115
114
  'joinNoProgressLimit' |
116
115
  'dhtJoinTimeout' |
@@ -126,11 +125,14 @@ const logger = new Logger(module)
126
125
 
127
126
  const PERIODICAL_PING_INTERVAL = 60 * 1000
128
127
 
128
+ // TODO move this to trackerless-network package and change serviceId to be a required paramater
129
+ export const CONTROL_LAYER_NODE_SERVICE_ID = 'layer0'
130
+
129
131
  export type Events = TransportEvents & DhtNodeEvents
130
132
 
131
133
  export class DhtNode extends EventEmitter<Events> implements ITransport {
132
134
 
133
- private readonly config: StrictDhtNodeOptions
135
+ private readonly options: StrictDhtNodeOptions
134
136
  private rpcCommunicator?: RoutingRpcCommunicator
135
137
  private transport?: ITransport
136
138
  private localPeerDescriptor?: PeerDescriptor
@@ -147,10 +149,10 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
147
149
 
148
150
  constructor(conf: DhtNodeOptions) {
149
151
  super()
150
- this.config = merge({
151
- serviceId: 'layer0',
152
+ this.options = merge({
153
+ serviceId: CONTROL_LAYER_NODE_SERVICE_ID,
152
154
  joinParallelism: 3,
153
- maxNeighborListSize: 200,
155
+ maxContactCount: 200,
154
156
  numberOfNodesPerKBucket: 8,
155
157
  joinNoProgressLimit: 5,
156
158
  dhtJoinTimeout: 60000,
@@ -162,26 +164,26 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
162
164
  storageRedundancyFactor: 5, // TODO validate that this is > 1 (as each node should replicate the data to other node)
163
165
  metricsContext: new MetricsContext()
164
166
  }, conf)
165
- this.validateConfig()
166
- this.localDataStore = new LocalDataStore(this.config.storeMaxTtl)
167
+ this.validateOptions()
168
+ this.localDataStore = new LocalDataStore(this.options.storeMaxTtl)
167
169
  this.send = this.send.bind(this)
168
170
  }
169
171
 
170
- private validateConfig(): void {
172
+ private validateOptions(): void {
171
173
  const expectedNodeIdLength = KADEMLIA_ID_LENGTH_IN_BYTES * 2
172
- if (this.config.nodeId !== undefined) {
173
- if (!/^[0-9a-fA-F]+$/.test(this.config.nodeId)) {
174
+ if (this.options.nodeId !== undefined) {
175
+ if (!/^[0-9a-fA-F]+$/.test(this.options.nodeId)) {
174
176
  throw new Error('Invalid nodeId, the nodeId should be a hex string')
175
- } else if (this.config.nodeId.length !== expectedNodeIdLength) {
177
+ } else if (this.options.nodeId.length !== expectedNodeIdLength) {
176
178
  throw new Error(`Invalid nodeId, the length of the nodeId should be ${expectedNodeIdLength}`)
177
179
  }
178
180
  }
179
- if (this.config.peerDescriptor !== undefined) {
180
- if (this.config.peerDescriptor.nodeId.length !== KADEMLIA_ID_LENGTH_IN_BYTES) {
181
+ if (this.options.peerDescriptor !== undefined) {
182
+ if (this.options.peerDescriptor.nodeId.length !== KADEMLIA_ID_LENGTH_IN_BYTES) {
181
183
  throw new Error(`Invalid peerDescriptor, the length of the nodeId should be ${KADEMLIA_ID_LENGTH_IN_BYTES} bytes`)
182
184
  }
183
185
  }
184
- if (this.config.transport !== undefined && this.config.connectionsView === undefined) {
186
+ if (this.options.transport !== undefined && this.options.connectionsView === undefined) {
185
187
  throw new Error('connectionsView is required when transport is given')
186
188
  }
187
189
  }
@@ -190,58 +192,57 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
190
192
  if (this.started || this.abortController.signal.aborted) {
191
193
  return
192
194
  }
193
- logger.trace(`Starting new Streamr Network DHT Node with serviceId ${this.config.serviceId}`)
195
+ logger.trace(`Starting new Streamr Network DHT Node with serviceId ${this.options.serviceId}`)
194
196
  this.started = true
195
197
 
196
198
  if (isBrowserEnvironment()) {
197
- this.config.websocketPortRange = undefined
198
- if (this.config.peerDescriptor) {
199
- this.config.peerDescriptor.websocket = undefined
199
+ this.options.websocketPortRange = undefined
200
+ if (this.options.peerDescriptor) {
201
+ this.options.peerDescriptor.websocket = undefined
200
202
  }
201
203
  }
202
204
 
203
205
  // If transport is given, do not create a ConnectionManager
204
- if (this.config.transport) {
205
- this.transport = this.config.transport
206
- this.connectionsView = this.config.connectionsView
207
- this.connectionLocker = this.config.connectionLocker
206
+ if (this.options.transport) {
207
+ this.transport = this.options.transport
208
+ this.connectionsView = this.options.connectionsView
209
+ this.connectionLocker = this.options.connectionLocker
208
210
  this.localPeerDescriptor = this.transport.getLocalPeerDescriptor()
209
211
  } else {
210
- const connectorFacadeConfig: DefaultConnectorFacadeConfig = {
212
+ const connectorFacadeOptions: DefaultConnectorFacadeOptions = {
211
213
  transport: this,
212
- entryPoints: this.config.entryPoints,
213
- iceServers: this.config.iceServers,
214
- webrtcAllowPrivateAddresses: this.config.webrtcAllowPrivateAddresses,
215
- webrtcDatachannelBufferThresholdLow: this.config.webrtcDatachannelBufferThresholdLow,
216
- webrtcDatachannelBufferThresholdHigh: this.config.webrtcDatachannelBufferThresholdHigh,
217
- webrtcNewConnectionTimeout: this.config.webrtcNewConnectionTimeout,
218
- webrtcPortRange: this.config.webrtcPortRange,
219
- maxMessageSize: this.config.maxMessageSize,
220
- websocketServerEnableTls: this.config.websocketServerEnableTls,
221
- tlsCertificate: this.config.tlsCertificate,
222
- externalIp: this.config.externalIp,
223
- autoCertifierUrl: this.config.autoCertifierUrl,
224
- autoCertifierConfigFile: this.config.autoCertifierConfigFile,
225
- geoIpDatabaseFolder: this.config.geoIpDatabaseFolder,
214
+ entryPoints: this.options.entryPoints,
215
+ iceServers: this.options.iceServers,
216
+ webrtcAllowPrivateAddresses: this.options.webrtcAllowPrivateAddresses,
217
+ webrtcDatachannelBufferThresholdLow: this.options.webrtcDatachannelBufferThresholdLow,
218
+ webrtcDatachannelBufferThresholdHigh: this.options.webrtcDatachannelBufferThresholdHigh,
219
+ webrtcPortRange: this.options.webrtcPortRange,
220
+ maxMessageSize: this.options.maxMessageSize,
221
+ websocketServerEnableTls: this.options.websocketServerEnableTls,
222
+ tlsCertificate: this.options.tlsCertificate,
223
+ externalIp: this.options.externalIp,
224
+ autoCertifierUrl: this.options.autoCertifierUrl,
225
+ autoCertifierConfigFile: this.options.autoCertifierConfigFile,
226
+ geoIpDatabaseFolder: this.options.geoIpDatabaseFolder,
226
227
  createLocalPeerDescriptor: (connectivityResponse: ConnectivityResponse) => this.generatePeerDescriptorCallBack(connectivityResponse)
227
228
  }
228
- // If own PeerDescriptor is given in config, create a ConnectionManager with ws server
229
- if (this.config.peerDescriptor?.websocket) {
230
- connectorFacadeConfig.websocketHost = this.config.peerDescriptor.websocket.host
231
- connectorFacadeConfig.websocketPortRange = {
232
- min: this.config.peerDescriptor.websocket.port,
233
- max: this.config.peerDescriptor.websocket.port
229
+ // If own PeerDescriptor is given in options, create a ConnectionManager with ws server
230
+ if (this.options.peerDescriptor?.websocket) {
231
+ connectorFacadeOptions.websocketHost = this.options.peerDescriptor.websocket.host
232
+ connectorFacadeOptions.websocketPortRange = {
233
+ min: this.options.peerDescriptor.websocket.port,
234
+ max: this.options.peerDescriptor.websocket.port
234
235
  }
235
236
  // If websocketPortRange is given, create ws server using it, websocketHost can be undefined
236
- } else if (this.config.websocketPortRange) {
237
- connectorFacadeConfig.websocketHost = this.config.websocketHost
238
- connectorFacadeConfig.websocketPortRange = this.config.websocketPortRange
237
+ } else if (this.options.websocketPortRange) {
238
+ connectorFacadeOptions.websocketHost = this.options.websocketHost
239
+ connectorFacadeOptions.websocketPortRange = this.options.websocketPortRange
239
240
  }
240
241
 
241
242
  const connectionManager = new ConnectionManager({
242
- createConnectorFacade: () => new DefaultConnectorFacade(connectorFacadeConfig),
243
- maxConnections: this.config.maxConnections,
244
- metricsContext: this.config.metricsContext
243
+ createConnectorFacade: () => new DefaultConnectorFacade(connectorFacadeOptions),
244
+ maxConnections: this.options.maxConnections,
245
+ metricsContext: this.options.metricsContext
245
246
  })
246
247
  await connectionManager.start()
247
248
  this.connectionsView = connectionManager
@@ -250,9 +251,9 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
250
251
  }
251
252
 
252
253
  this.rpcCommunicator = new RoutingRpcCommunicator(
253
- this.config.serviceId,
254
+ this.options.serviceId,
254
255
  (msg, opts) => this.transport!.send(msg, opts),
255
- { rpcRequestTimeout: this.config.rpcRequestTimeout }
256
+ { rpcRequestTimeout: this.options.rpcRequestTimeout }
256
257
  )
257
258
 
258
259
  this.transport.on('message', (message: Message) => this.handleMessageFromTransport(message))
@@ -261,10 +262,10 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
261
262
 
262
263
  this.peerDiscovery = new PeerDiscovery({
263
264
  localPeerDescriptor: this.localPeerDescriptor!,
264
- joinNoProgressLimit: this.config.joinNoProgressLimit,
265
- joinTimeout: this.config.dhtJoinTimeout,
266
- serviceId: this.config.serviceId,
267
- parallelism: this.config.joinParallelism,
265
+ joinNoProgressLimit: this.options.joinNoProgressLimit,
266
+ joinTimeout: this.options.dhtJoinTimeout,
267
+ serviceId: this.options.serviceId,
268
+ parallelism: this.options.joinParallelism,
268
269
  connectionLocker: this.connectionLocker,
269
270
  peerManager: this.peerManager!,
270
271
  abortSignal: this.abortController.signal,
@@ -282,7 +283,7 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
282
283
  sessionTransport: this,
283
284
  connectionsView: this.connectionsView!,
284
285
  localPeerDescriptor: this.localPeerDescriptor!,
285
- serviceId: this.config.serviceId,
286
+ serviceId: this.options.serviceId,
286
287
  localDataStore: this.localDataStore,
287
288
  addContact: (contact: PeerDescriptor) => this.peerManager!.addContact(contact),
288
289
  createDhtNodeRpcRemote: (peerDescriptor: PeerDescriptor) => this.createDhtNodeRpcRemote(peerDescriptor),
@@ -291,9 +292,9 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
291
292
  rpcCommunicator: this.rpcCommunicator,
292
293
  recursiveOperationManager: this.recursiveOperationManager,
293
294
  localPeerDescriptor: this.localPeerDescriptor!,
294
- serviceId: this.config.serviceId,
295
- highestTtl: this.config.storeHighestTtl,
296
- redundancyFactor: this.config.storageRedundancyFactor,
295
+ serviceId: this.options.serviceId,
296
+ highestTtl: this.options.storeHighestTtl,
297
+ redundancyFactor: this.options.storageRedundancyFactor,
297
298
  localDataStore: this.localDataStore,
298
299
  getNeighbors: () => this.peerManager!.getNeighbors().map((n) => n.getPeerDescriptor()),
299
300
  createRpcRemote: (contact: PeerDescriptor) => {
@@ -302,7 +303,7 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
302
303
  contact,
303
304
  this.rpcCommunicator!,
304
305
  StoreRpcClient,
305
- this.config.rpcRequestTimeout
306
+ this.options.rpcRequestTimeout
306
307
  )
307
308
  }
308
309
  })
@@ -312,10 +313,10 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
312
313
  this.bindRpcLocalMethods()
313
314
 
314
315
  const pruneTargets = []
315
- if (this.config.periodicallyPingNeighbors === true) {
316
+ if (this.options.periodicallyPingNeighbors === true) {
316
317
  pruneTargets.push(() => this.peerManager!.getNeighbors().map((node) => this.createDhtNodeRpcRemote(node.getPeerDescriptor())))
317
318
  }
318
- if (this.config.periodicallyPingRingContacts === true) {
319
+ if (this.options.periodicallyPingRingContacts === true) {
319
320
  pruneTargets.push(() => this.peerManager!.getRingContacts().getAllContacts())
320
321
  }
321
322
  for (const pruneTarget of pruneTargets) {
@@ -330,12 +331,12 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
330
331
 
331
332
  private initPeerManager() {
332
333
  this.peerManager = new PeerManager({
333
- numberOfNodesPerKBucket: this.config.numberOfNodesPerKBucket,
334
- maxContactListSize: this.config.maxNeighborListSize,
334
+ numberOfNodesPerKBucket: this.options.numberOfNodesPerKBucket,
335
+ maxContactCount: this.options.maxContactCount,
335
336
  localNodeId: this.getNodeId(),
336
337
  localPeerDescriptor: this.localPeerDescriptor!,
337
338
  connectionLocker: this.connectionLocker,
338
- lockId: this.config.serviceId,
339
+ lockId: this.options.serviceId,
339
340
  createDhtNodeRpcRemote: (peerDescriptor: PeerDescriptor) => this.createDhtNodeRpcRemote(peerDescriptor),
340
341
  hasConnection: (nodeId: DhtAddress) => this.connectionsView!.hasConnection(nodeId)
341
342
  })
@@ -359,12 +360,12 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
359
360
  })
360
361
  this.peerManager.on('kBucketEmpty', () => {
361
362
  if (!this.peerDiscovery!.isJoinOngoing()) {
362
- if (this.config.entryPoints && this.config.entryPoints.length > 0) {
363
+ if (this.options.entryPoints && this.options.entryPoints.length > 0) {
363
364
  setImmediate(async () => {
364
365
  const contactedPeers = new Set<DhtAddress>()
365
366
  const distantJoinContactPeers = new Set<DhtAddress>()
366
367
  // TODO should we catch possible promise rejection?
367
- await Promise.all(this.config.entryPoints!.map((entryPoint) =>
368
+ await Promise.all(this.options.entryPoints!.map((entryPoint) =>
368
369
  this.peerDiscovery!.rejoinDht(entryPoint, contactedPeers, distantJoinContactPeers)
369
370
  ))
370
371
  })
@@ -378,8 +379,8 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
378
379
  this.emit('connected', peerDescriptor)
379
380
  })
380
381
  this.transport!.on('disconnected', (peerDescriptor: PeerDescriptor, gracefulLeave: boolean) => {
381
- const isLayer0 = (this.connectionLocker !== undefined)
382
- if (isLayer0) {
382
+ const isControlLayerNode = (this.connectionLocker !== undefined)
383
+ if (isControlLayerNode) {
383
384
  const nodeId = getNodeIdFromPeerDescriptor(peerDescriptor)
384
385
  if (gracefulLeave) {
385
386
  this.peerManager!.removeContact(nodeId)
@@ -397,7 +398,7 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
397
398
  return
398
399
  }
399
400
  const dhtNodeRpcLocal = new DhtNodeRpcLocal({
400
- peerDiscoveryQueryBatchSize: this.config.peerDiscoveryQueryBatchSize,
401
+ peerDiscoveryQueryBatchSize: this.options.peerDiscoveryQueryBatchSize,
401
402
  getNeighbors: () => this.peerManager!.getNeighbors().map((n) => n.getPeerDescriptor()),
402
403
  getClosestRingContactsTo: (ringIdRaw: RingIdRaw, limit: number) => {
403
404
  return this.getClosestRingContactsTo(ringIdRaw, limit)
@@ -424,25 +425,25 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
424
425
  ExternalFetchDataResponse,
425
426
  'externalFetchData',
426
427
  (req: ExternalFetchDataRequest, context: ServerCallContext) => externalApiRpcLocal.externalFetchData(req, context),
427
- { timeout: 10000 } // TODO use config option or named constant?
428
+ { timeout: 10000 } // TODO use options option or named constant?
428
429
  )
429
430
  this.rpcCommunicator!.registerRpcMethod(
430
431
  ExternalStoreDataRequest,
431
432
  ExternalStoreDataResponse,
432
433
  'externalStoreData',
433
434
  (req: ExternalStoreDataRequest, context: ServerCallContext) => externalApiRpcLocal.externalStoreData(req, context),
434
- { timeout: 10000 } // TODO use config option or named constant?
435
+ { timeout: 10000 } // TODO use options option or named constant?
435
436
  )
436
437
  }
437
438
 
438
439
  private handleMessageFromTransport(message: Message): void {
439
- if (message.serviceId === this.config.serviceId) {
440
+ if (message.serviceId === this.options.serviceId) {
440
441
  this.rpcCommunicator?.handleMessageFromPeer(message)
441
442
  }
442
443
  }
443
444
 
444
445
  private handleMessageFromRouter(message: Message): void {
445
- if (message.serviceId === this.config.serviceId) {
446
+ if (message.serviceId === this.options.serviceId) {
446
447
  this.rpcCommunicator?.handleMessageFromPeer(message)
447
448
  } else {
448
449
  this.emit('message', message)
@@ -450,13 +451,13 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
450
451
  }
451
452
 
452
453
  private async generatePeerDescriptorCallBack(connectivityResponse: ConnectivityResponse) {
453
- if (this.config.peerDescriptor !== undefined) {
454
- this.localPeerDescriptor = this.config.peerDescriptor
454
+ if (this.options.peerDescriptor !== undefined) {
455
+ this.localPeerDescriptor = this.options.peerDescriptor
455
456
  } else {
456
457
  let region: number | undefined = undefined
457
- if (this.config.region !== undefined) {
458
- region = this.config.region
459
- logger.debug(`Using region ${region} from config when generating local PeerDescriptor`)
458
+ if (this.options.region !== undefined) {
459
+ region = this.options.region
460
+ logger.debug(`Using region ${region} from options when generating local PeerDescriptor`)
460
461
  } else if (connectivityResponse.latitude !== undefined && connectivityResponse.longitude !== undefined) {
461
462
  region = getLocalRegionByCoordinates(connectivityResponse.latitude, connectivityResponse.longitude)
462
463
  logger.debug(`Using region ${region} from GeoIP when generating local PeerDescriptor`)
@@ -467,7 +468,7 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
467
468
  logger.debug(`Using region ${region} from CDN when generating local PeerDescriptor`)
468
469
  }
469
470
 
470
- this.localPeerDescriptor = createPeerDescriptor(connectivityResponse, region, this.config.nodeId)
471
+ this.localPeerDescriptor = createPeerDescriptor(connectivityResponse, region, this.options.nodeId)
471
472
  }
472
473
  return this.localPeerDescriptor
473
474
  }
@@ -522,7 +523,7 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
522
523
  }
523
524
 
524
525
  private getConnectedEntryPoints(): PeerDescriptor[] {
525
- return this.config.entryPoints !== undefined ? this.config.entryPoints.filter((entryPoint) =>
526
+ return this.options.entryPoints !== undefined ? this.options.entryPoints.filter((entryPoint) =>
526
527
  this.connectionsView!.hasConnection(getNodeIdFromPeerDescriptor(entryPoint))
527
528
  ) : []
528
529
  }
@@ -620,7 +621,7 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
620
621
  public async waitForNetworkConnectivity(): Promise<void> {
621
622
  await waitForCondition(
622
623
  () => this.connectionsView!.getConnectionCount() > 0,
623
- this.config.networkConnectivityTimeout,
624
+ this.options.networkConnectivityTimeout,
624
625
  100,
625
626
  this.abortController.signal
626
627
  )
@@ -642,8 +643,8 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
642
643
  this.rpcCommunicator!.stop()
643
644
  this.router!.stop()
644
645
  this.recursiveOperationManager!.stop()
645
- if (this.config.transport === undefined) {
646
- // if the transport was not given in config, the instance was created in start() and
646
+ if (this.options.transport === undefined) {
647
+ // if the transport was not given in options, the instance was created in start() and
647
648
  // this component is responsible for stopping it
648
649
  await this.transport!.stop()
649
650
  }
@@ -656,9 +657,9 @@ export class DhtNode extends EventEmitter<Events> implements ITransport {
656
657
  return new DhtNodeRpcRemote(
657
658
  this.localPeerDescriptor!,
658
659
  peerDescriptor,
659
- this.config.serviceId,
660
+ this.options.serviceId,
660
661
  this.rpcCommunicator!,
661
- this.config.rpcRequestTimeout
662
+ this.options.rpcRequestTimeout
662
663
  )
663
664
  }
664
665
  }
@@ -17,7 +17,7 @@ import { RingContacts } from './contact/RingContactList'
17
17
  import { getClosestNodes } from './contact/getClosestNodes'
18
18
  import { RingIdRaw } from './contact/ringIdentifiers'
19
19
 
20
- interface DhtNodeRpcLocalConfig {
20
+ interface DhtNodeRpcLocalOptions {
21
21
  peerDiscoveryQueryBatchSize: number
22
22
  getNeighbors: () => ReadonlyArray<PeerDescriptor>
23
23
  getClosestRingContactsTo: (id: RingIdRaw, limit: number) => RingContacts
@@ -29,19 +29,19 @@ const logger = new Logger(module)
29
29
 
30
30
  export class DhtNodeRpcLocal implements IDhtNodeRpc {
31
31
 
32
- private readonly config: DhtNodeRpcLocalConfig
32
+ private readonly options: DhtNodeRpcLocalOptions
33
33
 
34
- constructor(config: DhtNodeRpcLocalConfig) {
35
- this.config = config
34
+ constructor(options: DhtNodeRpcLocalOptions) {
35
+ this.options = options
36
36
  }
37
37
 
38
38
  // TODO rename to getClosestNeighbors (breaking change)
39
39
  async getClosestPeers(request: ClosestPeersRequest, context: ServerCallContext): Promise<ClosestPeersResponse> {
40
- this.config.addContact((context as DhtCallContext).incomingSourceDescriptor!)
40
+ this.options.addContact((context as DhtCallContext).incomingSourceDescriptor!)
41
41
  const peers = getClosestNodes(
42
42
  getDhtAddressFromRaw(request.nodeId),
43
- this.config.getNeighbors(),
44
- { maxCount: this.config.peerDiscoveryQueryBatchSize }
43
+ this.options.getNeighbors(),
44
+ { maxCount: this.options.peerDiscoveryQueryBatchSize }
45
45
  )
46
46
  const response = {
47
47
  peers,
@@ -52,8 +52,8 @@ export class DhtNodeRpcLocal implements IDhtNodeRpc {
52
52
 
53
53
  // TODO rename to getClosestRingContacts (breaking change)
54
54
  async getClosestRingPeers(request: ClosestRingPeersRequest, context: ServerCallContext): Promise<ClosestRingPeersResponse> {
55
- this.config.addContact((context as DhtCallContext).incomingSourceDescriptor!)
56
- const closestContacts = this.config.getClosestRingContactsTo(request.ringId as RingIdRaw, this.config.peerDiscoveryQueryBatchSize)
55
+ this.options.addContact((context as DhtCallContext).incomingSourceDescriptor!)
56
+ const closestContacts = this.options.getClosestRingContactsTo(request.ringId as RingIdRaw, this.options.peerDiscoveryQueryBatchSize)
57
57
  const response = {
58
58
  leftPeers: closestContacts.left,
59
59
  rightPeers: closestContacts.right,
@@ -65,7 +65,7 @@ export class DhtNodeRpcLocal implements IDhtNodeRpc {
65
65
  async ping(request: PingRequest, context: ServerCallContext): Promise<PingResponse> {
66
66
  logger.trace('received ping request: ' + getNodeIdFromPeerDescriptor((context as DhtCallContext).incomingSourceDescriptor!))
67
67
  setImmediate(() => {
68
- this.config.addContact((context as DhtCallContext).incomingSourceDescriptor!)
68
+ this.options.addContact((context as DhtCallContext).incomingSourceDescriptor!)
69
69
  })
70
70
  const response: PingResponse = {
71
71
  requestId: request.requestId
@@ -78,7 +78,7 @@ export class DhtNodeRpcLocal implements IDhtNodeRpc {
78
78
  const sender = (context as DhtCallContext).incomingSourceDescriptor!
79
79
  const senderNodeId = getNodeIdFromPeerDescriptor(sender)
80
80
  logger.trace('received leave notice: ' + senderNodeId)
81
- this.config.removeContact(senderNodeId)
81
+ this.options.removeContact(senderNodeId)
82
82
  return {}
83
83
  }
84
84
  }
@@ -14,7 +14,7 @@ import { Any } from '../proto/google/protobuf/any'
14
14
  import { DhtAddress, getNodeIdFromPeerDescriptor } from '../identifiers'
15
15
  import { getDhtAddressFromRaw } from '../identifiers'
16
16
 
17
- interface ExternalApiRpcLocalConfig {
17
+ interface ExternalApiRpcLocalOptions {
18
18
  executeRecursiveOperation: (
19
19
  targetId: DhtAddress,
20
20
  operation: RecursiveOperation,
@@ -29,15 +29,15 @@ interface ExternalApiRpcLocalConfig {
29
29
 
30
30
  export class ExternalApiRpcLocal implements IExternalApiRpc {
31
31
 
32
- private readonly config: ExternalApiRpcLocalConfig
32
+ private readonly options: ExternalApiRpcLocalOptions
33
33
 
34
- constructor(config: ExternalApiRpcLocalConfig) {
35
- this.config = config
34
+ constructor(options: ExternalApiRpcLocalOptions) {
35
+ this.options = options
36
36
  }
37
37
 
38
38
  async externalFetchData(request: ExternalFetchDataRequest, context: ServerCallContext): Promise<ExternalFetchDataResponse> {
39
39
  const senderPeerDescriptor = (context as DhtCallContext).incomingSourceDescriptor!
40
- const result = await this.config.executeRecursiveOperation(
40
+ const result = await this.options.executeRecursiveOperation(
41
41
  getDhtAddressFromRaw(request.key),
42
42
  RecursiveOperation.FETCH_DATA,
43
43
  getNodeIdFromPeerDescriptor(senderPeerDescriptor)
@@ -47,7 +47,7 @@ export class ExternalApiRpcLocal implements IExternalApiRpc {
47
47
 
48
48
  async externalStoreData(request: ExternalStoreDataRequest, context: ServerCallContext): Promise<ExternalStoreDataResponse> {
49
49
  const senderPeerDescriptor = (context as DhtCallContext).incomingSourceDescriptor!
50
- const result = await this.config.storeDataToDht(
50
+ const result = await this.options.storeDataToDht(
51
51
  getDhtAddressFromRaw(request.key),
52
52
  request.data!,
53
53
  getNodeIdFromPeerDescriptor(senderPeerDescriptor)
@@ -11,7 +11,7 @@ export class ExternalApiRpcRemote extends RpcRemote<ExternalApiRpcClient> {
11
11
  key: getRawFromDhtAddress(key)
12
12
  }
13
13
  const options = this.formDhtRpcOptions({
14
- // TODO use config option or named constant?
14
+ // TODO use options option or named constant?
15
15
  timeout: 10000
16
16
  })
17
17
  try {
@@ -28,7 +28,7 @@ export class ExternalApiRpcRemote extends RpcRemote<ExternalApiRpcClient> {
28
28
  data
29
29
  }
30
30
  const options = this.formDhtRpcOptions({
31
- // TODO use config option or named constant?
31
+ // TODO use options option or named constant?
32
32
  timeout: 10000
33
33
  })
34
34
  try {