@streamr/trackerless-network 101.1.1 → 102.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 (150) hide show
  1. package/dist/package.json +7 -7
  2. package/dist/src/NetworkNode.d.ts +6 -6
  3. package/dist/src/NetworkNode.js +5 -3
  4. package/dist/src/NetworkNode.js.map +1 -1
  5. package/dist/src/NetworkStack.js +3 -2
  6. package/dist/src/NetworkStack.js.map +1 -1
  7. package/dist/src/logic/ContentDeliveryLayerNode.d.ts +4 -1
  8. package/dist/src/logic/ContentDeliveryLayerNode.js +25 -5
  9. package/dist/src/logic/ContentDeliveryLayerNode.js.map +1 -1
  10. package/dist/src/logic/ContentDeliveryManager.d.ts +6 -2
  11. package/dist/src/logic/ContentDeliveryManager.js +26 -6
  12. package/dist/src/logic/ContentDeliveryManager.js.map +1 -1
  13. package/dist/src/logic/ContentDeliveryRpcLocal.js +2 -2
  14. package/dist/src/logic/ContentDeliveryRpcLocal.js.map +1 -1
  15. package/dist/src/logic/ContentDeliveryRpcRemote.d.ts +3 -0
  16. package/dist/src/logic/ContentDeliveryRpcRemote.js +7 -0
  17. package/dist/src/logic/ContentDeliveryRpcRemote.js.map +1 -1
  18. package/dist/src/logic/DuplicateMessageDetector.js +2 -2
  19. package/dist/src/logic/DuplicateMessageDetector.js.map +1 -1
  20. package/dist/src/logic/ExternalNetworkRpc.js.map +1 -1
  21. package/dist/src/logic/NodeList.js +2 -2
  22. package/dist/src/logic/NodeList.js.map +1 -1
  23. package/dist/src/logic/PeerDescriptorStoreManager.js +0 -1
  24. package/dist/src/logic/PeerDescriptorStoreManager.js.map +1 -1
  25. package/dist/src/logic/StreamPartNetworkSplitAvoidance.js +4 -3
  26. package/dist/src/logic/StreamPartNetworkSplitAvoidance.js.map +1 -1
  27. package/dist/src/logic/createContentDeliveryLayerNode.js +1 -1
  28. package/dist/src/logic/createContentDeliveryLayerNode.js.map +1 -1
  29. package/dist/src/logic/inspect/Inspector.js +3 -3
  30. package/dist/src/logic/inspect/Inspector.js.map +1 -1
  31. package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js +9 -9
  32. package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js.map +1 -1
  33. package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js +5 -5
  34. package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js.map +1 -1
  35. package/dist/src/logic/neighbor-discovery/Handshaker.js +12 -12
  36. package/dist/src/logic/neighbor-discovery/Handshaker.js.map +1 -1
  37. package/dist/src/logic/neighbor-discovery/NeighborFinder.js +5 -0
  38. package/dist/src/logic/neighbor-discovery/NeighborFinder.js.map +1 -1
  39. package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js +3 -1
  40. package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js.map +1 -1
  41. package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js +3 -3
  42. package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js.map +1 -1
  43. package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.js +1 -1
  44. package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.js.map +1 -1
  45. package/dist/src/logic/propagation/Propagation.js +0 -1
  46. package/dist/src/logic/propagation/Propagation.js.map +1 -1
  47. package/dist/src/logic/proxy/ProxyClient.d.ts +3 -2
  48. package/dist/src/logic/proxy/ProxyClient.js +9 -4
  49. package/dist/src/logic/proxy/ProxyClient.js.map +1 -1
  50. package/dist/src/logic/proxy/ProxyConnectionRpcLocal.d.ts +2 -2
  51. package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js +1 -1
  52. package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js.map +1 -1
  53. package/dist/src/logic/proxy/ProxyConnectionRpcRemote.d.ts +2 -2
  54. package/dist/src/logic/proxy/ProxyConnectionRpcRemote.js.map +1 -1
  55. package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js +3 -3
  56. package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js.map +1 -1
  57. package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js +2 -2
  58. package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js.map +1 -1
  59. package/dist/src/proto/google/protobuf/any.d.ts +11 -4
  60. package/dist/src/proto/google/protobuf/any.js.map +1 -1
  61. package/dist/src/proto/google/protobuf/empty.d.ts +0 -1
  62. package/dist/src/proto/google/protobuf/empty.js.map +1 -1
  63. package/dist/src/proto/google/protobuf/timestamp.d.ts +9 -3
  64. package/dist/src/proto/google/protobuf/timestamp.js.map +1 -1
  65. package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.d.ts +26 -2
  66. package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js +16 -2
  67. package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js.map +1 -1
  68. package/dist/test/benchmark/first-message.js +1 -2
  69. package/dist/test/benchmark/first-message.js.map +1 -1
  70. package/dist/test/utils/utils.d.ts +2 -2
  71. package/dist/test/utils/utils.js +1 -1
  72. package/dist/test/utils/utils.js.map +1 -1
  73. package/jest.config.js +3 -0
  74. package/karma-setup.js +7 -0
  75. package/karma.config.js +1 -1
  76. package/package.json +7 -7
  77. package/protos/NetworkRpc.proto +7 -1
  78. package/src/NetworkNode.ts +10 -8
  79. package/src/NetworkStack.ts +4 -3
  80. package/src/logic/ContentDeliveryLayerNode.ts +30 -6
  81. package/src/logic/ContentDeliveryManager.ts +37 -11
  82. package/src/logic/ContentDeliveryRpcLocal.ts +3 -3
  83. package/src/logic/ContentDeliveryRpcRemote.ts +10 -0
  84. package/src/logic/DuplicateMessageDetector.ts +2 -2
  85. package/src/logic/ExternalNetworkRpc.ts +0 -1
  86. package/src/logic/NodeList.ts +4 -3
  87. package/src/logic/PeerDescriptorStoreManager.ts +0 -1
  88. package/src/logic/StreamPartNetworkSplitAvoidance.ts +5 -4
  89. package/src/logic/createContentDeliveryLayerNode.ts +2 -2
  90. package/src/logic/inspect/Inspector.ts +4 -4
  91. package/src/logic/neighbor-discovery/HandshakeRpcLocal.ts +11 -11
  92. package/src/logic/neighbor-discovery/HandshakeRpcRemote.ts +6 -6
  93. package/src/logic/neighbor-discovery/Handshaker.ts +13 -13
  94. package/src/logic/neighbor-discovery/NeighborFinder.ts +6 -1
  95. package/src/logic/neighbor-discovery/NeighborUpdateManager.ts +4 -2
  96. package/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts +4 -4
  97. package/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.ts +2 -2
  98. package/src/logic/propagation/Propagation.ts +0 -1
  99. package/src/logic/proxy/ProxyClient.ts +15 -9
  100. package/src/logic/proxy/ProxyConnectionRpcLocal.ts +5 -5
  101. package/src/logic/proxy/ProxyConnectionRpcRemote.ts +2 -2
  102. package/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts +4 -4
  103. package/src/logic/temporary-connection/TemporaryConnectionRpcRemote.ts +3 -3
  104. package/src/proto/google/protobuf/any.ts +11 -4
  105. package/src/proto/google/protobuf/empty.ts +0 -1
  106. package/src/proto/google/protobuf/timestamp.ts +9 -3
  107. package/src/proto/packages/trackerless-network/protos/NetworkRpc.ts +34 -3
  108. package/test/benchmark/first-message.ts +2 -3
  109. package/test/end-to-end/content-delivery-layer-node-with-real-connections.test.ts +2 -2
  110. package/test/end-to-end/inspect.test.ts +2 -2
  111. package/test/end-to-end/proxy-and-full-node.test.ts +4 -4
  112. package/test/end-to-end/proxy-connections.test.ts +3 -3
  113. package/test/end-to-end/proxy-key-exchange.test.ts +5 -3
  114. package/test/end-to-end/webrtc-full-node-network.test.ts +4 -4
  115. package/test/end-to-end/websocket-full-node-network.test.ts +4 -4
  116. package/test/integration/ContentDeliveryLayerNode-Layer1Node-Latencies.test.ts +4 -4
  117. package/test/integration/ContentDeliveryLayerNode-Layer1Node.test.ts +4 -4
  118. package/test/integration/ContentDeliveryManager.test.ts +35 -14
  119. package/test/integration/ContentDeliveryRpcRemote.test.ts +2 -2
  120. package/test/integration/Handshakes.test.ts +7 -7
  121. package/test/integration/Inspect.test.ts +2 -2
  122. package/test/integration/NetworkNode.test.ts +2 -1
  123. package/test/integration/NetworkRpc.test.ts +4 -4
  124. package/test/integration/NetworkStack.test.ts +2 -2
  125. package/test/integration/NodeInfoRpc.test.ts +6 -2
  126. package/test/integration/Propagation.test.ts +2 -2
  127. package/test/integration/joining-streams-on-offline-peers.test.ts +2 -2
  128. package/test/integration/stream-without-default-entrypoints.test.ts +2 -1
  129. package/test/integration/streamEntryPointReplacing.test.ts +2 -2
  130. package/test/types/global.d.ts +2 -0
  131. package/test/unit/ContentDeliveryLayerNode.test.ts +22 -10
  132. package/test/unit/ContentDeliveryManager.test.ts +5 -5
  133. package/test/unit/ContentDeliveryRpcLocal.test.ts +2 -2
  134. package/test/unit/HandshakeRpcLocal.test.ts +8 -8
  135. package/test/unit/Handshaker.test.ts +2 -2
  136. package/test/unit/InspectSession.test.ts +3 -3
  137. package/test/unit/Inspector.test.ts +4 -4
  138. package/test/unit/NeighborFinder.test.ts +3 -3
  139. package/test/unit/NeighborUpdateRpcLocal.test.ts +5 -5
  140. package/test/unit/NetworkNode.test.ts +2 -2
  141. package/test/unit/NodeList.test.ts +22 -22
  142. package/test/unit/PeerDescriptorStoreManager.test.ts +2 -2
  143. package/test/unit/Propagation.test.ts +6 -5
  144. package/test/unit/ProxyConnectionRpcRemote.test.ts +3 -3
  145. package/test/unit/TemporaryConnectionRpcLocal.test.ts +3 -3
  146. package/test/utils/mock/MockControlLayerNode.ts +5 -0
  147. package/test/utils/mock/MockTransport.ts +11 -0
  148. package/test/utils/utils.ts +5 -5
  149. package/tsconfig.jest.json +1 -1
  150. package/tsconfig.json +3 -0
