@streamr/trackerless-network 100.0.0-testnet-two.4 → 100.0.0-testnet-three.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/src/NetworkNode.d.ts +2 -1
- package/dist/src/NetworkNode.js +6 -2
- package/dist/src/NetworkNode.js.map +1 -1
- package/dist/src/NetworkStack.d.ts +6 -2
- package/dist/src/NetworkStack.js +21 -1
- package/dist/src/NetworkStack.js.map +1 -1
- package/dist/src/exports.d.ts +1 -0
- package/dist/src/exports.js +4 -1
- package/dist/src/exports.js.map +1 -1
- package/dist/src/logic/DeliveryRpcLocal.js +1 -0
- package/dist/src/logic/DeliveryRpcLocal.js.map +1 -1
- package/dist/src/logic/DuplicateMessageDetector.d.ts +3 -3
- package/dist/src/logic/DuplicateMessageDetector.js +10 -6
- package/dist/src/logic/DuplicateMessageDetector.js.map +1 -1
- package/dist/src/logic/EntryPointDiscovery.js +8 -5
- package/dist/src/logic/EntryPointDiscovery.js.map +1 -1
- package/dist/src/logic/Layer0Node.d.ts +2 -0
- package/dist/src/logic/Layer1Node.d.ts +4 -4
- package/dist/src/logic/NodeList.d.ts +6 -8
- package/dist/src/logic/NodeList.js +10 -12
- package/dist/src/logic/NodeList.js.map +1 -1
- package/dist/src/logic/RandomGraphNode.d.ts +5 -5
- package/dist/src/logic/RandomGraphNode.js +27 -22
- package/dist/src/logic/RandomGraphNode.js.map +1 -1
- package/dist/src/logic/StreamrNode.d.ts +3 -2
- package/dist/src/logic/StreamrNode.js +25 -6
- package/dist/src/logic/StreamrNode.js.map +1 -1
- package/dist/src/logic/createRandomGraphNode.d.ts +2 -2
- package/dist/src/logic/createRandomGraphNode.js +16 -15
- package/dist/src/logic/createRandomGraphNode.js.map +1 -1
- package/dist/src/logic/inspect/InspectSession.js +3 -2
- package/dist/src/logic/inspect/InspectSession.js.map +1 -1
- package/dist/src/logic/inspect/Inspector.d.ts +5 -3
- package/dist/src/logic/inspect/Inspector.js +15 -2
- package/dist/src/logic/inspect/Inspector.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.d.ts +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js +18 -17
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/Handshaker.d.ts +3 -4
- package/dist/src/logic/neighbor-discovery/Handshaker.js +29 -27
- package/dist/src/logic/neighbor-discovery/Handshaker.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborFinder.d.ts +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborFinder.js +4 -2
- package/dist/src/logic/neighbor-discovery/NeighborFinder.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.d.ts +2 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js +8 -4
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.d.ts +4 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js +31 -20
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.js.map +1 -1
- package/dist/src/logic/node-info/NodeInfoClient.d.ts +9 -0
- package/dist/src/logic/node-info/NodeInfoClient.js +19 -0
- package/dist/src/logic/node-info/NodeInfoClient.js.map +1 -0
- package/dist/src/logic/node-info/NodeInfoRpcLocal.d.ts +12 -0
- package/dist/src/logic/node-info/NodeInfoRpcLocal.js +29 -0
- package/dist/src/logic/node-info/NodeInfoRpcLocal.js.map +1 -0
- package/dist/src/logic/node-info/NodeInfoRpcRemote.d.ts +6 -0
- package/dist/src/logic/node-info/NodeInfoRpcRemote.js +11 -0
- package/dist/src/logic/node-info/NodeInfoRpcRemote.js.map +1 -0
- package/dist/src/logic/propagation/FifoMapWithTTL.js +7 -3
- package/dist/src/logic/propagation/FifoMapWithTTL.js.map +1 -1
- package/dist/src/logic/propagation/Propagation.js +3 -0
- package/dist/src/logic/propagation/Propagation.js.map +1 -1
- package/dist/src/logic/propagation/PropagationTaskStore.js +1 -0
- package/dist/src/logic/propagation/PropagationTaskStore.js.map +1 -1
- package/dist/src/logic/protocol-integration/stream-message/GroupKeyRequestTranslator.js +1 -1
- package/dist/src/logic/protocol-integration/stream-message/GroupKeyRequestTranslator.js.map +1 -1
- package/dist/src/logic/protocol-integration/stream-message/GroupKeyResponseTranslator.js +1 -1
- package/dist/src/logic/protocol-integration/stream-message/GroupKeyResponseTranslator.js.map +1 -1
- package/dist/src/logic/protocol-integration/stream-message/StreamMessageTranslator.js +43 -15
- package/dist/src/logic/protocol-integration/stream-message/StreamMessageTranslator.js.map +1 -1
- package/dist/src/logic/protocol-integration/stream-message/oldStreamMessageBinaryUtils.d.ts +3 -0
- package/dist/src/logic/protocol-integration/stream-message/oldStreamMessageBinaryUtils.js +14 -0
- package/dist/src/logic/protocol-integration/stream-message/oldStreamMessageBinaryUtils.js.map +1 -0
- package/dist/src/logic/proxy/ProxyClient.d.ts +1 -1
- package/dist/src/logic/proxy/ProxyClient.js +18 -11
- package/dist/src/logic/proxy/ProxyClient.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js +2 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcRemote.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.d.ts +5 -3
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js +9 -2
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.d.ts +1 -0
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js +11 -0
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js.map +1 -1
- package/dist/src/logic/utils.js.map +1 -1
- package/dist/src/proto/google/protobuf/any.js +8 -8
- package/dist/src/proto/google/protobuf/any.js.map +1 -1
- package/dist/src/proto/google/protobuf/empty.js +2 -4
- package/dist/src/proto/google/protobuf/empty.js.map +1 -1
- package/dist/src/proto/google/protobuf/timestamp.js +10 -10
- package/dist/src/proto/google/protobuf/timestamp.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +4 -5
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +38 -29
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +26 -12
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +12 -16
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +2 -3
- package/dist/src/proto/packages/proto-rpc/protos/ProtoRpc.js +1 -1
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.d.ts +36 -0
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.js +50 -17
- 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 +118 -5
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js +91 -8
- 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 +16 -0
- package/dist/test/benchmark/first-message.js +7 -5
- package/dist/test/benchmark/first-message.js.map +1 -1
- package/dist/test/utils/utils.js +2 -1
- package/dist/test/utils/utils.js.map +1 -1
- package/jest.config.js +3 -38
- package/package.json +7 -7
- package/protos/NetworkRpc.proto +38 -5
- package/src/NetworkNode.ts +5 -1
- package/src/NetworkStack.ts +23 -2
- package/src/exports.ts +4 -0
- package/src/logic/DuplicateMessageDetector.ts +7 -7
- package/src/logic/EntryPointDiscovery.ts +3 -3
- package/src/logic/Layer0Node.ts +2 -0
- package/src/logic/Layer1Node.ts +4 -4
- package/src/logic/NodeList.ts +9 -15
- package/src/logic/RandomGraphNode.ts +27 -23
- package/src/logic/StreamrNode.ts +18 -4
- package/src/logic/createRandomGraphNode.ts +19 -18
- package/src/logic/inspect/Inspector.ts +18 -5
- package/src/logic/neighbor-discovery/HandshakeRpcLocal.ts +18 -18
- package/src/logic/neighbor-discovery/Handshaker.ts +31 -32
- package/src/logic/neighbor-discovery/NeighborFinder.ts +2 -2
- package/src/logic/neighbor-discovery/NeighborUpdateManager.ts +7 -5
- package/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts +39 -27
- package/src/logic/node-info/NodeInfoClient.ts +21 -0
- package/src/logic/node-info/NodeInfoRpcLocal.ts +35 -0
- package/src/logic/node-info/NodeInfoRpcRemote.ts +11 -0
- package/src/logic/protocol-integration/stream-message/GroupKeyRequestTranslator.ts +1 -1
- package/src/logic/protocol-integration/stream-message/GroupKeyResponseTranslator.ts +1 -1
- package/src/logic/protocol-integration/stream-message/StreamMessageTranslator.ts +56 -27
- package/src/logic/protocol-integration/stream-message/oldStreamMessageBinaryUtils.ts +11 -0
- package/src/logic/proxy/ProxyClient.ts +10 -10
- package/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts +15 -4
- package/src/logic/temporary-connection/TemporaryConnectionRpcRemote.ts +11 -0
- package/src/proto/google/protobuf/any.ts +4 -4
- package/src/proto/google/protobuf/empty.ts +2 -4
- package/src/proto/google/protobuf/timestamp.ts +4 -4
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +6 -7
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +3 -4
- package/src/proto/packages/dht/protos/DhtRpc.ts +37 -20
- package/src/proto/packages/proto-rpc/protos/ProtoRpc.ts +1 -1
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.client.ts +42 -1
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.server.ts +17 -1
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.ts +155 -12
- package/test/benchmark/first-message.ts +28 -8
- package/test/end-to-end/inspect.test.ts +13 -1
- package/test/end-to-end/proxy-and-full-node.test.ts +14 -1
- package/test/end-to-end/proxy-connections.test.ts +14 -2
- package/test/end-to-end/proxy-key-exchange.test.ts +15 -8
- package/test/end-to-end/random-graph-with-real-connections.test.ts +21 -21
- package/test/end-to-end/webrtc-full-node-network.test.ts +3 -3
- package/test/end-to-end/websocket-full-node-network.test.ts +3 -3
- package/test/integration/Handshakes.test.ts +8 -8
- package/test/integration/NetworkNode.test.ts +19 -1
- package/test/integration/NetworkRpc.test.ts +3 -2
- package/test/integration/NodeInfoRpc.test.ts +103 -0
- package/test/integration/Propagation.test.ts +2 -2
- package/test/integration/RandomGraphNode-Layer1Node-Latencies.test.ts +20 -21
- package/test/integration/RandomGraphNode-Layer1Node.test.ts +22 -19
- package/test/integration/stream-without-default-entrypoints.test.ts +17 -11
- package/test/unit/HandshakeRpcLocal.test.ts +15 -15
- package/test/unit/Handshaker.test.ts +3 -3
- package/test/unit/NeighborFinder.test.ts +5 -5
- package/test/unit/NeighborUpdateRpcLocal.test.ts +125 -0
- package/test/unit/NodeList.test.ts +56 -57
- package/test/unit/Propagation.test.ts +4 -2
- package/test/unit/RandomGraphNode.test.ts +7 -8
- package/test/unit/StreamMessageTranslator.test.ts +7 -4
- package/test/unit/StreamrNode.test.ts +2 -0
- package/test/unit/TemporaryConnectionRpcLocal.test.ts +32 -0
- package/test/unit/oldStreamMessageBinaryUtils.test.ts +39 -0
- package/test/utils/mock/MockLayer0Node.ts +6 -1
- package/test/utils/mock/MockLayer1Node.ts +2 -2
- package/test/utils/mock/Transport.ts +1 -1
- package/test/utils/utils.ts +3 -1
- package/tsconfig.jest.json +3 -3
- package/tsconfig.node.json +0 -1
- package/dist/package.json +0 -55
|
@@ -10,12 +10,13 @@ import { StreamPartID } from '@streamr/protocol'
|
|
|
10
10
|
|
|
11
11
|
interface NeighborUpdateManagerConfig {
|
|
12
12
|
localPeerDescriptor: PeerDescriptor
|
|
13
|
-
|
|
13
|
+
neighbors: NodeList
|
|
14
14
|
nearbyNodeView: NodeList
|
|
15
15
|
neighborFinder: NeighborFinder
|
|
16
16
|
streamPartId: StreamPartID
|
|
17
17
|
rpcCommunicator: ListeningRpcCommunicator
|
|
18
18
|
neighborUpdateInterval: number
|
|
19
|
+
neighborCount: number
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
const logger = new Logger(module)
|
|
@@ -44,12 +45,13 @@ export class NeighborUpdateManager {
|
|
|
44
45
|
|
|
45
46
|
private async updateNeighborInfo(): Promise<void> {
|
|
46
47
|
logger.trace(`Updating neighbor info to nodes`)
|
|
47
|
-
const neighborDescriptors = this.config.
|
|
48
|
-
await Promise.allSettled(this.config.
|
|
48
|
+
const neighborDescriptors = this.config.neighbors.getAll().map((neighbor) => neighbor.getPeerDescriptor())
|
|
49
|
+
await Promise.allSettled(this.config.neighbors.getAll().map(async (neighbor) => {
|
|
49
50
|
const res = await this.createRemote(neighbor.getPeerDescriptor()).updateNeighbors(this.config.streamPartId, neighborDescriptors)
|
|
50
51
|
if (res.removeMe) {
|
|
51
|
-
|
|
52
|
-
this.config.
|
|
52
|
+
const nodeId = getNodeIdFromPeerDescriptor(neighbor.getPeerDescriptor())
|
|
53
|
+
this.config.neighbors.remove(nodeId)
|
|
54
|
+
this.config.neighborFinder.start([nodeId])
|
|
53
55
|
}
|
|
54
56
|
}))
|
|
55
57
|
}
|
|
@@ -11,10 +11,11 @@ import { StreamPartID } from '@streamr/protocol'
|
|
|
11
11
|
interface NeighborUpdateRpcLocalConfig {
|
|
12
12
|
localPeerDescriptor: PeerDescriptor
|
|
13
13
|
streamPartId: StreamPartID
|
|
14
|
-
|
|
14
|
+
neighbors: NodeList
|
|
15
15
|
nearbyNodeView: NodeList
|
|
16
16
|
neighborFinder: NeighborFinder
|
|
17
17
|
rpcCommunicator: ListeningRpcCommunicator
|
|
18
|
+
neighborCount: number
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export class NeighborUpdateRpcLocal implements INeighborUpdateRpc {
|
|
@@ -25,38 +26,49 @@ export class NeighborUpdateRpcLocal implements INeighborUpdateRpc {
|
|
|
25
26
|
this.config = config
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
private updateContacts(neighborDescriptors: PeerDescriptor[]): void {
|
|
30
|
+
const ownNodeId = getNodeIdFromPeerDescriptor(this.config.localPeerDescriptor)
|
|
31
|
+
const newPeerDescriptors = neighborDescriptors.filter((peerDescriptor) => {
|
|
32
|
+
const nodeId = getNodeIdFromPeerDescriptor(peerDescriptor)
|
|
33
|
+
return nodeId !== ownNodeId && !this.config.neighbors.getIds().includes(nodeId)
|
|
34
|
+
})
|
|
35
|
+
newPeerDescriptors.forEach((peerDescriptor) => this.config.nearbyNodeView.add(
|
|
36
|
+
new DeliveryRpcRemote(
|
|
37
|
+
this.config.localPeerDescriptor,
|
|
38
|
+
peerDescriptor,
|
|
39
|
+
this.config.rpcCommunicator,
|
|
40
|
+
DeliveryRpcClient
|
|
41
|
+
))
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private createResponse(removeMe: boolean): NeighborUpdate {
|
|
46
|
+
return {
|
|
47
|
+
streamPartId: this.config.streamPartId,
|
|
48
|
+
neighborDescriptors: this.config.neighbors.getAll().map((neighbor) => neighbor.getPeerDescriptor()),
|
|
49
|
+
removeMe
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
28
53
|
// INeighborUpdateRpc server method
|
|
29
54
|
async neighborUpdate(message: NeighborUpdate, context: ServerCallContext): Promise<NeighborUpdate> {
|
|
30
55
|
const senderPeerDescriptor = (context as DhtCallContext).incomingSourceDescriptor!
|
|
31
56
|
const senderId = getNodeIdFromPeerDescriptor(senderPeerDescriptor)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const nodeId = getNodeIdFromPeerDescriptor(peerDescriptor)
|
|
36
|
-
return nodeId !== ownNodeId && !this.config.targetNeighbors.getIds().includes(nodeId)
|
|
37
|
-
})
|
|
38
|
-
newPeerDescriptors.forEach((peerDescriptor) => this.config.nearbyNodeView.add(
|
|
39
|
-
new DeliveryRpcRemote(
|
|
40
|
-
this.config.localPeerDescriptor,
|
|
41
|
-
peerDescriptor,
|
|
42
|
-
this.config.rpcCommunicator,
|
|
43
|
-
DeliveryRpcClient
|
|
44
|
-
))
|
|
45
|
-
)
|
|
46
|
-
this.config.neighborFinder.start()
|
|
47
|
-
const response: NeighborUpdate = {
|
|
48
|
-
streamPartId: this.config.streamPartId,
|
|
49
|
-
neighborDescriptors: this.config.targetNeighbors.getAll().map((neighbor) => neighbor.getPeerDescriptor()),
|
|
50
|
-
removeMe: false
|
|
51
|
-
}
|
|
52
|
-
return response
|
|
57
|
+
this.updateContacts(message.neighborDescriptors)
|
|
58
|
+
if (!this.config.neighbors.has(senderId)) {
|
|
59
|
+
return this.createResponse(true)
|
|
53
60
|
} else {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
const isOverNeighborCount = this.config.neighbors.size() > this.config.neighborCount
|
|
62
|
+
// Motivation: We don't know the remote's neighborCount setting here. We only ask to cut connections
|
|
63
|
+
// if the remote has a "sufficient" number of neighbors, where "sufficient" means our neighborCount
|
|
64
|
+
// setting.
|
|
65
|
+
&& message.neighborDescriptors.length > this.config.neighborCount
|
|
66
|
+
if (!isOverNeighborCount) {
|
|
67
|
+
this.config.neighborFinder.start()
|
|
68
|
+
} else {
|
|
69
|
+
this.config.neighbors.remove(senderId)
|
|
58
70
|
}
|
|
59
|
-
return
|
|
71
|
+
return this.createResponse(isOverNeighborCount)
|
|
60
72
|
}
|
|
61
73
|
}
|
|
62
74
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DhtCallContext, PeerDescriptor } from '@streamr/dht'
|
|
2
|
+
import { NodeInfoResponse } from '../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
3
|
+
import { NodeInfoRpcRemote } from './NodeInfoRpcRemote'
|
|
4
|
+
import { RpcCommunicator } from '@streamr/proto-rpc'
|
|
5
|
+
import { NodeInfoRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
6
|
+
|
|
7
|
+
export class NodeInfoClient {
|
|
8
|
+
private readonly ownPeerDescriptor: PeerDescriptor
|
|
9
|
+
private readonly rpcCommunicator: RpcCommunicator<DhtCallContext>
|
|
10
|
+
|
|
11
|
+
constructor(ownPeerDescriptor: PeerDescriptor, rpcCommunicator: RpcCommunicator<DhtCallContext>) {
|
|
12
|
+
this.ownPeerDescriptor = ownPeerDescriptor
|
|
13
|
+
this.rpcCommunicator = rpcCommunicator
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async getInfo(node: PeerDescriptor): Promise<NodeInfoResponse> {
|
|
17
|
+
const remote = new NodeInfoRpcRemote(this.ownPeerDescriptor, node, this.rpcCommunicator, NodeInfoRpcClient)
|
|
18
|
+
return remote.getInfo()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { NodeInfoRequest, NodeInfoResponse } from '../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
2
|
+
import { INodeInfoRpc } from '../../proto/packages/trackerless-network/protos/NetworkRpc.server'
|
|
3
|
+
import { NetworkStack } from '../../NetworkStack'
|
|
4
|
+
import { ListeningRpcCommunicator } from '@streamr/dht'
|
|
5
|
+
|
|
6
|
+
export const NODE_INFO_RPC_SERVICE_ID = 'system/node-info-rpc'
|
|
7
|
+
|
|
8
|
+
export class NodeInfoRpcLocal implements INodeInfoRpc {
|
|
9
|
+
|
|
10
|
+
private readonly stack: NetworkStack
|
|
11
|
+
private readonly rpcCommunicator: ListeningRpcCommunicator
|
|
12
|
+
|
|
13
|
+
constructor(stack: NetworkStack, rpcCommunicator: ListeningRpcCommunicator) {
|
|
14
|
+
this.stack = stack
|
|
15
|
+
this.rpcCommunicator = rpcCommunicator
|
|
16
|
+
this.registerDefaultServerMethods()
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private registerDefaultServerMethods(): void {
|
|
20
|
+
this.rpcCommunicator.registerRpcMethod(NodeInfoRequest, NodeInfoResponse, 'getInfo',
|
|
21
|
+
() => this.getInfo())
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async getInfo(): Promise<NodeInfoResponse> {
|
|
25
|
+
return {
|
|
26
|
+
peerDescriptor: this.stack.getLayer0Node().getLocalPeerDescriptor(),
|
|
27
|
+
controlLayer: {
|
|
28
|
+
connections: this.stack.getLayer0Node().getConnections(),
|
|
29
|
+
neighbors: this.stack.getLayer0Node().getNeighbors()
|
|
30
|
+
},
|
|
31
|
+
streamPartitions: this.stack.getStreamrNode().getNodeInfo()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NodeInfoResponse } from '../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
2
|
+
import { NodeInfoRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
3
|
+
import { RpcRemote } from '@streamr/dht'
|
|
4
|
+
|
|
5
|
+
export class NodeInfoRpcRemote extends RpcRemote<NodeInfoRpcClient> {
|
|
6
|
+
|
|
7
|
+
async getInfo(): Promise<NodeInfoResponse> {
|
|
8
|
+
return this.getClient().getInfo({}, this.formDhtRpcOptions())
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
}
|
|
@@ -10,7 +10,7 @@ export class GroupKeyRequestTranslator {
|
|
|
10
10
|
recipientId: hexToBinary(msg.recipient),
|
|
11
11
|
requestId: msg.requestId,
|
|
12
12
|
rsaPublicKey: utf8ToBinary(msg.rsaPublicKey),
|
|
13
|
-
groupKeyIds: msg.groupKeyIds
|
|
13
|
+
groupKeyIds: [...msg.groupKeyIds]
|
|
14
14
|
}
|
|
15
15
|
return translated
|
|
16
16
|
}
|
|
@@ -4,11 +4,14 @@ import {
|
|
|
4
4
|
StreamMessageType as OldStreamMessageType,
|
|
5
5
|
MessageRef as OldMessageRef,
|
|
6
6
|
EncryptedGroupKey as OldEncryptedGroupKey,
|
|
7
|
-
GroupKeyRequest as OldGroupKeyRequest,
|
|
8
|
-
GroupKeyResponse as OldGroupKeyResponse,
|
|
9
7
|
StreamID,
|
|
10
8
|
EncryptionType as OldEncryptionType,
|
|
11
|
-
|
|
9
|
+
SignatureType as OldSignatureType,
|
|
10
|
+
ContentType as OldContentType,
|
|
11
|
+
serializeGroupKeyRequest as serializeOldGroupKeyRequest,
|
|
12
|
+
serializeGroupKeyResponse as serializeOldGroupKeyResponse,
|
|
13
|
+
deserializeGroupKeyRequest as deserializeOldGroupKeyRequest,
|
|
14
|
+
deserializeGroupKeyResponse as deserializeOldGroupKeyResponse
|
|
12
15
|
} from '@streamr/protocol'
|
|
13
16
|
import {
|
|
14
17
|
ContentType,
|
|
@@ -17,11 +20,12 @@ import {
|
|
|
17
20
|
GroupKeyRequest,
|
|
18
21
|
GroupKeyResponse,
|
|
19
22
|
MessageRef,
|
|
23
|
+
SignatureType,
|
|
20
24
|
StreamMessage,
|
|
21
25
|
StreamMessageType,
|
|
22
26
|
MessageID
|
|
23
27
|
} from '../../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
24
|
-
import { toEthereumAddress, binaryToHex,
|
|
28
|
+
import { toEthereumAddress, binaryToHex, hexToBinary } from '@streamr/utils'
|
|
25
29
|
import { GroupKeyRequestTranslator } from './GroupKeyRequestTranslator'
|
|
26
30
|
import { GroupKeyResponseTranslator } from './GroupKeyResponseTranslator'
|
|
27
31
|
|
|
@@ -39,6 +43,35 @@ const newToOldEncryptionType = (type: EncryptionType): OldEncryptionType => {
|
|
|
39
43
|
return OldEncryptionType.NONE
|
|
40
44
|
}
|
|
41
45
|
|
|
46
|
+
const oldToNewContentType = (type: OldContentType): ContentType => {
|
|
47
|
+
if (type === OldContentType.JSON) {
|
|
48
|
+
return ContentType.JSON
|
|
49
|
+
}
|
|
50
|
+
return ContentType.BINARY
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const newToOldContentType = (type: ContentType): OldContentType => {
|
|
54
|
+
if (type === ContentType.JSON) {
|
|
55
|
+
return OldContentType.JSON
|
|
56
|
+
}
|
|
57
|
+
return OldContentType.BINARY
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const oldToNewSignatureType = (type: OldSignatureType): SignatureType => {
|
|
61
|
+
if (type === OldSignatureType.LEGACY_SECP256K1) {
|
|
62
|
+
return SignatureType.LEGACY_SECP256K1
|
|
63
|
+
}
|
|
64
|
+
return SignatureType.SECP256K1
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const newToOldSignatureType = (type: SignatureType): OldSignatureType => {
|
|
68
|
+
if (type === SignatureType.LEGACY_SECP256K1) {
|
|
69
|
+
return OldSignatureType.LEGACY_SECP256K1
|
|
70
|
+
}
|
|
71
|
+
return OldSignatureType.SECP256K1
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
42
75
|
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
43
76
|
export class StreamMessageTranslator {
|
|
44
77
|
|
|
@@ -46,24 +79,16 @@ export class StreamMessageTranslator {
|
|
|
46
79
|
let content: Uint8Array
|
|
47
80
|
let messageType: StreamMessageType
|
|
48
81
|
if (msg.messageType === OldStreamMessageType.MESSAGE) {
|
|
49
|
-
content = msg.
|
|
82
|
+
content = msg.content
|
|
50
83
|
messageType = StreamMessageType.MESSAGE
|
|
51
84
|
} else if (msg.messageType === OldStreamMessageType.GROUP_KEY_REQUEST) {
|
|
52
85
|
content = GroupKeyRequest.toBinary(
|
|
53
|
-
GroupKeyRequestTranslator.toProtobuf(
|
|
54
|
-
OldGroupKeyRequest.deserialize(
|
|
55
|
-
binaryToUtf8(msg.serializedContent),
|
|
56
|
-
OldStreamMessageType.GROUP_KEY_REQUEST) as OldGroupKeyRequest
|
|
57
|
-
)
|
|
86
|
+
GroupKeyRequestTranslator.toProtobuf(deserializeOldGroupKeyRequest(msg.content))
|
|
58
87
|
)
|
|
59
88
|
messageType = StreamMessageType.GROUP_KEY_REQUEST
|
|
60
89
|
} else if (msg.messageType === OldStreamMessageType.GROUP_KEY_RESPONSE) {
|
|
61
90
|
content = GroupKeyResponse.toBinary(
|
|
62
|
-
GroupKeyResponseTranslator.toProtobuf(
|
|
63
|
-
OldGroupKeyResponse.deserialize(
|
|
64
|
-
binaryToUtf8(msg.serializedContent),
|
|
65
|
-
OldStreamMessageType.GROUP_KEY_RESPONSE) as OldGroupKeyResponse
|
|
66
|
-
)
|
|
91
|
+
GroupKeyResponseTranslator.toProtobuf(deserializeOldGroupKeyResponse(msg.content))
|
|
67
92
|
)
|
|
68
93
|
messageType = StreamMessageType.GROUP_KEY_RESPONSE
|
|
69
94
|
} else {
|
|
@@ -78,17 +103,17 @@ export class StreamMessageTranslator {
|
|
|
78
103
|
messageChainId: msg.getMsgChainId()
|
|
79
104
|
}
|
|
80
105
|
let previousMessageRef: MessageRef | undefined = undefined
|
|
81
|
-
if (msg.
|
|
106
|
+
if (msg.prevMsgRef) {
|
|
82
107
|
previousMessageRef = {
|
|
83
|
-
timestamp: msg.
|
|
84
|
-
sequenceNumber: msg.
|
|
108
|
+
timestamp: msg.prevMsgRef.timestamp,
|
|
109
|
+
sequenceNumber: msg.prevMsgRef.sequenceNumber,
|
|
85
110
|
}
|
|
86
111
|
}
|
|
87
112
|
let newGroupKey: GroupKey | undefined = undefined
|
|
88
|
-
if (msg.
|
|
113
|
+
if (msg.newGroupKey) {
|
|
89
114
|
newGroupKey = {
|
|
90
|
-
id: msg.
|
|
91
|
-
data: msg.
|
|
115
|
+
id: msg.newGroupKey.id,
|
|
116
|
+
data: msg.newGroupKey.data
|
|
92
117
|
}
|
|
93
118
|
}
|
|
94
119
|
const translated: StreamMessage = {
|
|
@@ -96,11 +121,12 @@ export class StreamMessageTranslator {
|
|
|
96
121
|
previousMessageRef,
|
|
97
122
|
content,
|
|
98
123
|
messageType,
|
|
99
|
-
contentType:
|
|
124
|
+
contentType: oldToNewContentType(msg.contentType),
|
|
100
125
|
encryptionType: oldToNewEncryptionType(msg.encryptionType),
|
|
101
126
|
groupKeyId: msg.groupKeyId ?? undefined,
|
|
102
127
|
newGroupKey,
|
|
103
|
-
signature: msg.signature
|
|
128
|
+
signature: msg.signature,
|
|
129
|
+
signatureType: oldToNewSignatureType(msg.signatureType),
|
|
104
130
|
}
|
|
105
131
|
return translated
|
|
106
132
|
}
|
|
@@ -115,7 +141,8 @@ export class StreamMessageTranslator {
|
|
|
115
141
|
messageType = OldStreamMessageType.GROUP_KEY_REQUEST
|
|
116
142
|
try {
|
|
117
143
|
const parsedRequest = GroupKeyRequest.fromBinary(msg.content)
|
|
118
|
-
|
|
144
|
+
const oldGroupKeyRequest = GroupKeyRequestTranslator.toClientProtocol(parsedRequest)
|
|
145
|
+
content = serializeOldGroupKeyRequest(oldGroupKeyRequest)
|
|
119
146
|
} catch (err) {
|
|
120
147
|
throw new Error(`invalid group key request: ${err}`)
|
|
121
148
|
}
|
|
@@ -123,7 +150,8 @@ export class StreamMessageTranslator {
|
|
|
123
150
|
messageType = OldStreamMessageType.GROUP_KEY_RESPONSE
|
|
124
151
|
try {
|
|
125
152
|
const parsedResponse = GroupKeyResponse.fromBinary(msg.content)
|
|
126
|
-
|
|
153
|
+
const oldGroupKeyResponse = GroupKeyResponseTranslator.toClientProtocol(parsedResponse)
|
|
154
|
+
content = serializeOldGroupKeyResponse(oldGroupKeyResponse)
|
|
127
155
|
} catch (err) {
|
|
128
156
|
throw new Error(`invalid group key response: ${err}`)
|
|
129
157
|
}
|
|
@@ -154,11 +182,12 @@ export class StreamMessageTranslator {
|
|
|
154
182
|
prevMsgRef,
|
|
155
183
|
content,
|
|
156
184
|
messageType,
|
|
157
|
-
contentType:
|
|
185
|
+
contentType: newToOldContentType(msg.contentType),
|
|
158
186
|
encryptionType: newToOldEncryptionType(msg.encryptionType),
|
|
159
187
|
groupKeyId: msg.groupKeyId,
|
|
160
188
|
newGroupKey,
|
|
161
|
-
signature: msg.signature
|
|
189
|
+
signature: msg.signature,
|
|
190
|
+
signatureType: newToOldSignatureType(msg.signatureType)
|
|
162
191
|
})
|
|
163
192
|
return translated
|
|
164
193
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StreamMessage as OldStreamMessage } from '@streamr/protocol'
|
|
2
|
+
import { StreamMessageTranslator } from './StreamMessageTranslator'
|
|
3
|
+
import { StreamMessage } from '../../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
4
|
+
|
|
5
|
+
export function convertStreamMessageToBytes(oldStreamMessage: OldStreamMessage): Uint8Array {
|
|
6
|
+
return StreamMessage.toBinary(StreamMessageTranslator.toProtobuf(oldStreamMessage))
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function convertBytesToStreamMessage(bytes: Uint8Array): OldStreamMessage {
|
|
10
|
+
return StreamMessageTranslator.toClientProtocol(StreamMessage.fromBinary(bytes))
|
|
11
|
+
}
|
|
@@ -75,7 +75,7 @@ export class ProxyClient extends EventEmitter<Events> {
|
|
|
75
75
|
private definition?: ProxyDefinition
|
|
76
76
|
private readonly connections: Map<DhtAddress, ProxyDirection> = new Map()
|
|
77
77
|
private readonly propagation: Propagation
|
|
78
|
-
private readonly
|
|
78
|
+
private readonly neighbors: NodeList
|
|
79
79
|
private readonly abortController: AbortController
|
|
80
80
|
|
|
81
81
|
constructor(config: ProxyClientConfig) {
|
|
@@ -83,14 +83,14 @@ export class ProxyClient extends EventEmitter<Events> {
|
|
|
83
83
|
this.config = config
|
|
84
84
|
this.rpcCommunicator = new ListeningRpcCommunicator(formStreamPartDeliveryServiceId(config.streamPartId), config.transport)
|
|
85
85
|
// TODO use config option or named constant?
|
|
86
|
-
this.
|
|
86
|
+
this.neighbors = new NodeList(getNodeIdFromPeerDescriptor(this.config.localPeerDescriptor), 1000)
|
|
87
87
|
this.deliveryRpcLocal = new DeliveryRpcLocal({
|
|
88
88
|
localPeerDescriptor: this.config.localPeerDescriptor,
|
|
89
89
|
streamPartId: this.config.streamPartId,
|
|
90
90
|
markAndCheckDuplicate: (msg: MessageID, prev?: MessageRef) => markAndCheckDuplicate(this.duplicateDetectors, msg, prev),
|
|
91
91
|
broadcast: (message: StreamMessage, previousNode?: DhtAddress) => this.broadcast(message, previousNode),
|
|
92
92
|
onLeaveNotice: (senderId: DhtAddress) => {
|
|
93
|
-
const contact = this.
|
|
93
|
+
const contact = this.neighbors.get(senderId)
|
|
94
94
|
if (contact) {
|
|
95
95
|
// TODO should we catch possible promise rejection?
|
|
96
96
|
setImmediate(() => this.onNodeDisconnected(contact.getPeerDescriptor()))
|
|
@@ -103,7 +103,7 @@ export class ProxyClient extends EventEmitter<Events> {
|
|
|
103
103
|
// TODO use config option or named constant?
|
|
104
104
|
minPropagationTargets: config.minPropagationTargets ?? 2,
|
|
105
105
|
sendToNeighbor: async (neighborId: DhtAddress, msg: StreamMessage): Promise<void> => {
|
|
106
|
-
const remote = this.
|
|
106
|
+
const remote = this.neighbors.get(neighborId)
|
|
107
107
|
if (remote) {
|
|
108
108
|
await remote.sendStreamMessage(msg)
|
|
109
109
|
} else {
|
|
@@ -190,7 +190,7 @@ export class ProxyClient extends EventEmitter<Events> {
|
|
|
190
190
|
this.rpcCommunicator,
|
|
191
191
|
DeliveryRpcClient
|
|
192
192
|
)
|
|
193
|
-
this.
|
|
193
|
+
this.neighbors.add(remote)
|
|
194
194
|
this.propagation.onNeighborJoined(nodeId)
|
|
195
195
|
logger.info('Open proxy connection', {
|
|
196
196
|
nodeId,
|
|
@@ -214,7 +214,7 @@ export class ProxyClient extends EventEmitter<Events> {
|
|
|
214
214
|
logger.info('Close proxy connection', {
|
|
215
215
|
nodeId
|
|
216
216
|
})
|
|
217
|
-
const server = this.
|
|
217
|
+
const server = this.neighbors.get(nodeId)
|
|
218
218
|
server?.leaveStreamPartNotice(this.config.streamPartId, false)
|
|
219
219
|
this.removeConnection(nodeId)
|
|
220
220
|
}
|
|
@@ -222,7 +222,7 @@ export class ProxyClient extends EventEmitter<Events> {
|
|
|
222
222
|
|
|
223
223
|
private removeConnection(nodeId: DhtAddress): void {
|
|
224
224
|
this.connections.delete(nodeId)
|
|
225
|
-
this.
|
|
225
|
+
this.neighbors.remove(nodeId)
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
broadcast(msg: StreamMessage, previousNode?: DhtAddress): void {
|
|
@@ -230,7 +230,7 @@ export class ProxyClient extends EventEmitter<Events> {
|
|
|
230
230
|
markAndCheckDuplicate(this.duplicateDetectors, msg.messageId!, msg.previousMessageRef)
|
|
231
231
|
}
|
|
232
232
|
this.emit('message', msg)
|
|
233
|
-
this.propagation.feedUnseenMessage(msg, this.
|
|
233
|
+
this.propagation.feedUnseenMessage(msg, this.neighbors.getIds(), previousNode ?? null)
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
hasConnection(nodeId: DhtAddress, direction: ProxyDirection): boolean {
|
|
@@ -262,11 +262,11 @@ export class ProxyClient extends EventEmitter<Events> {
|
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
stop(): void {
|
|
265
|
-
this.
|
|
265
|
+
this.neighbors.getAll().forEach((remote) => {
|
|
266
266
|
this.config.connectionLocker.unlockConnection(remote.getPeerDescriptor(), SERVICE_ID)
|
|
267
267
|
remote.leaveStreamPartNotice(this.config.streamPartId, false)
|
|
268
268
|
})
|
|
269
|
-
this.
|
|
269
|
+
this.neighbors.stop()
|
|
270
270
|
this.rpcCommunicator.destroy()
|
|
271
271
|
this.connections.clear()
|
|
272
272
|
this.abortController.abort()
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { ServerCallContext } from '@protobuf-ts/runtime-rpc'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
CloseTemporaryConnection,
|
|
4
|
+
TemporaryConnectionRequest,
|
|
5
|
+
TemporaryConnectionResponse
|
|
6
|
+
} from '../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
3
7
|
import { ITemporaryConnectionRpc } from '../../proto/packages/trackerless-network/protos/NetworkRpc.server'
|
|
4
|
-
import { DhtCallContext, ListeningRpcCommunicator, getNodeIdFromPeerDescriptor } from '@streamr/dht'
|
|
8
|
+
import { DhtAddress, DhtCallContext, ListeningRpcCommunicator, getNodeIdFromPeerDescriptor } from '@streamr/dht'
|
|
5
9
|
import { DeliveryRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
6
10
|
import { NodeList } from '../NodeList'
|
|
7
11
|
import { DeliveryRpcRemote } from '../DeliveryRpcRemote'
|
|
8
12
|
import { PeerDescriptor } from '../../proto/packages/dht/protos/DhtRpc'
|
|
13
|
+
import { Empty } from '../../proto/google/protobuf/empty'
|
|
9
14
|
|
|
10
15
|
interface TemporaryConnectionRpcLocalConfig {
|
|
11
16
|
rpcCommunicator: ListeningRpcCommunicator
|
|
@@ -27,8 +32,8 @@ export class TemporaryConnectionRpcLocal implements ITemporaryConnectionRpc {
|
|
|
27
32
|
return this.temporaryNodes
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
removeNode(
|
|
31
|
-
this.temporaryNodes.remove(
|
|
35
|
+
removeNode(nodeId: DhtAddress): void {
|
|
36
|
+
this.temporaryNodes.remove(nodeId)
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
async openConnection(
|
|
@@ -47,4 +52,10 @@ export class TemporaryConnectionRpcLocal implements ITemporaryConnectionRpc {
|
|
|
47
52
|
accepted: true
|
|
48
53
|
}
|
|
49
54
|
}
|
|
55
|
+
|
|
56
|
+
async closeConnection(_request: CloseTemporaryConnection, context: ServerCallContext): Promise<Empty> {
|
|
57
|
+
const senderId = getNodeIdFromPeerDescriptor((context as DhtCallContext).incomingSourceDescriptor!)
|
|
58
|
+
this.removeNode(senderId)
|
|
59
|
+
return {}
|
|
60
|
+
}
|
|
50
61
|
}
|
|
@@ -15,4 +15,15 @@ export class TemporaryConnectionRpcRemote extends RpcRemote<TemporaryConnectionR
|
|
|
15
15
|
return false
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
async closeConnection(): Promise<void> {
|
|
20
|
+
try {
|
|
21
|
+
await this.getClient().closeConnection({}, this.formDhtRpcOptions({
|
|
22
|
+
connect: false,
|
|
23
|
+
notification: true
|
|
24
|
+
}))
|
|
25
|
+
} catch (err) {
|
|
26
|
+
logger.trace(`closeConnection to ${getNodeIdFromPeerDescriptor(this.getPeerDescriptor())} failed: ${err}`)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
18
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protobuf-ts 2.9.
|
|
1
|
+
// @generated by protobuf-ts 2.9.3 with parameter server_generic,generate_dependencies,long_type_number
|
|
2
2
|
// @generated from protobuf file "google/protobuf/any.proto" (package "google.protobuf", syntax proto3)
|
|
3
3
|
// tslint:disable
|
|
4
4
|
//
|
|
@@ -39,7 +39,6 @@ import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
|
39
39
|
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
40
40
|
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
41
41
|
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
42
|
-
import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
|
|
43
42
|
import { isJsonObject } from "@protobuf-ts/runtime";
|
|
44
43
|
import { typeofJsonValue } from "@protobuf-ts/runtime";
|
|
45
44
|
import type { JsonValue } from "@protobuf-ts/runtime";
|
|
@@ -272,8 +271,9 @@ class Any$Type extends MessageType<Any> {
|
|
|
272
271
|
return name;
|
|
273
272
|
}
|
|
274
273
|
create(value?: PartialMessage<Any>): Any {
|
|
275
|
-
const message =
|
|
276
|
-
|
|
274
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
275
|
+
message.typeUrl = "";
|
|
276
|
+
message.value = new Uint8Array(0);
|
|
277
277
|
if (value !== undefined)
|
|
278
278
|
reflectionMergePartial<Any>(this, message, value);
|
|
279
279
|
return message;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protobuf-ts 2.9.
|
|
1
|
+
// @generated by protobuf-ts 2.9.3 with parameter server_generic,generate_dependencies,long_type_number
|
|
2
2
|
// @generated from protobuf file "google/protobuf/empty.proto" (package "google.protobuf", syntax proto3)
|
|
3
3
|
// tslint:disable
|
|
4
4
|
//
|
|
@@ -39,7 +39,6 @@ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
|
|
39
39
|
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
40
40
|
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
41
41
|
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
42
|
-
import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
|
|
43
42
|
import { MessageType } from "@protobuf-ts/runtime";
|
|
44
43
|
/**
|
|
45
44
|
* A generic empty message that you can re-use to avoid defining duplicated
|
|
@@ -62,8 +61,7 @@ class Empty$Type extends MessageType<Empty> {
|
|
|
62
61
|
super("google.protobuf.Empty", []);
|
|
63
62
|
}
|
|
64
63
|
create(value?: PartialMessage<Empty>): Empty {
|
|
65
|
-
const message =
|
|
66
|
-
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
|
64
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
67
65
|
if (value !== undefined)
|
|
68
66
|
reflectionMergePartial<Empty>(this, message, value);
|
|
69
67
|
return message;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protobuf-ts 2.9.
|
|
1
|
+
// @generated by protobuf-ts 2.9.3 with parameter server_generic,generate_dependencies,long_type_number
|
|
2
2
|
// @generated from protobuf file "google/protobuf/timestamp.proto" (package "google.protobuf", syntax proto3)
|
|
3
3
|
// tslint:disable
|
|
4
4
|
//
|
|
@@ -40,7 +40,6 @@ import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
|
40
40
|
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
41
41
|
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
42
42
|
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
43
|
-
import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
|
|
44
43
|
import { typeofJsonValue } from "@protobuf-ts/runtime";
|
|
45
44
|
import type { JsonValue } from "@protobuf-ts/runtime";
|
|
46
45
|
import type { JsonReadOptions } from "@protobuf-ts/runtime";
|
|
@@ -234,8 +233,9 @@ class Timestamp$Type extends MessageType<Timestamp> {
|
|
|
234
233
|
return target;
|
|
235
234
|
}
|
|
236
235
|
create(value?: PartialMessage<Timestamp>): Timestamp {
|
|
237
|
-
const message =
|
|
238
|
-
|
|
236
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
237
|
+
message.seconds = 0;
|
|
238
|
+
message.nanos = 0;
|
|
239
239
|
if (value !== undefined)
|
|
240
240
|
reflectionMergePartial<Timestamp>(this, message, value);
|
|
241
241
|
return message;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protobuf-ts 2.9.
|
|
1
|
+
// @generated by protobuf-ts 2.9.3 with parameter server_generic,generate_dependencies,long_type_number
|
|
2
2
|
// @generated from protobuf file "packages/dht/protos/DhtRpc.proto" (package "dht", syntax proto3)
|
|
3
3
|
// tslint:disable
|
|
4
4
|
import { ExternalApiRpc } from "./DhtRpc";
|
|
@@ -7,7 +7,6 @@ import type { ExternalStoreDataRequest } from "./DhtRpc";
|
|
|
7
7
|
import type { ExternalFindDataResponse } from "./DhtRpc";
|
|
8
8
|
import type { ExternalFindDataRequest } from "./DhtRpc";
|
|
9
9
|
import { ConnectionLockRpc } from "./DhtRpc";
|
|
10
|
-
import type { DisconnectNoticeResponse } from "./DhtRpc";
|
|
11
10
|
import type { DisconnectNotice } from "./DhtRpc";
|
|
12
11
|
import type { UnlockRequest } from "./DhtRpc";
|
|
13
12
|
import type { LockResponse } from "./DhtRpc";
|
|
@@ -313,9 +312,9 @@ export interface IConnectionLockRpcClient {
|
|
|
313
312
|
*/
|
|
314
313
|
unlockRequest(input: UnlockRequest, options?: RpcOptions): UnaryCall<UnlockRequest, Empty>;
|
|
315
314
|
/**
|
|
316
|
-
* @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (
|
|
315
|
+
* @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (google.protobuf.Empty);
|
|
317
316
|
*/
|
|
318
|
-
gracefulDisconnect(input: DisconnectNotice, options?: RpcOptions): UnaryCall<DisconnectNotice,
|
|
317
|
+
gracefulDisconnect(input: DisconnectNotice, options?: RpcOptions): UnaryCall<DisconnectNotice, Empty>;
|
|
319
318
|
}
|
|
320
319
|
/**
|
|
321
320
|
* @generated from protobuf service dht.ConnectionLockRpc
|
|
@@ -341,11 +340,11 @@ export class ConnectionLockRpcClient implements IConnectionLockRpcClient, Servic
|
|
|
341
340
|
return stackIntercept<UnlockRequest, Empty>("unary", this._transport, method, opt, input);
|
|
342
341
|
}
|
|
343
342
|
/**
|
|
344
|
-
* @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (
|
|
343
|
+
* @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (google.protobuf.Empty);
|
|
345
344
|
*/
|
|
346
|
-
gracefulDisconnect(input: DisconnectNotice, options?: RpcOptions): UnaryCall<DisconnectNotice,
|
|
345
|
+
gracefulDisconnect(input: DisconnectNotice, options?: RpcOptions): UnaryCall<DisconnectNotice, Empty> {
|
|
347
346
|
const method = this.methods[2], opt = this._transport.mergeOptions(options);
|
|
348
|
-
return stackIntercept<DisconnectNotice,
|
|
347
|
+
return stackIntercept<DisconnectNotice, Empty>("unary", this._transport, method, opt, input);
|
|
349
348
|
}
|
|
350
349
|
}
|
|
351
350
|
/**
|