@streamr/trackerless-network 100.0.0-testnet-one.4 → 100.0.0-testnet-two.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +7 -7
- package/dist/src/NetworkStack.d.ts +1 -5
- package/dist/src/NetworkStack.js +1 -3
- package/dist/src/NetworkStack.js.map +1 -1
- package/dist/src/logic/DeliveryRpcLocal.d.ts +1 -1
- package/dist/src/logic/DeliveryRpcLocal.js +3 -3
- package/dist/src/logic/DeliveryRpcLocal.js.map +1 -1
- package/dist/src/logic/DeliveryRpcRemote.d.ts +3 -3
- package/dist/src/logic/DeliveryRpcRemote.js +3 -2
- package/dist/src/logic/DeliveryRpcRemote.js.map +1 -1
- package/dist/src/logic/EntryPointDiscovery.d.ts +3 -0
- package/dist/src/logic/EntryPointDiscovery.js +11 -5
- package/dist/src/logic/EntryPointDiscovery.js.map +1 -1
- package/dist/src/logic/RandomGraphNode.d.ts +10 -8
- package/dist/src/logic/RandomGraphNode.js +23 -17
- package/dist/src/logic/RandomGraphNode.js.map +1 -1
- package/dist/src/logic/StreamrNode.js +13 -4
- package/dist/src/logic/StreamrNode.js.map +1 -1
- package/dist/src/logic/formStreamPartDeliveryServiceId.d.ts +2 -1
- package/dist/src/logic/formStreamPartDeliveryServiceId.js.map +1 -1
- package/dist/src/logic/inspect/Inspector.d.ts +5 -11
- package/dist/src/logic/inspect/Inspector.js +2 -3
- package/dist/src/logic/inspect/Inspector.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.d.ts +3 -3
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js +39 -13
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.d.ts +5 -3
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js +18 -8
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/Handshaker.d.ts +1 -6
- package/dist/src/logic/neighbor-discovery/Handshaker.js +6 -6
- package/dist/src/logic/neighbor-discovery/Handshaker.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborFinder.d.ts +1 -6
- package/dist/src/logic/neighbor-discovery/NeighborFinder.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.d.ts +3 -8
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js +1 -3
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.d.ts +2 -2
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js +1 -2
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.d.ts +2 -2
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.js.map +1 -1
- package/dist/src/logic/proxy/ProxyClient.d.ts +4 -1
- package/dist/src/logic/proxy/ProxyClient.js +7 -6
- package/dist/src/logic/proxy/ProxyClient.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js +2 -3
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcRemote.d.ts +2 -2
- package/dist/src/logic/proxy/ProxyConnectionRpcRemote.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js +2 -2
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.d.ts +2 -2
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +21 -22
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +18 -18
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +49 -65
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +43 -58
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +11 -12
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.d.ts +6 -5
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.js +2 -2
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.js.map +1 -1
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.d.ts +26 -10
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js +21 -9
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js.map +1 -1
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.server.d.ts +4 -3
- package/dist/test/benchmark/first-message.js +4 -6
- package/dist/test/benchmark/first-message.js.map +1 -1
- package/dist/test/utils/utils.d.ts +1 -1
- package/dist/test/utils/utils.js +8 -7
- package/dist/test/utils/utils.js.map +1 -1
- package/package.json +7 -7
- package/protos/NetworkRpc.proto +8 -4
- package/src/NetworkStack.ts +1 -7
- package/src/logic/DeliveryRpcLocal.ts +4 -4
- package/src/logic/DeliveryRpcRemote.ts +5 -4
- package/src/logic/EntryPointDiscovery.ts +10 -6
- package/src/logic/RandomGraphNode.ts +38 -25
- package/src/logic/StreamrNode.ts +22 -5
- package/src/logic/formStreamPartDeliveryServiceId.ts +2 -1
- package/src/logic/inspect/Inspector.ts +15 -16
- package/src/logic/neighbor-discovery/HandshakeRpcLocal.ts +46 -15
- package/src/logic/neighbor-discovery/HandshakeRpcRemote.ts +21 -10
- package/src/logic/neighbor-discovery/Handshaker.ts +15 -24
- package/src/logic/neighbor-discovery/NeighborFinder.ts +1 -7
- package/src/logic/neighbor-discovery/NeighborUpdateManager.ts +10 -12
- package/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts +4 -4
- package/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.ts +2 -2
- package/src/logic/proxy/ProxyClient.ts +19 -7
- package/src/logic/proxy/ProxyConnectionRpcLocal.ts +3 -3
- package/src/logic/proxy/ProxyConnectionRpcRemote.ts +3 -3
- package/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts +3 -2
- package/src/logic/temporary-connection/TemporaryConnectionRpcRemote.ts +2 -2
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +31 -32
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +11 -12
- package/src/proto/packages/dht/protos/DhtRpc.ts +67 -90
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.client.ts +7 -6
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.server.ts +4 -3
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.ts +36 -15
- package/test/benchmark/first-message.ts +8 -6
- package/test/end-to-end/random-graph-with-real-connections.test.ts +10 -5
- package/test/end-to-end/webrtc-full-node-network.test.ts +1 -1
- package/test/end-to-end/websocket-full-node-network.test.ts +2 -2
- package/test/integration/DeliveryRpcRemote.test.ts +3 -3
- package/test/integration/HandshakeRpcRemote.test.ts +2 -4
- package/test/integration/Handshakes.test.ts +8 -7
- package/test/integration/Inspect.test.ts +0 -2
- package/test/integration/NeighborUpdateRpcRemote.test.ts +2 -2
- package/test/integration/NetworkNode.test.ts +0 -2
- package/test/integration/NetworkRpc.test.ts +0 -3
- package/test/integration/RandomGraphNode-Layer1Node-Latencies.test.ts +4 -4
- package/test/integration/RandomGraphNode-Layer1Node.test.ts +4 -5
- package/test/integration/stream-without-default-entrypoints.test.ts +4 -7
- package/test/integration/streamEntryPointReplacing.test.ts +94 -0
- package/test/unit/DeliveryRpcLocal.test.ts +2 -1
- package/test/unit/EntrypointDiscovery.test.ts +5 -2
- package/test/unit/HandshakeRpcLocal.test.ts +47 -9
- package/test/unit/NodeList.test.ts +10 -12
- package/test/unit/ProxyConnectionRpcRemote.test.ts +18 -10
- package/test/unit/RandomGraphNode.test.ts +6 -4
- package/test/utils/mock/MockHandshaker.ts +3 -2
- package/test/utils/mock/MockNeighborFinder.ts +3 -2
- package/test/utils/mock/MockNeighborUpdateManager.ts +3 -2
- package/test/utils/utils.ts +16 -8
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { NeighborUpdate } from '../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
2
2
|
import { ListeningRpcCommunicator, PeerDescriptor } from '@streamr/dht'
|
|
3
|
-
import { ProtoRpcClient, toProtoRpcClient } from '@streamr/proto-rpc'
|
|
4
3
|
import { NeighborUpdateRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
5
4
|
import { Logger, scheduleAtInterval } from '@streamr/utils'
|
|
6
|
-
import {
|
|
5
|
+
import { NeighborFinder } from './NeighborFinder'
|
|
7
6
|
import { NodeList } from '../NodeList'
|
|
8
7
|
import { NeighborUpdateRpcRemote } from './NeighborUpdateRpcRemote'
|
|
9
8
|
import { NeighborUpdateRpcLocal } from './NeighborUpdateRpcLocal'
|
|
@@ -14,7 +13,7 @@ interface NeighborUpdateManagerConfig {
|
|
|
14
13
|
localPeerDescriptor: PeerDescriptor
|
|
15
14
|
targetNeighbors: NodeList
|
|
16
15
|
nearbyNodeView: NodeList
|
|
17
|
-
neighborFinder:
|
|
16
|
+
neighborFinder: NeighborFinder
|
|
18
17
|
streamPartId: StreamPartID
|
|
19
18
|
rpcCommunicator: ListeningRpcCommunicator
|
|
20
19
|
neighborUpdateInterval: number
|
|
@@ -22,21 +21,14 @@ interface NeighborUpdateManagerConfig {
|
|
|
22
21
|
|
|
23
22
|
const logger = new Logger(module)
|
|
24
23
|
|
|
25
|
-
export
|
|
26
|
-
start(): Promise<void>
|
|
27
|
-
stop(): void
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export class NeighborUpdateManager implements INeighborUpdateManager {
|
|
24
|
+
export class NeighborUpdateManager {
|
|
31
25
|
|
|
32
26
|
private readonly abortController: AbortController
|
|
33
27
|
private readonly config: NeighborUpdateManagerConfig
|
|
34
|
-
private readonly client: ProtoRpcClient<NeighborUpdateRpcClient>
|
|
35
28
|
private readonly rpcLocal: NeighborUpdateRpcLocal
|
|
36
29
|
|
|
37
30
|
constructor(config: NeighborUpdateManagerConfig) {
|
|
38
31
|
this.abortController = new AbortController()
|
|
39
|
-
this.client = toProtoRpcClient(new NeighborUpdateRpcClient(config.rpcCommunicator.getRpcClientTransport()))
|
|
40
32
|
this.rpcLocal = new NeighborUpdateRpcLocal(config)
|
|
41
33
|
this.config = config
|
|
42
34
|
this.config.rpcCommunicator.registerRpcMethod(NeighborUpdate, NeighborUpdate, 'neighborUpdate',
|
|
@@ -64,6 +56,12 @@ export class NeighborUpdateManager implements INeighborUpdateManager {
|
|
|
64
56
|
}
|
|
65
57
|
|
|
66
58
|
private createRemote(targetPeerDescriptor: PeerDescriptor): NeighborUpdateRpcRemote {
|
|
67
|
-
return new NeighborUpdateRpcRemote(
|
|
59
|
+
return new NeighborUpdateRpcRemote(
|
|
60
|
+
this.config.localPeerDescriptor,
|
|
61
|
+
targetPeerDescriptor,
|
|
62
|
+
this.config.streamPartId,
|
|
63
|
+
this.config.rpcCommunicator,
|
|
64
|
+
NeighborUpdateRpcClient
|
|
65
|
+
)
|
|
68
66
|
}
|
|
69
67
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ServerCallContext } from '@protobuf-ts/runtime-rpc'
|
|
2
2
|
import { DhtCallContext, ListeningRpcCommunicator, PeerDescriptor } from '@streamr/dht'
|
|
3
|
-
import { toProtoRpcClient } from '@streamr/proto-rpc'
|
|
4
3
|
import { getNodeIdFromPeerDescriptor } from '../../identifiers'
|
|
5
4
|
import { NeighborUpdate } from '../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
6
5
|
import { DeliveryRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
7
6
|
import { INeighborUpdateRpc } from '../../proto/packages/trackerless-network/protos/NetworkRpc.server'
|
|
8
7
|
import { NodeList } from '../NodeList'
|
|
9
8
|
import { DeliveryRpcRemote } from '../DeliveryRpcRemote'
|
|
10
|
-
import {
|
|
9
|
+
import { NeighborFinder } from './NeighborFinder'
|
|
11
10
|
import { StreamPartID } from '@streamr/protocol'
|
|
12
11
|
|
|
13
12
|
interface NeighborUpdateRpcLocalConfig {
|
|
@@ -15,7 +14,7 @@ interface NeighborUpdateRpcLocalConfig {
|
|
|
15
14
|
streamPartId: StreamPartID
|
|
16
15
|
targetNeighbors: NodeList
|
|
17
16
|
nearbyNodeView: NodeList
|
|
18
|
-
neighborFinder:
|
|
17
|
+
neighborFinder: NeighborFinder
|
|
19
18
|
rpcCommunicator: ListeningRpcCommunicator
|
|
20
19
|
}
|
|
21
20
|
|
|
@@ -43,7 +42,8 @@ export class NeighborUpdateRpcLocal implements INeighborUpdateRpc {
|
|
|
43
42
|
this.config.localPeerDescriptor,
|
|
44
43
|
peerDescriptor,
|
|
45
44
|
this.config.streamPartId,
|
|
46
|
-
|
|
45
|
+
this.config.rpcCommunicator,
|
|
46
|
+
DeliveryRpcClient
|
|
47
47
|
))
|
|
48
48
|
)
|
|
49
49
|
this.config.neighborFinder.start()
|
|
@@ -2,7 +2,7 @@ import { PeerDescriptor, RpcRemote } from '@streamr/dht'
|
|
|
2
2
|
import { Logger } from '@streamr/utils'
|
|
3
3
|
import { getNodeIdFromPeerDescriptor } from '../../identifiers'
|
|
4
4
|
import { NeighborUpdate } from '../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
5
|
-
import {
|
|
5
|
+
import { NeighborUpdateRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
6
6
|
|
|
7
7
|
const logger = new Logger(module)
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ interface UpdateNeighborsResponse {
|
|
|
11
11
|
removeMe: boolean
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export class NeighborUpdateRpcRemote extends RpcRemote<
|
|
14
|
+
export class NeighborUpdateRpcRemote extends RpcRemote<NeighborUpdateRpcClient> {
|
|
15
15
|
|
|
16
16
|
async updateNeighbors(neighbors: PeerDescriptor[]): Promise<UpdateNeighborsResponse> {
|
|
17
17
|
const request: NeighborUpdate = {
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
ListeningRpcCommunicator,
|
|
5
5
|
PeerDescriptor
|
|
6
6
|
} from '@streamr/dht'
|
|
7
|
-
import { toProtoRpcClient } from '@streamr/proto-rpc'
|
|
8
7
|
import { StreamPartID } from '@streamr/protocol'
|
|
9
8
|
import { EthereumAddress, Logger, addManagedEventListener, wait } from '@streamr/utils'
|
|
10
9
|
import { EventEmitter } from 'eventemitter3'
|
|
@@ -27,6 +26,7 @@ import { markAndCheckDuplicate } from '../utils'
|
|
|
27
26
|
import { ProxyConnectionRpcRemote } from './ProxyConnectionRpcRemote'
|
|
28
27
|
import { formStreamPartDeliveryServiceId } from '../formStreamPartDeliveryServiceId'
|
|
29
28
|
|
|
29
|
+
// TODO use config option or named constant?
|
|
30
30
|
export const retry = async <T>(task: () => Promise<T>, description: string, abortSignal: AbortSignal, delay = 10000): Promise<T> => {
|
|
31
31
|
// eslint-disable-next-line no-constant-condition
|
|
32
32
|
while (true) {
|
|
@@ -57,11 +57,15 @@ interface ProxyDefinition {
|
|
|
57
57
|
userId: EthereumAddress
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
interface Events {
|
|
61
|
+
message: (message: StreamMessage) => void
|
|
62
|
+
}
|
|
63
|
+
|
|
60
64
|
const logger = new Logger(module)
|
|
61
65
|
|
|
62
66
|
const SERVICE_ID = 'system/proxy-client'
|
|
63
67
|
|
|
64
|
-
export class ProxyClient extends EventEmitter {
|
|
68
|
+
export class ProxyClient extends EventEmitter<Events> {
|
|
65
69
|
|
|
66
70
|
private readonly rpcCommunicator: ListeningRpcCommunicator
|
|
67
71
|
private readonly deliveryRpcLocal: DeliveryRpcLocal
|
|
@@ -77,6 +81,7 @@ export class ProxyClient extends EventEmitter {
|
|
|
77
81
|
super()
|
|
78
82
|
this.config = config
|
|
79
83
|
this.rpcCommunicator = new ListeningRpcCommunicator(formStreamPartDeliveryServiceId(config.streamPartId), config.transport)
|
|
84
|
+
// TODO use config option or named constant?
|
|
80
85
|
this.targetNeighbors = new NodeList(getNodeIdFromPeerDescriptor(this.config.localPeerDescriptor), 1000)
|
|
81
86
|
this.deliveryRpcLocal = new DeliveryRpcLocal({
|
|
82
87
|
localPeerDescriptor: this.config.localPeerDescriptor,
|
|
@@ -94,6 +99,7 @@ export class ProxyClient extends EventEmitter {
|
|
|
94
99
|
markForInspection: () => {}
|
|
95
100
|
})
|
|
96
101
|
this.propagation = new Propagation({
|
|
102
|
+
// TODO use config option or named constant?
|
|
97
103
|
minPropagationTargets: config.minPropagationTargets ?? 2,
|
|
98
104
|
sendToNeighbor: async (neighborId: NodeID, msg: StreamMessage): Promise<void> => {
|
|
99
105
|
const remote = this.targetNeighbors.get(neighborId)
|
|
@@ -167,8 +173,13 @@ export class ProxyClient extends EventEmitter {
|
|
|
167
173
|
|
|
168
174
|
private async attemptConnection(nodeId: NodeID, direction: ProxyDirection, userId: EthereumAddress): Promise<void> {
|
|
169
175
|
const peerDescriptor = this.definition!.nodes.get(nodeId)!
|
|
170
|
-
const
|
|
171
|
-
|
|
176
|
+
const rpcRemote = new ProxyConnectionRpcRemote(
|
|
177
|
+
this.config.localPeerDescriptor,
|
|
178
|
+
peerDescriptor,
|
|
179
|
+
this.config.streamPartId,
|
|
180
|
+
this.rpcCommunicator,
|
|
181
|
+
ProxyConnectionRpcClient
|
|
182
|
+
)
|
|
172
183
|
const accepted = await rpcRemote.requestConnection(direction, userId)
|
|
173
184
|
if (accepted) {
|
|
174
185
|
this.config.connectionLocker.lockConnection(peerDescriptor, SERVICE_ID)
|
|
@@ -177,7 +188,8 @@ export class ProxyClient extends EventEmitter {
|
|
|
177
188
|
this.config.localPeerDescriptor,
|
|
178
189
|
peerDescriptor,
|
|
179
190
|
this.config.streamPartId,
|
|
180
|
-
|
|
191
|
+
this.rpcCommunicator,
|
|
192
|
+
DeliveryRpcClient
|
|
181
193
|
)
|
|
182
194
|
this.targetNeighbors.add(remote)
|
|
183
195
|
this.propagation.onNeighborJoined(nodeId)
|
|
@@ -204,7 +216,7 @@ export class ProxyClient extends EventEmitter {
|
|
|
204
216
|
nodeId
|
|
205
217
|
})
|
|
206
218
|
const server = this.targetNeighbors.get(nodeId)
|
|
207
|
-
server?.leaveStreamPartNotice()
|
|
219
|
+
server?.leaveStreamPartNotice(false)
|
|
208
220
|
this.removeConnection(nodeId)
|
|
209
221
|
}
|
|
210
222
|
}
|
|
@@ -253,7 +265,7 @@ export class ProxyClient extends EventEmitter {
|
|
|
253
265
|
stop(): void {
|
|
254
266
|
this.targetNeighbors.getAll().map((remote) => {
|
|
255
267
|
this.config.connectionLocker.unlockConnection(remote.getPeerDescriptor(), SERVICE_ID)
|
|
256
|
-
remote.leaveStreamPartNotice()
|
|
268
|
+
remote.leaveStreamPartNotice(false)
|
|
257
269
|
})
|
|
258
270
|
this.targetNeighbors.stop()
|
|
259
271
|
this.rpcCommunicator.destroy()
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
import { IProxyConnectionRpc } from '../../proto/packages/trackerless-network/protos/NetworkRpc.server'
|
|
11
11
|
import { DeliveryRpcRemote } from '../DeliveryRpcRemote'
|
|
12
12
|
import { DhtCallContext, ListeningRpcCommunicator, PeerDescriptor } from '@streamr/dht'
|
|
13
|
-
import { toProtoRpcClient } from '@streamr/proto-rpc'
|
|
14
13
|
import { DeliveryRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
15
14
|
import { EventEmitter } from 'eventemitter3'
|
|
16
15
|
import { EthereumAddress, Logger, binaryToHex, toEthereumAddress } from '@streamr/utils'
|
|
@@ -60,7 +59,7 @@ export class ProxyConnectionRpcLocal extends EventEmitter<Events> implements IPr
|
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
stop(): void {
|
|
63
|
-
this.connections.forEach((connection) => connection.remote.leaveStreamPartNotice())
|
|
62
|
+
this.connections.forEach((connection) => connection.remote.leaveStreamPartNotice(false))
|
|
64
63
|
this.connections.clear()
|
|
65
64
|
this.removeAllListeners()
|
|
66
65
|
}
|
|
@@ -98,7 +97,8 @@ export class ProxyConnectionRpcLocal extends EventEmitter<Events> implements IPr
|
|
|
98
97
|
this.config.localPeerDescriptor,
|
|
99
98
|
senderPeerDescriptor,
|
|
100
99
|
this.config.streamPartId,
|
|
101
|
-
|
|
100
|
+
this.config.rpcCommunicator,
|
|
101
|
+
DeliveryRpcClient
|
|
102
102
|
)
|
|
103
103
|
})
|
|
104
104
|
const response: ProxyConnectionResponse = {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EXISTING_CONNECTION_TIMEOUT, RpcRemote } from '@streamr/dht'
|
|
2
2
|
import { EthereumAddress, Logger, hexToBinary } from '@streamr/utils'
|
|
3
3
|
import { ProxyConnectionRequest, ProxyDirection } from '../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
4
|
-
import {
|
|
4
|
+
import { ProxyConnectionRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
5
5
|
|
|
6
6
|
const logger = new Logger(module)
|
|
7
7
|
|
|
8
|
-
export class ProxyConnectionRpcRemote extends RpcRemote<
|
|
8
|
+
export class ProxyConnectionRpcRemote extends RpcRemote<ProxyConnectionRpcClient> {
|
|
9
9
|
|
|
10
10
|
async requestConnection(direction: ProxyDirection, userId: EthereumAddress): Promise<boolean> {
|
|
11
11
|
const request: ProxyConnectionRequest = {
|
|
@@ -4,7 +4,6 @@ import { ITemporaryConnectionRpc } from '../../proto/packages/trackerless-networ
|
|
|
4
4
|
import { DhtCallContext, ListeningRpcCommunicator } from '@streamr/dht'
|
|
5
5
|
import { DeliveryRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
6
6
|
import { NodeList } from '../NodeList'
|
|
7
|
-
import { toProtoRpcClient } from '@streamr/proto-rpc'
|
|
8
7
|
import { DeliveryRpcRemote } from '../DeliveryRpcRemote'
|
|
9
8
|
import { PeerDescriptor } from '../../proto/packages/dht/protos/DhtRpc'
|
|
10
9
|
import { getNodeIdFromPeerDescriptor } from '../../identifiers'
|
|
@@ -23,6 +22,7 @@ export class TemporaryConnectionRpcLocal implements ITemporaryConnectionRpc {
|
|
|
23
22
|
|
|
24
23
|
constructor(config: TemporaryConnectionRpcLocalConfig) {
|
|
25
24
|
this.config = config
|
|
25
|
+
// TODO use config option or named constant?
|
|
26
26
|
this.temporaryNodes = new NodeList(getNodeIdFromPeerDescriptor(config.localPeerDescriptor), 10)
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -43,7 +43,8 @@ export class TemporaryConnectionRpcLocal implements ITemporaryConnectionRpc {
|
|
|
43
43
|
this.config.localPeerDescriptor,
|
|
44
44
|
sender,
|
|
45
45
|
this.config.streamPartId,
|
|
46
|
-
|
|
46
|
+
this.config.rpcCommunicator,
|
|
47
|
+
DeliveryRpcClient
|
|
47
48
|
)
|
|
48
49
|
this.temporaryNodes.add(remote)
|
|
49
50
|
return {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RpcRemote } from '@streamr/dht'
|
|
2
2
|
import { Logger } from '@streamr/utils'
|
|
3
3
|
import { getNodeIdFromPeerDescriptor } from '../../identifiers'
|
|
4
|
-
import {
|
|
4
|
+
import { TemporaryConnectionRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
5
5
|
|
|
6
6
|
const logger = new Logger(module)
|
|
7
7
|
|
|
8
|
-
export class TemporaryConnectionRpcRemote extends RpcRemote<
|
|
8
|
+
export class TemporaryConnectionRpcRemote extends RpcRemote<TemporaryConnectionRpcClient> {
|
|
9
9
|
|
|
10
10
|
async openConnection(): Promise<boolean> {
|
|
11
11
|
try {
|
|
@@ -18,15 +18,14 @@ import type { RtcAnswer } from "./DhtRpc";
|
|
|
18
18
|
import type { RtcOffer } from "./DhtRpc";
|
|
19
19
|
import type { WebrtcConnectionRequest } from "./DhtRpc";
|
|
20
20
|
import { WebsocketConnectorRpc } from "./DhtRpc";
|
|
21
|
-
import type { WebsocketConnectionResponse } from "./DhtRpc";
|
|
22
21
|
import type { WebsocketConnectionRequest } from "./DhtRpc";
|
|
23
|
-
import {
|
|
24
|
-
import type {
|
|
22
|
+
import { RecursiveOperationSessionRpc } from "./DhtRpc";
|
|
23
|
+
import type { RecursiveOperationResponse } from "./DhtRpc";
|
|
25
24
|
import { StoreRpc } from "./DhtRpc";
|
|
26
25
|
import type { ReplicateDataRequest } from "./DhtRpc";
|
|
27
26
|
import type { StoreDataResponse } from "./DhtRpc";
|
|
28
27
|
import type { StoreDataRequest } from "./DhtRpc";
|
|
29
|
-
import {
|
|
28
|
+
import { RecursiveOperationRpc } from "./DhtRpc";
|
|
30
29
|
import { RouterRpc } from "./DhtRpc";
|
|
31
30
|
import type { RouteMessageAck } from "./DhtRpc";
|
|
32
31
|
import type { RouteMessageWrapper } from "./DhtRpc";
|
|
@@ -128,27 +127,27 @@ export class RouterRpcClient implements IRouterRpcClient, ServiceInfo {
|
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
129
|
/**
|
|
131
|
-
* @generated from protobuf service dht.
|
|
130
|
+
* @generated from protobuf service dht.RecursiveOperationRpc
|
|
132
131
|
*/
|
|
133
|
-
export interface
|
|
132
|
+
export interface IRecursiveOperationRpcClient {
|
|
134
133
|
/**
|
|
135
|
-
* @generated from protobuf rpc:
|
|
134
|
+
* @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
|
|
136
135
|
*/
|
|
137
|
-
|
|
136
|
+
routeRequest(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall<RouteMessageWrapper, RouteMessageAck>;
|
|
138
137
|
}
|
|
139
138
|
/**
|
|
140
|
-
* @generated from protobuf service dht.
|
|
139
|
+
* @generated from protobuf service dht.RecursiveOperationRpc
|
|
141
140
|
*/
|
|
142
|
-
export class
|
|
143
|
-
typeName =
|
|
144
|
-
methods =
|
|
145
|
-
options =
|
|
141
|
+
export class RecursiveOperationRpcClient implements IRecursiveOperationRpcClient, ServiceInfo {
|
|
142
|
+
typeName = RecursiveOperationRpc.typeName;
|
|
143
|
+
methods = RecursiveOperationRpc.methods;
|
|
144
|
+
options = RecursiveOperationRpc.options;
|
|
146
145
|
constructor(private readonly _transport: RpcTransport) {
|
|
147
146
|
}
|
|
148
147
|
/**
|
|
149
|
-
* @generated from protobuf rpc:
|
|
148
|
+
* @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
|
|
150
149
|
*/
|
|
151
|
-
|
|
150
|
+
routeRequest(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall<RouteMessageWrapper, RouteMessageAck> {
|
|
152
151
|
const method = this.methods[0], opt = this._transport.mergeOptions(options);
|
|
153
152
|
return stackIntercept<RouteMessageWrapper, RouteMessageAck>("unary", this._transport, method, opt, input);
|
|
154
153
|
}
|
|
@@ -191,29 +190,29 @@ export class StoreRpcClient implements IStoreRpcClient, ServiceInfo {
|
|
|
191
190
|
}
|
|
192
191
|
}
|
|
193
192
|
/**
|
|
194
|
-
* @generated from protobuf service dht.
|
|
193
|
+
* @generated from protobuf service dht.RecursiveOperationSessionRpc
|
|
195
194
|
*/
|
|
196
|
-
export interface
|
|
195
|
+
export interface IRecursiveOperationSessionRpcClient {
|
|
197
196
|
/**
|
|
198
|
-
* @generated from protobuf rpc:
|
|
197
|
+
* @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty);
|
|
199
198
|
*/
|
|
200
|
-
|
|
199
|
+
sendResponse(input: RecursiveOperationResponse, options?: RpcOptions): UnaryCall<RecursiveOperationResponse, Empty>;
|
|
201
200
|
}
|
|
202
201
|
/**
|
|
203
|
-
* @generated from protobuf service dht.
|
|
202
|
+
* @generated from protobuf service dht.RecursiveOperationSessionRpc
|
|
204
203
|
*/
|
|
205
|
-
export class
|
|
206
|
-
typeName =
|
|
207
|
-
methods =
|
|
208
|
-
options =
|
|
204
|
+
export class RecursiveOperationSessionRpcClient implements IRecursiveOperationSessionRpcClient, ServiceInfo {
|
|
205
|
+
typeName = RecursiveOperationSessionRpc.typeName;
|
|
206
|
+
methods = RecursiveOperationSessionRpc.methods;
|
|
207
|
+
options = RecursiveOperationSessionRpc.options;
|
|
209
208
|
constructor(private readonly _transport: RpcTransport) {
|
|
210
209
|
}
|
|
211
210
|
/**
|
|
212
|
-
* @generated from protobuf rpc:
|
|
211
|
+
* @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty);
|
|
213
212
|
*/
|
|
214
|
-
|
|
213
|
+
sendResponse(input: RecursiveOperationResponse, options?: RpcOptions): UnaryCall<RecursiveOperationResponse, Empty> {
|
|
215
214
|
const method = this.methods[0], opt = this._transport.mergeOptions(options);
|
|
216
|
-
return stackIntercept<
|
|
215
|
+
return stackIntercept<RecursiveOperationResponse, Empty>("unary", this._transport, method, opt, input);
|
|
217
216
|
}
|
|
218
217
|
}
|
|
219
218
|
/**
|
|
@@ -221,9 +220,9 @@ export class FindSessionRpcClient implements IFindSessionRpcClient, ServiceInfo
|
|
|
221
220
|
*/
|
|
222
221
|
export interface IWebsocketConnectorRpcClient {
|
|
223
222
|
/**
|
|
224
|
-
* @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (
|
|
223
|
+
* @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty);
|
|
225
224
|
*/
|
|
226
|
-
requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall<WebsocketConnectionRequest,
|
|
225
|
+
requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall<WebsocketConnectionRequest, Empty>;
|
|
227
226
|
}
|
|
228
227
|
/**
|
|
229
228
|
* @generated from protobuf service dht.WebsocketConnectorRpc
|
|
@@ -235,11 +234,11 @@ export class WebsocketConnectorRpcClient implements IWebsocketConnectorRpcClient
|
|
|
235
234
|
constructor(private readonly _transport: RpcTransport) {
|
|
236
235
|
}
|
|
237
236
|
/**
|
|
238
|
-
* @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (
|
|
237
|
+
* @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty);
|
|
239
238
|
*/
|
|
240
|
-
requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall<WebsocketConnectionRequest,
|
|
239
|
+
requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall<WebsocketConnectionRequest, Empty> {
|
|
241
240
|
const method = this.methods[0], opt = this._transport.mergeOptions(options);
|
|
242
|
-
return stackIntercept<WebsocketConnectionRequest,
|
|
241
|
+
return stackIntercept<WebsocketConnectionRequest, Empty>("unary", this._transport, method, opt, input);
|
|
243
242
|
}
|
|
244
243
|
}
|
|
245
244
|
/**
|
|
@@ -14,9 +14,8 @@ import { IceCandidate } from "./DhtRpc";
|
|
|
14
14
|
import { RtcAnswer } from "./DhtRpc";
|
|
15
15
|
import { RtcOffer } from "./DhtRpc";
|
|
16
16
|
import { WebrtcConnectionRequest } from "./DhtRpc";
|
|
17
|
-
import { WebsocketConnectionResponse } from "./DhtRpc";
|
|
18
17
|
import { WebsocketConnectionRequest } from "./DhtRpc";
|
|
19
|
-
import {
|
|
18
|
+
import { RecursiveOperationResponse } from "./DhtRpc";
|
|
20
19
|
import { ReplicateDataRequest } from "./DhtRpc";
|
|
21
20
|
import { StoreDataResponse } from "./DhtRpc";
|
|
22
21
|
import { StoreDataRequest } from "./DhtRpc";
|
|
@@ -60,13 +59,13 @@ export interface IRouterRpc<T = ServerCallContext> {
|
|
|
60
59
|
forwardMessage(request: RouteMessageWrapper, context: T): Promise<RouteMessageAck>;
|
|
61
60
|
}
|
|
62
61
|
/**
|
|
63
|
-
* @generated from protobuf service dht.
|
|
62
|
+
* @generated from protobuf service dht.RecursiveOperationRpc
|
|
64
63
|
*/
|
|
65
|
-
export interface
|
|
64
|
+
export interface IRecursiveOperationRpc<T = ServerCallContext> {
|
|
66
65
|
/**
|
|
67
|
-
* @generated from protobuf rpc:
|
|
66
|
+
* @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck);
|
|
68
67
|
*/
|
|
69
|
-
|
|
68
|
+
routeRequest(request: RouteMessageWrapper, context: T): Promise<RouteMessageAck>;
|
|
70
69
|
}
|
|
71
70
|
/**
|
|
72
71
|
* @generated from protobuf service dht.StoreRpc
|
|
@@ -82,22 +81,22 @@ export interface IStoreRpc<T = ServerCallContext> {
|
|
|
82
81
|
replicateData(request: ReplicateDataRequest, context: T): Promise<Empty>;
|
|
83
82
|
}
|
|
84
83
|
/**
|
|
85
|
-
* @generated from protobuf service dht.
|
|
84
|
+
* @generated from protobuf service dht.RecursiveOperationSessionRpc
|
|
86
85
|
*/
|
|
87
|
-
export interface
|
|
86
|
+
export interface IRecursiveOperationSessionRpc<T = ServerCallContext> {
|
|
88
87
|
/**
|
|
89
|
-
* @generated from protobuf rpc:
|
|
88
|
+
* @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty);
|
|
90
89
|
*/
|
|
91
|
-
|
|
90
|
+
sendResponse(request: RecursiveOperationResponse, context: T): Promise<Empty>;
|
|
92
91
|
}
|
|
93
92
|
/**
|
|
94
93
|
* @generated from protobuf service dht.WebsocketConnectorRpc
|
|
95
94
|
*/
|
|
96
95
|
export interface IWebsocketConnectorRpc<T = ServerCallContext> {
|
|
97
96
|
/**
|
|
98
|
-
* @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (
|
|
97
|
+
* @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty);
|
|
99
98
|
*/
|
|
100
|
-
requestConnection(request: WebsocketConnectionRequest, context: T): Promise<
|
|
99
|
+
requestConnection(request: WebsocketConnectionRequest, context: T): Promise<Empty>;
|
|
101
100
|
}
|
|
102
101
|
/**
|
|
103
102
|
* @generated from protobuf service dht.WebrtcConnectorRpc
|