@@ -4,8 +4,8 @@ import {
4
4
  DhtAddressRaw,
5
5
  DhtCallContext,
6
6
  PeerDescriptor,
7
- getDhtAddressFromRaw,
8
- getNodeIdFromPeerDescriptor
7
+ toDhtAddress,
8
+ toNodeId
9
9
  } from '@streamr/dht'
10
10
  import { Logger, StreamPartID } from '@streamr/utils'
11
11
  import {
@@ -46,8 +46,8 @@ export class HandshakeRpcLocal implements IHandshakeRpc {
46
46
 
47
47
  private handleRequest(request: StreamPartHandshakeRequest, context: ServerCallContext): StreamPartHandshakeResponse {
48
48
  const senderDescriptor = (context as DhtCallContext).incomingSourceDescriptor!
49
- const getInterleaveNodeIds = () => (request.interleaveNodeId !== undefined) ? [getDhtAddressFromRaw(request.interleaveNodeId)] : []
50
- const senderNodeId = getNodeIdFromPeerDescriptor(senderDescriptor)
49
+ const getInterleaveNodeIds = () => (request.interleaveNodeId !== undefined) ? [toDhtAddress(request.interleaveNodeId)] : []
50
+ const senderNodeId = toNodeId(senderDescriptor)
51
51
  if (this.options.ongoingInterleaves.has(senderNodeId)) {
52
52
  return this.rejectHandshake(request)
53
53
  } else if (this.options.neighbors.has(senderNodeId)
@@ -88,16 +88,16 @@ export class HandshakeRpcLocal implements IHandshakeRpc {
88
88
 
89
89
  private acceptHandshakeWithInterleaving(request: StreamPartHandshakeRequest, requester: PeerDescriptor): StreamPartHandshakeResponse {
90
90
  const exclude: DhtAddress[] = []
91
- request.neighborNodeIds.forEach((id: DhtAddressRaw) => exclude.push(getDhtAddressFromRaw(id)))
91
+ request.neighborNodeIds.forEach((id: DhtAddressRaw) => exclude.push(toDhtAddress(id)))
92
92
  this.options.ongoingInterleaves.forEach((id) => exclude.push(id))
93
- exclude.push(getNodeIdFromPeerDescriptor(requester))
93
+ exclude.push(toNodeId(requester))
94
94
  if (request.interleaveNodeId !== undefined) {
95
- exclude.push(getDhtAddressFromRaw(request.interleaveNodeId))
95
+ exclude.push(toDhtAddress(request.interleaveNodeId))
96
96
  }
97
97
  const last = this.options.neighbors.getLast(exclude)
98
98
  const lastPeerDescriptor = last ? last.getPeerDescriptor() : undefined
99
99
  if (last) {
100
- const nodeId = getNodeIdFromPeerDescriptor(last.getPeerDescriptor())
100
+ const nodeId = toNodeId(last.getPeerDescriptor())
101
101
  const remote = this.options.createRpcRemote(last.getPeerDescriptor())
102
102
  this.options.ongoingInterleaves.add(nodeId)
103
103
  // Run this with then catch instead of setImmediate to avoid changes in state
@@ -107,7 +107,7 @@ export class HandshakeRpcLocal implements IHandshakeRpc {
107
107
  // and unlock the connection
108
108
  // If response is not accepted, keep the last node as a neighbor
109
109
  if (response.accepted) {
110
- this.options.neighbors.remove(getNodeIdFromPeerDescriptor(lastPeerDescriptor!))
110
+ this.options.neighbors.remove(toNodeId(lastPeerDescriptor!))
111
111
  }
112
112
  }).catch(() => {
113
113
  // no-op: InterleaveRequest cannot reject
@@ -125,13 +125,13 @@ export class HandshakeRpcLocal implements IHandshakeRpc {
125
125
 
126
126
  async interleaveRequest(message: InterleaveRequest, context: ServerCallContext): Promise<InterleaveResponse> {
127
127
  const senderPeerDescriptor = (context as DhtCallContext).incomingSourceDescriptor!
128
- const remoteNodeId = getNodeIdFromPeerDescriptor(senderPeerDescriptor)
128
+ const remoteNodeId = toNodeId(senderPeerDescriptor)
129
129
  try {
130
130
  await this.options.handshakeWithInterleaving(message.interleaveTargetDescriptor!, remoteNodeId)
131
131
  this.options.neighbors.remove(remoteNodeId)
132
132
  return { accepted: true }
133
133
  } catch (err) {
134
- logger.debug(`interleaveRequest to ${getNodeIdFromPeerDescriptor(message.interleaveTargetDescriptor!)} failed`, { err })
134
+ logger.debug(`interleaveRequest to ${toNodeId(message.interleaveTargetDescriptor!)} failed`, { err })
135
135
  return { accepted: false }
136
136
  }
137
137
  }
@@ -1,4 +1,4 @@
1
- import { DhtAddress, PeerDescriptor, RpcRemote, getNodeIdFromPeerDescriptor, getRawFromDhtAddress } from '@streamr/dht'
1
+ import { DhtAddress, PeerDescriptor, RpcRemote, toNodeId, toDhtAddressRaw } from '@streamr/dht'
2
2
  import { Logger, StreamPartID } from '@streamr/utils'
3
3
  import { v4 } from 'uuid'
4
4
  import { InterleaveRequest, InterleaveResponse, StreamPartHandshakeRequest } from '../../proto/packages/trackerless-network/protos/NetworkRpc'
@@ -24,9 +24,9 @@ export class HandshakeRpcRemote extends RpcRemote<HandshakeRpcClient> {
24
24
  const request: StreamPartHandshakeRequest = {
25
25
  streamPartId,
26
26
  requestId: v4(),
27
- neighborNodeIds: neighborNodeIds.map((id) => getRawFromDhtAddress(id)),
28
- concurrentHandshakeNodeId: (concurrentHandshakeNodeId !== undefined) ? getRawFromDhtAddress(concurrentHandshakeNodeId) : undefined,
29
- interleaveNodeId: (interleaveNodeId !== undefined) ? getRawFromDhtAddress(interleaveNodeId) : undefined
27
+ neighborNodeIds: neighborNodeIds.map((id) => toDhtAddressRaw(id)),
28
+ concurrentHandshakeNodeId: (concurrentHandshakeNodeId !== undefined) ? toDhtAddressRaw(concurrentHandshakeNodeId) : undefined,
29
+ interleaveNodeId: (interleaveNodeId !== undefined) ? toDhtAddressRaw(interleaveNodeId) : undefined
30
30
  }
31
31
  try {
32
32
  const response = await this.getClient().handshake(request, this.formDhtRpcOptions())
@@ -35,7 +35,7 @@ export class HandshakeRpcRemote extends RpcRemote<HandshakeRpcClient> {
35
35
  interleaveTargetDescriptor: response.interleaveTargetDescriptor
36
36
  }
37
37
  } catch (err: any) {
38
- logger.debug(`handshake to ${getNodeIdFromPeerDescriptor(this.getPeerDescriptor())} failed`, { err })
38
+ logger.debug(`handshake to ${toNodeId(this.getPeerDescriptor())} failed`, { err })
39
39
  return {
40
40
  accepted: false
41
41
  }
@@ -56,7 +56,7 @@ export class HandshakeRpcRemote extends RpcRemote<HandshakeRpcClient> {
56
56
  accepted: res.accepted
57
57
  }
58
58
  } catch (err) {
59
- logger.debug(`interleaveRequest to ${getNodeIdFromPeerDescriptor(this.getPeerDescriptor())} failed`, { err })
59
+ logger.debug(`interleaveRequest to ${toNodeId(this.getPeerDescriptor())} failed`, { err })
60
60
  return {
61
61
  accepted: false
62
62
  }
@@ -1,4 +1,4 @@
1
- import { DhtAddress, ListeningRpcCommunicator, PeerDescriptor, getNodeIdFromPeerDescriptor } from '@streamr/dht'
1
+ import { DhtAddress, ListeningRpcCommunicator, PeerDescriptor, toNodeId } from '@streamr/dht'
2
2
  import { Logger, StreamPartID } from '@streamr/utils'
3
3
  import {
4
4
  InterleaveRequest,
@@ -70,7 +70,7 @@ export class Handshaker {
70
70
  private async selectParallelTargetsAndHandshake(excludedIds: DhtAddress[]): Promise<DhtAddress[]> {
71
71
  const exclude = excludedIds.concat(this.options.neighbors.getIds())
72
72
  const neighbors = this.selectParallelTargets(exclude)
73
- neighbors.forEach((contact) => this.options.ongoingHandshakes.add(getNodeIdFromPeerDescriptor(contact.getPeerDescriptor())))
73
+ neighbors.forEach((contact) => this.options.ongoingHandshakes.add(toNodeId(contact.getPeerDescriptor())))
74
74
  return this.doParallelHandshakes(neighbors, exclude)
75
75
  }
76
76
 
@@ -83,7 +83,7 @@ export class Handshaker {
83
83
  true
84
84
  )
85
85
  if (wsNode) {
86
- const wsNodeId = getNodeIdFromPeerDescriptor(wsNode.getPeerDescriptor())
86
+ const wsNodeId = toNodeId(wsNode.getPeerDescriptor())
87
87
  excludedIds.push(wsNodeId)
88
88
  neighbors.set(wsNodeId, wsNode)
89
89
  }
@@ -92,21 +92,21 @@ export class Handshaker {
92
92
  const left = this.options.leftNodeView.getFirst([...excludedIds, ...Array.from(neighbors.keys())] as DhtAddress[])
93
93
  const right = this.options.rightNodeView.getFirst([...excludedIds, ...Array.from(neighbors.keys())] as DhtAddress[])
94
94
  if (left) {
95
- neighbors.set(getNodeIdFromPeerDescriptor(left.getPeerDescriptor()), left)
95
+ neighbors.set(toNodeId(left.getPeerDescriptor()), left)
96
96
  }
97
97
  if (right) {
98
- neighbors.set(getNodeIdFromPeerDescriptor(right.getPeerDescriptor()), right)
98
+ neighbors.set(toNodeId(right.getPeerDescriptor()), right)
99
99
  }
100
100
  // If there is still room add the closest contact based on the kademlia metric
101
101
  if (neighbors.size < PARALLEL_HANDSHAKE_COUNT) {
102
102
  const first = this.options.nearbyNodeView.getFirst([...excludedIds, ...Array.from(neighbors.keys())] as DhtAddress[])
103
103
  if (first) {
104
- neighbors.set(getNodeIdFromPeerDescriptor(first.getPeerDescriptor()), first)
104
+ neighbors.set(toNodeId(first.getPeerDescriptor()), first)
105
105
  }
106
106
  }
107
107
  const getExcludedFromRandomView = () => [
108
108
  ...excludedIds,
109
- ...Array.from(neighbors.values()).map((neighbor) => getNodeIdFromPeerDescriptor(neighbor.getPeerDescriptor()))
109
+ ...Array.from(neighbors.values()).map((neighbor) => toNodeId(neighbor.getPeerDescriptor()))
110
110
  ]
111
111
  // If there is still room add a random contact until PARALLEL_HANDSHAKE_COUNT is reached
112
112
  while (
@@ -115,7 +115,7 @@ export class Handshaker {
115
115
  ) {
116
116
  const random = this.options.randomNodeView.getRandom([...excludedIds, ...Array.from(neighbors.keys())] as DhtAddress[])
117
117
  if (random) {
118
- neighbors.set(getNodeIdFromPeerDescriptor(random.getPeerDescriptor()), random)
118
+ neighbors.set(toNodeId(random.getPeerDescriptor()), random)
119
119
  }
120
120
  }
121
121
  return Array.from(neighbors.values()).map((neighbor) => this.createRpcRemote(neighbor.getPeerDescriptor()))
@@ -126,13 +126,13 @@ export class Handshaker {
126
126
  Array.from(targets.values()).map(async (target: HandshakeRpcRemote, i) => {
127
127
  const otherNode = i === 0 ? targets[1] : targets[0]
128
128
  // TODO better check (currently this condition is always true)
129
- const otherNodeId = otherNode ? getNodeIdFromPeerDescriptor(otherNode.getPeerDescriptor()) : undefined
129
+ const otherNodeId = otherNode ? toNodeId(otherNode.getPeerDescriptor()) : undefined
130
130
  return this.handshakeWithTarget(target, otherNodeId)
131
131
  })
132
132
  )
133
133
  results.forEach((res, i) => {
134
134
  if (res.status !== 'fulfilled' || !res.value) {
135
- excludedIds.push(getNodeIdFromPeerDescriptor(targets[i].getPeerDescriptor()))
135
+ excludedIds.push(toNodeId(targets[i].getPeerDescriptor()))
136
136
  }
137
137
  })
138
138
  return excludedIds
@@ -147,14 +147,14 @@ export class Handshaker {
147
147
  if (neighbor) {
148
148
  const accepted = await this.handshakeWithTarget(this.createRpcRemote(neighbor.getPeerDescriptor()))
149
149
  if (!accepted) {
150
- excludedIds.push(getNodeIdFromPeerDescriptor(neighbor.getPeerDescriptor()))
150
+ excludedIds.push(toNodeId(neighbor.getPeerDescriptor()))
151
151
  }
152
152
  }
153
153
  return excludedIds
154
154
  }
155
155
 
156
156
  private async handshakeWithTarget(neighbor: HandshakeRpcRemote, concurrentNodeId?: DhtAddress): Promise<boolean> {
157
- const targetNodeId = getNodeIdFromPeerDescriptor(neighbor.getPeerDescriptor())
157
+ const targetNodeId = toNodeId(neighbor.getPeerDescriptor())
158
158
  this.options.ongoingHandshakes.add(targetNodeId)
159
159
  const result = await neighbor.handshake(
160
160
  this.options.streamPartId,
@@ -173,7 +173,7 @@ export class Handshaker {
173
173
 
174
174
  private async handshakeWithInterleaving(target: PeerDescriptor, remoteNodeId: DhtAddress): Promise<boolean> {
175
175
  const neighbor = this.createRpcRemote(target)
176
- const targetNodeId = getNodeIdFromPeerDescriptor(neighbor.getPeerDescriptor())
176
+ const targetNodeId = toNodeId(neighbor.getPeerDescriptor())
177
177
  this.options.ongoingHandshakes.add(targetNodeId)
178
178
  const result = await neighbor.handshake(
179
179
  this.options.streamPartId,
@@ -1,4 +1,4 @@
1
- import { setAbortableTimeout } from '@streamr/utils'
1
+ import { Logger, setAbortableTimeout } from '@streamr/utils'
2
2
  import { NodeList } from '../NodeList'
3
3
  import { DhtAddress } from '@streamr/dht'
4
4
 
@@ -15,6 +15,8 @@ interface FindNeighborsSessionOptions {
15
15
  const INITIAL_WAIT = 100
16
16
  const INTERVAL = 250
17
17
 
18
+ const logger = new Logger(module)
19
+
18
20
  export class NeighborFinder {
19
21
  private readonly abortController: AbortController
20
22
  private readonly options: FindNeighborsSessionOptions
@@ -39,6 +41,9 @@ export class NeighborFinder {
39
41
  if (this.options.neighbors.size() < this.options.minCount && newExcludes.length < uniqueContactCount) {
40
42
  // TODO should we catch possible promise rejection?
41
43
  setAbortableTimeout(() => this.findNeighbors(newExcludes), INTERVAL, this.abortController.signal)
44
+ } else if (this.options.neighbors.size() === 0 && uniqueContactCount > 0) {
45
+ logger.debug('No neighbors found yet contacts are available, restarting handshaking process')
46
+ setAbortableTimeout(() => this.findNeighbors([]), INTERVAL, this.abortController.signal)
42
47
  } else {
43
48
  this.running = false
44
49
  }
@@ -1,4 +1,4 @@
1
- import { DhtAddress, ListeningRpcCommunicator, PeerDescriptor, getNodeIdFromPeerDescriptor } from '@streamr/dht'
1
+ import { DhtAddress, ListeningRpcCommunicator, PeerDescriptor, toNodeId } from '@streamr/dht'
2
2
  import { Logger, StreamPartID, scheduleAtInterval } from '@streamr/utils'
3
3
  import { NeighborUpdate } from '../../proto/packages/trackerless-network/protos/NetworkRpc'
4
4
  import { NeighborUpdateRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
@@ -46,10 +46,12 @@ export class NeighborUpdateManager {
46
46
  private async updateNeighborInfo(): Promise<void> {
47
47
  logger.trace(`Updating neighbor info to nodes`)
48
48
  const neighborDescriptors = this.options.neighbors.getAll().map((neighbor) => neighbor.getPeerDescriptor())
49
+ const startTime = Date.now()
49
50
  await Promise.allSettled(this.options.neighbors.getAll().map(async (neighbor) => {
50
51
  const res = await this.createRemote(neighbor.getPeerDescriptor()).updateNeighbors(this.options.streamPartId, neighborDescriptors)
52
+ const nodeId = toNodeId(neighbor.getPeerDescriptor())
53
+ this.options.neighbors.get(nodeId)!.setRtt(Date.now() - startTime)
51
54
  if (res.removeMe) {
52
- const nodeId = getNodeIdFromPeerDescriptor(neighbor.getPeerDescriptor())
53
55
  this.options.neighbors.remove(nodeId)
54
56
  this.options.neighborFinder.start([nodeId])
55
57
  }
@@ -1,5 +1,5 @@
1
1
  import { ServerCallContext } from '@protobuf-ts/runtime-rpc'
2
- import { DhtAddress, DhtCallContext, ListeningRpcCommunicator, PeerDescriptor, getNodeIdFromPeerDescriptor } from '@streamr/dht'
2
+ import { DhtAddress, DhtCallContext, ListeningRpcCommunicator, PeerDescriptor, toNodeId } from '@streamr/dht'
3
3
  import { StreamPartID } from '@streamr/utils'
4
4
  import { NeighborUpdate } from '../../proto/packages/trackerless-network/protos/NetworkRpc'
5
5
  import { ContentDeliveryRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
@@ -28,9 +28,9 @@ export class NeighborUpdateRpcLocal implements INeighborUpdateRpc {
28
28
  }
29
29
 
30
30
  private updateContacts(neighborDescriptors: PeerDescriptor[]): void {
31
- const ownNodeId = getNodeIdFromPeerDescriptor(this.options.localPeerDescriptor)
31
+ const ownNodeId = toNodeId(this.options.localPeerDescriptor)
32
32
  const newPeerDescriptors = neighborDescriptors.filter((peerDescriptor) => {
33
- const nodeId = getNodeIdFromPeerDescriptor(peerDescriptor)
33
+ const nodeId = toNodeId(peerDescriptor)
34
34
  return nodeId !== ownNodeId && !this.options.neighbors.getIds().includes(nodeId)
35
35
  })
36
36
  newPeerDescriptors.forEach((peerDescriptor) => this.options.nearbyNodeView.add(
@@ -54,7 +54,7 @@ export class NeighborUpdateRpcLocal implements INeighborUpdateRpc {
54
54
  // INeighborUpdateRpc server method
55
55
  async neighborUpdate(message: NeighborUpdate, context: ServerCallContext): Promise<NeighborUpdate> {
56
56
  const senderPeerDescriptor = (context as DhtCallContext).incomingSourceDescriptor!
57
- const remoteNodeId = getNodeIdFromPeerDescriptor(senderPeerDescriptor)
57
+ const remoteNodeId = toNodeId(senderPeerDescriptor)
58
58
  this.updateContacts(message.neighborDescriptors)
59
59
  if (!this.options.neighbors.has(remoteNodeId) && !this.options.ongoingHandshakes.has(remoteNodeId)) {
60
60
  return this.createResponse(true)
@@ -1,4 +1,4 @@
1
- import { PeerDescriptor, RpcRemote, getNodeIdFromPeerDescriptor } from '@streamr/dht'
1
+ import { PeerDescriptor, RpcRemote, toNodeId } from '@streamr/dht'
2
2
  import { Logger, StreamPartID } from '@streamr/utils'
3
3
  import { NeighborUpdate } from '../../proto/packages/trackerless-network/protos/NetworkRpc'
4
4
  import { NeighborUpdateRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
@@ -25,7 +25,7 @@ export class NeighborUpdateRpcRemote extends RpcRemote<NeighborUpdateRpcClient>
25
25
  removeMe: response.removeMe
26
26
  }
27
27
  } catch (err: any) {
28
- logger.debug(`updateNeighbors to ${getNodeIdFromPeerDescriptor(this.getPeerDescriptor())} failed`, { err })
28
+ logger.debug(`updateNeighbors to ${toNodeId(this.getPeerDescriptor())} failed`, { err })
29
29
  return {
30
30
  peerDescriptors: [],
31
31
  removeMe: true
@@ -65,7 +65,6 @@ export class Propagation {
65
65
 
66
66
  private sendAndAwaitThenMark({ message, source, handledNeighbors }: PropagationTask, neighborId: DhtAddress): void {
67
67
  if (!handledNeighbors.has(neighborId) && neighborId !== source) {
68
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
69
68
  (async () => {
70
69
  try {
71
70
  await this.sendToNeighbor(neighborId, message)
@@ -4,9 +4,9 @@ import {
4
4
  ITransport,
5
5
  ListeningRpcCommunicator,
6
6
  PeerDescriptor,
7
- getNodeIdFromPeerDescriptor
7
+ toNodeId
8
8
  } from '@streamr/dht'
9
- import { EthereumAddress, Logger, StreamPartID, addManagedEventListener, wait } from '@streamr/utils'
9
+ import { Logger, StreamPartID, UserID, addManagedEventListener, wait } from '@streamr/utils'
10
10
  import { EventEmitter } from 'eventemitter3'
11
11
  import { sampleSize } from 'lodash'
12
12
  import {
@@ -54,7 +54,7 @@ interface ProxyDefinition {
54
54
  nodes: Map<DhtAddress, PeerDescriptor>
55
55
  connectionCount: number
56
56
  direction: ProxyDirection
57
- userId: EthereumAddress
57
+ userId: UserID
58
58
  }
59
59
 
60
60
  interface ProxyConnection {
@@ -87,7 +87,7 @@ export class ProxyClient extends EventEmitter<Events> {
87
87
  this.options = options
88
88
  this.rpcCommunicator = new ListeningRpcCommunicator(formStreamPartContentDeliveryServiceId(options.streamPartId), options.transport)
89
89
  // TODO use options option or named constant?
90
- this.neighbors = new NodeList(getNodeIdFromPeerDescriptor(this.options.localPeerDescriptor), 1000)
90
+ this.neighbors = new NodeList(toNodeId(this.options.localPeerDescriptor), 1000)
91
91
  this.contentDeliveryRpcLocal = new ContentDeliveryRpcLocal({
92
92
  localPeerDescriptor: this.options.localPeerDescriptor,
93
93
  streamPartId: this.options.streamPartId,
@@ -128,7 +128,7 @@ export class ProxyClient extends EventEmitter<Events> {
128
128
  async setProxies(
129
129
  nodes: PeerDescriptor[],
130
130
  direction: ProxyDirection,
131
- userId: EthereumAddress,
131
+ userId: UserID,
132
132
  connectionCount?: number
133
133
  ): Promise<void> {
134
134
  logger.trace('Setting proxies', { streamPartId: this.options.streamPartId, peerDescriptors: nodes, direction, userId, connectionCount })
@@ -137,7 +137,7 @@ export class ProxyClient extends EventEmitter<Events> {
137
137
  }
138
138
  const nodesIds = new Map<DhtAddress, PeerDescriptor>()
139
139
  nodes.forEach((peerDescriptor) => {
140
- nodesIds.set(getNodeIdFromPeerDescriptor(peerDescriptor), peerDescriptor)
140
+ nodesIds.set(toNodeId(peerDescriptor), peerDescriptor)
141
141
  })
142
142
  this.definition = {
143
143
  nodes: nodesIds,
@@ -176,7 +176,7 @@ export class ProxyClient extends EventEmitter<Events> {
176
176
  ))
177
177
  }
178
178
 
179
- private async attemptConnection(nodeId: DhtAddress, direction: ProxyDirection, userId: EthereumAddress): Promise<void> {
179
+ private async attemptConnection(nodeId: DhtAddress, direction: ProxyDirection, userId: UserID): Promise<void> {
180
180
  const peerDescriptor = this.definition!.nodes.get(nodeId)!
181
181
  const rpcRemote = new ProxyConnectionRpcRemote(
182
182
  this.options.localPeerDescriptor,
@@ -225,7 +225,7 @@ export class ProxyClient extends EventEmitter<Events> {
225
225
  }
226
226
 
227
227
  private removeConnection(peerDescriptor: PeerDescriptor): void {
228
- const nodeId = getNodeIdFromPeerDescriptor(peerDescriptor)
228
+ const nodeId = toNodeId(peerDescriptor)
229
229
  this.connections.delete(nodeId)
230
230
  this.neighbors.remove(nodeId)
231
231
  this.options.connectionLocker.unlockConnection(peerDescriptor, SERVICE_ID)
@@ -248,7 +248,7 @@ export class ProxyClient extends EventEmitter<Events> {
248
248
  }
249
249
 
250
250
  private async onNodeDisconnected(peerDescriptor: PeerDescriptor): Promise<void> {
251
- const nodeId = getNodeIdFromPeerDescriptor(peerDescriptor)
251
+ const nodeId = toNodeId(peerDescriptor)
252
252
  if (this.connections.has(nodeId)) {
253
253
  this.options.connectionLocker.unlockConnection(peerDescriptor, SERVICE_ID)
254
254
  this.removeConnection(peerDescriptor)
@@ -267,6 +267,12 @@ export class ProxyClient extends EventEmitter<Events> {
267
267
  )
268
268
  }
269
269
 
270
+ public getDiagnosticInfo(): Record<string, unknown> {
271
+ return {
272
+ neighbors: this.neighbors.getAll().map((neighbor) => neighbor.getPeerDescriptor()),
273
+ }
274
+ }
275
+
270
276
  stop(): void {
271
277
  this.neighbors.getAll().forEach((remote) => {
272
278
  this.options.connectionLocker.unlockConnection(remote.getPeerDescriptor(), SERVICE_ID)
@@ -1,6 +1,6 @@
1
1
  import { ServerCallContext } from '@protobuf-ts/runtime-rpc'
2
- import { DhtAddress, DhtCallContext, ListeningRpcCommunicator, PeerDescriptor, getNodeIdFromPeerDescriptor } from '@streamr/dht'
3
- import { EthereumAddress, Logger, StreamPartID, binaryToHex, toEthereumAddress } from '@streamr/utils'
2
+ import { DhtAddress, DhtCallContext, ListeningRpcCommunicator, PeerDescriptor, toNodeId } from '@streamr/dht'
3
+ import { Logger, StreamPartID, UserID, binaryToHex, toEthereumAddress } from '@streamr/utils'
4
4
  import { EventEmitter } from 'eventemitter3'
5
5
  import {
6
6
  ProxyConnectionRequest,
@@ -16,7 +16,7 @@ const logger = new Logger(module)
16
16
 
17
17
  interface ProxyConnection {
18
18
  direction: ProxyDirection // Direction is from the client's point of view
19
- userId: EthereumAddress
19
+ userId: UserID
20
20
  remote: ContentDeliveryRpcRemote
21
21
  }
22
22
 
@@ -74,7 +74,7 @@ export class ProxyConnectionRpcLocal extends EventEmitter<Events> implements IPr
74
74
  }
75
75
  }
76
76
 
77
- private getNodeIdsForUserId(userId: EthereumAddress): DhtAddress[] {
77
+ private getNodeIdsForUserId(userId: UserID): DhtAddress[] {
78
78
  return Array.from(this.connections.keys()).filter((nodeId) => this.connections.get(nodeId)!.userId === userId)
79
79
  }
80
80
 
@@ -85,7 +85,7 @@ export class ProxyConnectionRpcLocal extends EventEmitter<Events> implements IPr
85
85
  // IProxyConnectionRpc server method
86
86
  async requestConnection(request: ProxyConnectionRequest, context: ServerCallContext): Promise<ProxyConnectionResponse> {
87
87
  const senderPeerDescriptor = (context as DhtCallContext).incomingSourceDescriptor!
88
- const remoteNodeId = getNodeIdFromPeerDescriptor(senderPeerDescriptor)
88
+ const remoteNodeId = toNodeId(senderPeerDescriptor)
89
89
  this.connections.set(remoteNodeId, {
90
90
  direction: request.direction,
91
91
  userId: toEthereumAddress(binaryToHex(request.userId, true)),
@@ -1,5 +1,5 @@
1
1
  import { EXISTING_CONNECTION_TIMEOUT, RpcRemote } from '@streamr/dht'
2
- import { EthereumAddress, Logger, hexToBinary } from '@streamr/utils'
2
+ import { Logger, UserID, hexToBinary } from '@streamr/utils'
3
3
  import { ProxyConnectionRequest, ProxyDirection } from '../../proto/packages/trackerless-network/protos/NetworkRpc'
4
4
  import { ProxyConnectionRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
5
5
 
@@ -7,7 +7,7 @@ const logger = new Logger(module)
7
7
 
8
8
  export class ProxyConnectionRpcRemote extends RpcRemote<ProxyConnectionRpcClient> {
9
9
 
10
- async requestConnection(direction: ProxyDirection, userId: EthereumAddress): Promise<boolean> {
10
+ async requestConnection(direction: ProxyDirection, userId: UserID): Promise<boolean> {
11
11
  const request: ProxyConnectionRequest = {
12
12
  direction,
13
13
  userId: hexToBinary(userId)
@@ -1,5 +1,5 @@
1
1
  import { ServerCallContext } from '@protobuf-ts/runtime-rpc'
2
- import { ConnectionLocker, DhtAddress, DhtCallContext, ListeningRpcCommunicator, getNodeIdFromPeerDescriptor } from '@streamr/dht'
2
+ import { ConnectionLocker, DhtAddress, DhtCallContext, ListeningRpcCommunicator, toNodeId } from '@streamr/dht'
3
3
  import { StreamPartID } from '@streamr/utils'
4
4
  import { Empty } from '../../proto/google/protobuf/empty'
5
5
  import { PeerDescriptor } from '../../proto/packages/dht/protos/DhtRpc'
@@ -30,7 +30,7 @@ export class TemporaryConnectionRpcLocal implements ITemporaryConnectionRpc {
30
30
  constructor(options: TemporaryConnectionRpcLocalOptions) {
31
31
  this.options = options
32
32
  // TODO use options option or named constant?
33
- this.temporaryNodes = new NodeList(getNodeIdFromPeerDescriptor(options.localPeerDescriptor), 10)
33
+ this.temporaryNodes = new NodeList(toNodeId(options.localPeerDescriptor), 10)
34
34
  this.lockId = LOCK_ID_BASE + options.streamPartId
35
35
  }
36
36
 
@@ -59,14 +59,14 @@ export class TemporaryConnectionRpcLocal implements ITemporaryConnectionRpc {
59
59
  ContentDeliveryRpcClient
60
60
  )
61
61
  this.temporaryNodes.add(remote)
62
- this.options.connectionLocker.weakLockConnection(getNodeIdFromPeerDescriptor(sender), this.lockId)
62
+ this.options.connectionLocker.weakLockConnection(toNodeId(sender), this.lockId)
63
63
  return {
64
64
  accepted: true
65
65
  }
66
66
  }
67
67
 
68
68
  async closeConnection(_request: CloseTemporaryConnection, context: ServerCallContext): Promise<Empty> {
69
- const remoteNodeId = getNodeIdFromPeerDescriptor((context as DhtCallContext).incomingSourceDescriptor!)
69
+ const remoteNodeId = toNodeId((context as DhtCallContext).incomingSourceDescriptor!)
70
70
  this.removeNode(remoteNodeId)
71
71
  return {}
72
72
  }
@@ -1,4 +1,4 @@
1
- import { RpcRemote, getNodeIdFromPeerDescriptor } from '@streamr/dht'
1
+ import { RpcRemote, toNodeId } from '@streamr/dht'
2
2
  import { Logger } from '@streamr/utils'
3
3
  import { TemporaryConnectionRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
4
4
 
@@ -11,7 +11,7 @@ export class TemporaryConnectionRpcRemote extends RpcRemote<TemporaryConnectionR
11
11
  const response = await this.getClient().openConnection({}, this.formDhtRpcOptions())
12
12
  return response.accepted
13
13
  } catch (err: any) {
14
- logger.debug(`temporaryConnection to ${getNodeIdFromPeerDescriptor(this.getPeerDescriptor())} failed`, { err })
14
+ logger.debug(`temporaryConnection to ${toNodeId(this.getPeerDescriptor())} failed`, { err })
15
15
  return false
16
16
  }
17
17
  }
@@ -23,7 +23,7 @@ export class TemporaryConnectionRpcRemote extends RpcRemote<TemporaryConnectionR
23
23
  notification: true
24
24
  }))
25
25
  } catch (err) {
26
- logger.trace(`closeConnection to ${getNodeIdFromPeerDescriptor(this.getPeerDescriptor())} failed`, { err })
26
+ logger.trace(`closeConnection to ${toNodeId(this.getPeerDescriptor())} failed`, { err })
27
27
  }
28
28
  }
29
29
  }
@@ -73,6 +73,10 @@ import { MessageType } from "@protobuf-ts/runtime";
73
73
  * if (any.is(Foo.class)) {
74
74
  * foo = any.unpack(Foo.class);
75
75
  * }
76
+ * // or ...
77
+ * if (any.isSameTypeAs(Foo.getDefaultInstance())) {
78
+ * foo = any.unpack(Foo.getDefaultInstance());
79
+ * }
76
80
  *
77
81
  * Example 3: Pack and unpack a message in Python.
78
82
  *
@@ -87,10 +91,13 @@ import { MessageType } from "@protobuf-ts/runtime";
87
91
  * Example 4: Pack and unpack a message in Go
88
92
  *
89
93
  * foo := &pb.Foo{...}
90
- * any, err := ptypes.MarshalAny(foo)
94
+ * any, err := anypb.New(foo)
95
+ * if err != nil {
96
+ * ...
97
+ * }
91
98
  * ...
92
99
  * foo := &pb.Foo{}
93
- * if err := ptypes.UnmarshalAny(any, foo); err != nil {
100
+ * if err := any.UnmarshalTo(foo); err != nil {
94
101
  * ...
95
102
  * }
96
103
  *
@@ -100,7 +107,6 @@ import { MessageType } from "@protobuf-ts/runtime";
100
107
  * in the type URL, for example "foo.bar.com/x/y.z" will yield type
101
108
  * name "y.z".
102
109
  *
103
- *
104
110
  * JSON
105
111
  * ====
106
112
  * The JSON representation of an `Any` value uses the regular
@@ -157,7 +163,8 @@ export interface Any {
157
163
  *
158
164
  * Note: this functionality is not currently available in the official
159
165
  * protobuf release, and it is not used for type URLs beginning with
160
- * type.googleapis.com.
166
+ * type.googleapis.com. As of May 2023, there are no widely used type server
167
+ * implementations and no plans to implement one.
161
168
  *
162
169
  * Schemes other than `http`, `https` (or the empty scheme) might be
163
170
  * used with implementation specific semantics.
@@ -49,7 +49,6 @@ import { MessageType } from "@protobuf-ts/runtime";
49
49
  * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
50
50
  * }
51
51
  *
52
- * The JSON representation for `Empty` is empty JSON object `{}`.
53
52
  *
54
53
  * @generated from protobuf message google.protobuf.Empty
55
54
  */
@@ -97,8 +97,15 @@ import { MessageType } from "@protobuf-ts/runtime";
97
97
  * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
98
98
  * .setNanos((int) ((millis % 1000) * 1000000)).build();
99
99
  *
100
+ * Example 5: Compute Timestamp from Java `Instant.now()`.
100
101
  *
101
- * Example 5: Compute Timestamp from current time in Python.
102
+ * Instant now = Instant.now();
103
+ *
104
+ * Timestamp timestamp =
105
+ * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
106
+ * .setNanos(now.getNano()).build();
107
+ *
108
+ * Example 6: Compute Timestamp from current time in Python.
102
109
  *
103
110
  * timestamp = Timestamp()
104
111
  * timestamp.GetCurrentTime()
@@ -127,11 +134,10 @@ import { MessageType } from "@protobuf-ts/runtime";
127
134
  * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
128
135
  * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
129
136
  * the Joda Time's [`ISODateTimeFormat.dateTime()`](
130
- * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
137
+ * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
131
138
  * ) to obtain a formatter capable of generating timestamps in this format.
132
139
  *
133
140
  *
134
- *
135
141
  * @generated from protobuf message google.protobuf.Timestamp
136
142
  */
137
143
  export interface Timestamp {
@@ -316,9 +316,26 @@ export interface StreamPartitionInfo {
316
316
  */
317
317
  controlLayerNeighbors: PeerDescriptor[];
318
318
  /**
319
- * @generated from protobuf field: repeated dht.PeerDescriptor contentDeliveryLayerNeighbors = 3;
319
+ * @generated from protobuf field: repeated dht.PeerDescriptor deprecatedContentDeliveryLayerNeighbors = 3;
320
320
  */
321
- contentDeliveryLayerNeighbors: PeerDescriptor[];
321
+ deprecatedContentDeliveryLayerNeighbors: PeerDescriptor[];
322
+ /**
323
+ * @generated from protobuf field: repeated ContentDeliveryLayerNeighborInfo contentDeliveryLayerNeighbors = 4;
324
+ */
325
+ contentDeliveryLayerNeighbors: ContentDeliveryLayerNeighborInfo[];
326
+ }
327
+ /**
328
+ * @generated from protobuf message ContentDeliveryLayerNeighborInfo
329
+ */
330
+ export interface ContentDeliveryLayerNeighborInfo {
331
+ /**
332
+ * @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 1;
333
+ */
334
+ peerDescriptor?: PeerDescriptor;
335
+ /**
336
+ * @generated from protobuf field: optional int32 rtt = 2;
337
+ */
338
+ rtt?: number;
322
339
  }
323
340
  /**
324
341
  * @generated from protobuf message ControlLayerInfo
@@ -665,7 +682,8 @@ class StreamPartitionInfo$Type extends MessageType<StreamPartitionInfo> {
665
682
  super("StreamPartitionInfo", [
666
683
  { no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
667
684
  { no: 2, name: "controlLayerNeighbors", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor },
668
- { no: 3, name: "contentDeliveryLayerNeighbors", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }
685
+ { no: 3, name: "deprecatedContentDeliveryLayerNeighbors", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor },
686
+ { no: 4, name: "contentDeliveryLayerNeighbors", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => ContentDeliveryLayerNeighborInfo }
669
687
  ]);
670
688
  }
671
689
  }
@@ -674,6 +692,19 @@ class StreamPartitionInfo$Type extends MessageType<StreamPartitionInfo> {
674
692
  */
675
693
  export const StreamPartitionInfo = new StreamPartitionInfo$Type();
676
694
  // @generated message type with reflection information, may provide speed optimized methods
695
+ class ContentDeliveryLayerNeighborInfo$Type extends MessageType<ContentDeliveryLayerNeighborInfo> {
696
+ constructor() {
697
+ super("ContentDeliveryLayerNeighborInfo", [
698
+ { no: 1, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor },
699
+ { no: 2, name: "rtt", kind: "scalar", opt: true, T: 5 /*ScalarType.INT32*/ }
700
+ ]);
701
+ }
702
+ }
703
+ /**
704
+ * @generated MessageType for protobuf message ContentDeliveryLayerNeighborInfo
705
+ */
706
+ export const ContentDeliveryLayerNeighborInfo = new ContentDeliveryLayerNeighborInfo$Type();
707
+ // @generated message type with reflection information, may provide speed optimized methods
677
708
  class ControlLayerInfo$Type extends MessageType<ControlLayerInfo> {
678
709
  constructor() {
679
710
  super("ControlLayerInfo", [