@streamr/trackerless-network 100.0.0 → 100.1.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 +6 -6
- package/dist/src/NetworkNode.js +11 -11
- package/dist/src/NetworkNode.js.map +1 -1
- package/dist/src/NetworkStack.d.ts +4 -4
- package/dist/src/NetworkStack.js +18 -16
- package/dist/src/NetworkStack.js.map +1 -1
- package/dist/src/exports.d.ts +1 -1
- package/dist/src/logic/{StreamrNode.d.ts → ContentDeliveryManager.d.ts} +6 -6
- package/dist/src/logic/{StreamrNode.js → ContentDeliveryManager.js} +7 -9
- package/dist/src/logic/ContentDeliveryManager.js.map +1 -0
- package/dist/src/logic/{DeliveryRpcLocal.d.ts → ContentDeliveryRpcLocal.d.ts} +4 -4
- package/dist/src/logic/{DeliveryRpcLocal.js → ContentDeliveryRpcLocal.js} +4 -4
- package/dist/src/logic/ContentDeliveryRpcLocal.js.map +1 -0
- package/dist/src/logic/{DeliveryRpcRemote.d.ts → ContentDeliveryRpcRemote.d.ts} +2 -2
- package/dist/src/logic/{DeliveryRpcRemote.js → ContentDeliveryRpcRemote.js} +4 -4
- package/dist/src/logic/ContentDeliveryRpcRemote.js.map +1 -0
- package/dist/src/logic/EntryPointDiscovery.js +1 -1
- package/dist/src/logic/EntryPointDiscovery.js.map +1 -1
- package/dist/src/logic/NodeList.d.ts +11 -11
- package/dist/src/logic/NodeList.js.map +1 -1
- package/dist/src/logic/RandomGraphNode.d.ts +1 -1
- package/dist/src/logic/RandomGraphNode.js +12 -12
- package/dist/src/logic/RandomGraphNode.js.map +1 -1
- package/dist/src/logic/createRandomGraphNode.js +1 -1
- package/dist/src/logic/createRandomGraphNode.js.map +1 -1
- package/dist/src/logic/formStreamPartDeliveryServiceId.d.ts +1 -1
- package/dist/src/logic/formStreamPartDeliveryServiceId.js +4 -3
- package/dist/src/logic/formStreamPartDeliveryServiceId.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.d.ts +2 -2
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js +3 -3
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js +2 -2
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/Handshaker.d.ts +1 -1
- 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/NeighborUpdateRpcLocal.js +2 -2
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.js +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.js.map +1 -1
- package/dist/src/logic/protocol-integration/stream-message/StreamMessageTranslator.js +6 -0
- package/dist/src/logic/protocol-integration/stream-message/StreamMessageTranslator.js.map +1 -1
- package/dist/src/logic/proxy/ProxyClient.d.ts +1 -1
- package/dist/src/logic/proxy/ProxyClient.js +8 -8
- package/dist/src/logic/proxy/ProxyClient.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.d.ts +2 -2
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js +3 -3
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcRemote.js +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcRemote.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js +3 -3
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js +2 -2
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js.map +1 -1
- package/dist/src/proto/google/protobuf/any.d.ts +11 -4
- package/dist/src/proto/google/protobuf/any.js.map +1 -1
- package/dist/src/proto/google/protobuf/empty.d.ts +0 -1
- package/dist/src/proto/google/protobuf/empty.js.map +1 -1
- package/dist/src/proto/google/protobuf/timestamp.d.ts +9 -3
- package/dist/src/proto/google/protobuf/timestamp.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +10 -0
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +9 -2
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +44 -0
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +29 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +6 -0
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.d.ts +4 -4
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.js +7 -7
- 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 +9 -5
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js +8 -4
- 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 +2 -2
- package/dist/test/benchmark/first-message.js +4 -4
- package/dist/test/benchmark/first-message.js.map +1 -1
- package/dist/test/utils/utils.d.ts +2 -2
- package/dist/test/utils/utils.js +9 -6
- package/dist/test/utils/utils.js.map +1 -1
- package/karma.config.js +2 -0
- package/package.json +6 -6
- package/protos/NetworkRpc.proto +3 -2
- package/src/NetworkNode.ts +11 -11
- package/src/NetworkStack.ts +23 -18
- package/src/exports.ts +1 -1
- package/src/logic/{StreamrNode.ts → ContentDeliveryManager.ts} +12 -13
- package/src/logic/{DeliveryRpcLocal.ts → ContentDeliveryRpcLocal.ts} +5 -5
- package/src/logic/{DeliveryRpcRemote.ts → ContentDeliveryRpcRemote.ts} +2 -2
- package/src/logic/EntryPointDiscovery.ts +1 -1
- package/src/logic/NodeList.ts +13 -13
- package/src/logic/RandomGraphNode.ts +19 -21
- package/src/logic/createRandomGraphNode.ts +2 -2
- package/src/logic/formStreamPartDeliveryServiceId.ts +2 -1
- package/src/logic/neighbor-discovery/HandshakeRpcLocal.ts +5 -5
- package/src/logic/neighbor-discovery/HandshakeRpcRemote.ts +2 -2
- package/src/logic/neighbor-discovery/Handshaker.ts +10 -11
- package/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts +4 -4
- package/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.ts +1 -1
- package/src/logic/protocol-integration/stream-message/StreamMessageTranslator.ts +16 -10
- package/src/logic/proxy/ProxyClient.ts +11 -11
- package/src/logic/proxy/ProxyConnectionRpcLocal.ts +6 -6
- package/src/logic/proxy/ProxyConnectionRpcRemote.ts +1 -1
- package/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts +5 -5
- package/src/logic/temporary-connection/TemporaryConnectionRpcRemote.ts +2 -2
- package/src/proto/google/protobuf/any.ts +11 -4
- package/src/proto/google/protobuf/empty.ts +0 -1
- package/src/proto/google/protobuf/timestamp.ts +9 -3
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +15 -2
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +6 -0
- package/src/proto/packages/dht/protos/DhtRpc.ts +58 -0
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.client.ts +8 -8
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.server.ts +2 -2
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.ts +10 -6
- package/test/benchmark/first-message.ts +4 -4
- package/test/end-to-end/inspect.test.ts +6 -6
- package/test/end-to-end/proxy-and-full-node.test.ts +19 -19
- package/test/end-to-end/proxy-connections.test.ts +7 -7
- package/test/end-to-end/proxy-key-exchange.test.ts +3 -3
- package/test/end-to-end/webrtc-full-node-network.test.ts +8 -8
- package/test/end-to-end/websocket-full-node-network.test.ts +9 -9
- package/test/integration/ContentDeliveryManager.test.ts +135 -0
- package/test/integration/{DeliveryRpcRemote.test.ts → ContentDeliveryRpcRemote.test.ts} +6 -6
- package/test/integration/Inspect.test.ts +2 -2
- package/test/integration/NetworkRpc.test.ts +3 -3
- package/test/integration/NetworkStack.test.ts +7 -7
- package/test/integration/NodeInfoRpc.test.ts +10 -10
- package/test/integration/joining-streams-on-offline-peers.test.ts +3 -3
- package/test/integration/streamEntryPointReplacing.test.ts +6 -4
- package/test/unit/ContentDeliveryManager.test.ts +96 -0
- package/test/unit/{DeliveryRpcLocal.test.ts → ContentDeliveryRpcLocal.test.ts} +4 -4
- package/test/unit/HandshakeRpcLocal.test.ts +19 -19
- package/test/unit/Handshaker.test.ts +2 -2
- package/test/unit/NeighborFinder.test.ts +2 -2
- package/test/unit/NeighborUpdateRpcLocal.test.ts +8 -8
- package/test/unit/NetworkNode.test.ts +6 -6
- package/test/unit/NodeList.test.ts +6 -6
- package/test/unit/RandomGraphNode.test.ts +3 -3
- package/test/utils/utils.ts +9 -6
- package/dist/src/logic/DeliveryRpcLocal.js.map +0 -1
- package/dist/src/logic/DeliveryRpcRemote.js.map +0 -1
- package/dist/src/logic/StreamrNode.js.map +0 -1
- package/test/integration/StreamrNode.test.ts +0 -131
- package/test/unit/StreamrNode.test.ts +0 -98
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DhtAddress, PeerDescriptor, ListeningRpcCommunicator, getNodeIdFromPeerDescriptor } from '@streamr/dht'
|
|
2
2
|
import { NodeList } from '../NodeList'
|
|
3
|
-
import {
|
|
3
|
+
import { ContentDeliveryRpcRemote } from '../ContentDeliveryRpcRemote'
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
ContentDeliveryRpcClient, HandshakeRpcClient
|
|
6
6
|
} from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
7
7
|
import {
|
|
8
8
|
InterleaveRequest,
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
StreamPartHandshakeResponse
|
|
12
12
|
} from '../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
13
13
|
import { Logger } from '@streamr/utils'
|
|
14
|
-
import { IHandshakeRpc } from '../../proto/packages/trackerless-network/protos/NetworkRpc.server'
|
|
15
14
|
import { HandshakeRpcRemote, INTERLEAVE_REQUEST_TIMEOUT } from './HandshakeRpcRemote'
|
|
16
15
|
import { HandshakeRpcLocal } from './HandshakeRpcLocal'
|
|
17
16
|
import { StreamPartID } from '@streamr/protocol'
|
|
@@ -37,7 +36,7 @@ const PARALLEL_HANDSHAKE_COUNT = 2
|
|
|
37
36
|
export class Handshaker {
|
|
38
37
|
|
|
39
38
|
private config: HandshakerConfig
|
|
40
|
-
private readonly rpcLocal:
|
|
39
|
+
private readonly rpcLocal: HandshakeRpcLocal
|
|
41
40
|
|
|
42
41
|
constructor(config: HandshakerConfig) {
|
|
43
42
|
this.config = config
|
|
@@ -49,7 +48,7 @@ export class Handshaker {
|
|
|
49
48
|
maxNeighborCount: this.config.maxNeighborCount,
|
|
50
49
|
handshakeWithInterleaving: (target: PeerDescriptor, senderId: DhtAddress) => this.handshakeWithInterleaving(target, senderId),
|
|
51
50
|
createRpcRemote: (target: PeerDescriptor) => this.createRpcRemote(target),
|
|
52
|
-
|
|
51
|
+
createContentDeliveryRpcRemote: (target: PeerDescriptor) => this.createContentDeliveryRpcRemote(target)
|
|
53
52
|
})
|
|
54
53
|
this.config.rpcCommunicator.registerRpcMethod(InterleaveRequest, InterleaveResponse, 'interleaveRequest',
|
|
55
54
|
(req: InterleaveRequest, context) => this.rpcLocal.interleaveRequest(req, context), { timeout: INTERLEAVE_REQUEST_TIMEOUT })
|
|
@@ -77,7 +76,7 @@ export class Handshaker {
|
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
private selectParallelTargets(excludedIds: DhtAddress[]): HandshakeRpcRemote[] {
|
|
80
|
-
const neighbors: Map<DhtAddress,
|
|
79
|
+
const neighbors: Map<DhtAddress, ContentDeliveryRpcRemote> = new Map()
|
|
81
80
|
// First add the closest left and then right contacts from the ring if possible.
|
|
82
81
|
const left = this.config.leftNodeView.getFirst([...excludedIds, ...Array.from(neighbors.keys())] as DhtAddress[])
|
|
83
82
|
const right = this.config.rightNodeView.getFirst([...excludedIds, ...Array.from(neighbors.keys())] as DhtAddress[])
|
|
@@ -152,7 +151,7 @@ export class Handshaker {
|
|
|
152
151
|
concurrentNodeId
|
|
153
152
|
)
|
|
154
153
|
if (result.accepted) {
|
|
155
|
-
this.config.neighbors.add(this.
|
|
154
|
+
this.config.neighbors.add(this.createContentDeliveryRpcRemote(neighbor.getPeerDescriptor()))
|
|
156
155
|
}
|
|
157
156
|
if (result.interleaveTargetDescriptor) {
|
|
158
157
|
await this.handshakeWithInterleaving(result.interleaveTargetDescriptor, targetNodeId)
|
|
@@ -172,7 +171,7 @@ export class Handshaker {
|
|
|
172
171
|
interleaveSourceId
|
|
173
172
|
)
|
|
174
173
|
if (result.accepted) {
|
|
175
|
-
this.config.neighbors.add(this.
|
|
174
|
+
this.config.neighbors.add(this.createContentDeliveryRpcRemote(neighbor.getPeerDescriptor()))
|
|
176
175
|
}
|
|
177
176
|
this.config.ongoingHandshakes.delete(targetNodeId)
|
|
178
177
|
return result.accepted
|
|
@@ -188,12 +187,12 @@ export class Handshaker {
|
|
|
188
187
|
)
|
|
189
188
|
}
|
|
190
189
|
|
|
191
|
-
private
|
|
192
|
-
return new
|
|
190
|
+
private createContentDeliveryRpcRemote(targetPeerDescriptor: PeerDescriptor): ContentDeliveryRpcRemote {
|
|
191
|
+
return new ContentDeliveryRpcRemote(
|
|
193
192
|
this.config.localPeerDescriptor,
|
|
194
193
|
targetPeerDescriptor,
|
|
195
194
|
this.config.rpcCommunicator,
|
|
196
|
-
|
|
195
|
+
ContentDeliveryRpcClient,
|
|
197
196
|
this.config.rpcRequestTimeout
|
|
198
197
|
)
|
|
199
198
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ServerCallContext } from '@protobuf-ts/runtime-rpc'
|
|
2
2
|
import { DhtAddress, DhtCallContext, ListeningRpcCommunicator, PeerDescriptor, getNodeIdFromPeerDescriptor } from '@streamr/dht'
|
|
3
3
|
import { NeighborUpdate } from '../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
4
|
-
import {
|
|
4
|
+
import { ContentDeliveryRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
5
5
|
import { INeighborUpdateRpc } from '../../proto/packages/trackerless-network/protos/NetworkRpc.server'
|
|
6
6
|
import { NodeList } from '../NodeList'
|
|
7
|
-
import {
|
|
7
|
+
import { ContentDeliveryRpcRemote } from '../ContentDeliveryRpcRemote'
|
|
8
8
|
import { NeighborFinder } from './NeighborFinder'
|
|
9
9
|
import { StreamPartID } from '@streamr/protocol'
|
|
10
10
|
|
|
@@ -34,11 +34,11 @@ export class NeighborUpdateRpcLocal implements INeighborUpdateRpc {
|
|
|
34
34
|
return nodeId !== ownNodeId && !this.config.neighbors.getIds().includes(nodeId)
|
|
35
35
|
})
|
|
36
36
|
newPeerDescriptors.forEach((peerDescriptor) => this.config.nearbyNodeView.add(
|
|
37
|
-
new
|
|
37
|
+
new ContentDeliveryRpcRemote(
|
|
38
38
|
this.config.localPeerDescriptor,
|
|
39
39
|
peerDescriptor,
|
|
40
40
|
this.config.rpcCommunicator,
|
|
41
|
-
|
|
41
|
+
ContentDeliveryRpcClient
|
|
42
42
|
))
|
|
43
43
|
)
|
|
44
44
|
}
|
|
@@ -26,7 +26,7 @@ export class NeighborUpdateRpcRemote extends RpcRemote<NeighborUpdateRpcClient>
|
|
|
26
26
|
removeMe: response.removeMe
|
|
27
27
|
}
|
|
28
28
|
} catch (err: any) {
|
|
29
|
-
logger.debug(`updateNeighbors to ${getNodeIdFromPeerDescriptor(this.getPeerDescriptor())} failed
|
|
29
|
+
logger.debug(`updateNeighbors to ${getNodeIdFromPeerDescriptor(this.getPeerDescriptor())} failed`, { err })
|
|
30
30
|
return {
|
|
31
31
|
peerDescriptors: [],
|
|
32
32
|
removeMe: true
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
StreamMessage as OldStreamMessage,
|
|
4
|
-
StreamMessageType as OldStreamMessageType,
|
|
5
|
-
MessageRef as OldMessageRef,
|
|
2
|
+
ContentType as OldContentType,
|
|
6
3
|
EncryptedGroupKey as OldEncryptedGroupKey,
|
|
7
|
-
StreamID,
|
|
8
4
|
EncryptionType as OldEncryptionType,
|
|
5
|
+
MessageID as OldMessageID,
|
|
6
|
+
MessageRef as OldMessageRef,
|
|
9
7
|
SignatureType as OldSignatureType,
|
|
10
|
-
|
|
8
|
+
StreamID,
|
|
9
|
+
StreamMessage as OldStreamMessage,
|
|
10
|
+
StreamMessageType as OldStreamMessageType
|
|
11
11
|
} from '@streamr/protocol'
|
|
12
12
|
import {
|
|
13
13
|
ContentType,
|
|
14
|
-
GroupKey,
|
|
15
14
|
EncryptionType,
|
|
15
|
+
GroupKey,
|
|
16
16
|
GroupKeyRequest,
|
|
17
17
|
GroupKeyResponse,
|
|
18
|
+
MessageID,
|
|
18
19
|
MessageRef,
|
|
19
20
|
SignatureType,
|
|
20
|
-
StreamMessage
|
|
21
|
-
MessageID
|
|
21
|
+
StreamMessage
|
|
22
22
|
} from '../../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
23
|
-
import {
|
|
23
|
+
import { binaryToHex, hexToBinary, toEthereumAddress } from '@streamr/utils'
|
|
24
24
|
|
|
25
25
|
const oldToNewEncryptionType = (type: OldEncryptionType): EncryptionType => {
|
|
26
26
|
if (type === OldEncryptionType.AES) {
|
|
@@ -54,6 +54,9 @@ const oldToNewSignatureType = (type: OldSignatureType): SignatureType => {
|
|
|
54
54
|
if (type === OldSignatureType.LEGACY_SECP256K1) {
|
|
55
55
|
return SignatureType.LEGACY_SECP256K1
|
|
56
56
|
}
|
|
57
|
+
if (type === OldSignatureType.ERC_1271) {
|
|
58
|
+
return SignatureType.ERC_1271
|
|
59
|
+
}
|
|
57
60
|
return SignatureType.SECP256K1
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -61,6 +64,9 @@ const newToOldSignatureType = (type: SignatureType): OldSignatureType => {
|
|
|
61
64
|
if (type === SignatureType.LEGACY_SECP256K1) {
|
|
62
65
|
return OldSignatureType.LEGACY_SECP256K1
|
|
63
66
|
}
|
|
67
|
+
if (type === SignatureType.ERC_1271) {
|
|
68
|
+
return OldSignatureType.ERC_1271
|
|
69
|
+
}
|
|
64
70
|
return OldSignatureType.SECP256K1
|
|
65
71
|
|
|
66
72
|
}
|
|
@@ -17,15 +17,15 @@ import {
|
|
|
17
17
|
ProxyDirection,
|
|
18
18
|
StreamMessage
|
|
19
19
|
} from '../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
20
|
-
import {
|
|
20
|
+
import { ContentDeliveryRpcClient, ProxyConnectionRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
21
21
|
import { DuplicateMessageDetector } from '../DuplicateMessageDetector'
|
|
22
22
|
import { NodeList } from '../NodeList'
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
23
|
+
import { ContentDeliveryRpcRemote } from '../ContentDeliveryRpcRemote'
|
|
24
|
+
import { ContentDeliveryRpcLocal } from '../ContentDeliveryRpcLocal'
|
|
25
25
|
import { Propagation } from '../propagation/Propagation'
|
|
26
26
|
import { markAndCheckDuplicate } from '../utils'
|
|
27
27
|
import { ProxyConnectionRpcRemote } from './ProxyConnectionRpcRemote'
|
|
28
|
-
import {
|
|
28
|
+
import { formStreamPartContentDeliveryServiceId } from '../formStreamPartDeliveryServiceId'
|
|
29
29
|
|
|
30
30
|
// TODO use config option or named constant?
|
|
31
31
|
export const retry = async <T>(task: () => Promise<T>, description: string, abortSignal: AbortSignal, delay = 10000): Promise<T> => {
|
|
@@ -74,7 +74,7 @@ const SERVICE_ID = 'system/proxy-client'
|
|
|
74
74
|
export class ProxyClient extends EventEmitter<Events> {
|
|
75
75
|
|
|
76
76
|
private readonly rpcCommunicator: ListeningRpcCommunicator
|
|
77
|
-
private readonly
|
|
77
|
+
private readonly contentDeliveryRpcLocal: ContentDeliveryRpcLocal
|
|
78
78
|
private readonly config: ProxyClientConfig
|
|
79
79
|
private readonly duplicateDetectors: Map<string, DuplicateMessageDetector> = new Map()
|
|
80
80
|
private definition?: ProxyDefinition
|
|
@@ -86,10 +86,10 @@ export class ProxyClient extends EventEmitter<Events> {
|
|
|
86
86
|
constructor(config: ProxyClientConfig) {
|
|
87
87
|
super()
|
|
88
88
|
this.config = config
|
|
89
|
-
this.rpcCommunicator = new ListeningRpcCommunicator(
|
|
89
|
+
this.rpcCommunicator = new ListeningRpcCommunicator(formStreamPartContentDeliveryServiceId(config.streamPartId), config.transport)
|
|
90
90
|
// TODO use config option or named constant?
|
|
91
91
|
this.neighbors = new NodeList(getNodeIdFromPeerDescriptor(this.config.localPeerDescriptor), 1000)
|
|
92
|
-
this.
|
|
92
|
+
this.contentDeliveryRpcLocal = new ContentDeliveryRpcLocal({
|
|
93
93
|
localPeerDescriptor: this.config.localPeerDescriptor,
|
|
94
94
|
streamPartId: this.config.streamPartId,
|
|
95
95
|
markAndCheckDuplicate: (msg: MessageID, prev?: MessageRef) => markAndCheckDuplicate(this.duplicateDetectors, msg, prev),
|
|
@@ -121,9 +121,9 @@ export class ProxyClient extends EventEmitter<Events> {
|
|
|
121
121
|
|
|
122
122
|
private registerDefaultServerMethods(): void {
|
|
123
123
|
this.rpcCommunicator.registerRpcNotification(StreamMessage, 'sendStreamMessage',
|
|
124
|
-
(msg: StreamMessage, context) => this.
|
|
124
|
+
(msg: StreamMessage, context) => this.contentDeliveryRpcLocal.sendStreamMessage(msg, context))
|
|
125
125
|
this.rpcCommunicator.registerRpcNotification(LeaveStreamPartNotice, 'leaveStreamPartNotice',
|
|
126
|
-
(req: LeaveStreamPartNotice, context) => this.
|
|
126
|
+
(req: LeaveStreamPartNotice, context) => this.contentDeliveryRpcLocal.leaveStreamPartNotice(req, context))
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
async setProxies(
|
|
@@ -189,11 +189,11 @@ export class ProxyClient extends EventEmitter<Events> {
|
|
|
189
189
|
if (accepted) {
|
|
190
190
|
this.config.connectionLocker.lockConnection(peerDescriptor, SERVICE_ID)
|
|
191
191
|
this.connections.set(nodeId, { peerDescriptor, direction })
|
|
192
|
-
const remote = new
|
|
192
|
+
const remote = new ContentDeliveryRpcRemote(
|
|
193
193
|
this.config.localPeerDescriptor,
|
|
194
194
|
peerDescriptor,
|
|
195
195
|
this.rpcCommunicator,
|
|
196
|
-
|
|
196
|
+
ContentDeliveryRpcClient
|
|
197
197
|
)
|
|
198
198
|
this.neighbors.add(remote)
|
|
199
199
|
this.propagation.onNeighborJoined(nodeId)
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
StreamMessage
|
|
7
7
|
} from '../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
8
8
|
import { IProxyConnectionRpc } from '../../proto/packages/trackerless-network/protos/NetworkRpc.server'
|
|
9
|
-
import {
|
|
9
|
+
import { ContentDeliveryRpcRemote } from '../ContentDeliveryRpcRemote'
|
|
10
10
|
import { DhtAddress, DhtCallContext, ListeningRpcCommunicator, PeerDescriptor, getNodeIdFromPeerDescriptor } from '@streamr/dht'
|
|
11
|
-
import {
|
|
11
|
+
import { ContentDeliveryRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
12
12
|
import { EventEmitter } from 'eventemitter3'
|
|
13
13
|
import { EthereumAddress, Logger, binaryToHex, toEthereumAddress } from '@streamr/utils'
|
|
14
14
|
import { StreamPartID } from '@streamr/protocol'
|
|
@@ -18,7 +18,7 @@ const logger = new Logger(module)
|
|
|
18
18
|
interface ProxyConnection {
|
|
19
19
|
direction: ProxyDirection // Direction is from the client's point of view
|
|
20
20
|
userId: EthereumAddress
|
|
21
|
-
remote:
|
|
21
|
+
remote: ContentDeliveryRpcRemote
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
interface ProxyConnectionRpcLocalConfig {
|
|
@@ -67,7 +67,7 @@ export class ProxyConnectionRpcLocal extends EventEmitter<Events> implements IPr
|
|
|
67
67
|
const recipientId = msg.body.groupKeyRequest.recipientId
|
|
68
68
|
return this.getNodeIdsForUserId(toEthereumAddress(binaryToHex(recipientId, true)))
|
|
69
69
|
} catch (err) {
|
|
70
|
-
logger.trace(`Could not parse GroupKeyRequest
|
|
70
|
+
logger.trace(`Could not parse GroupKeyRequest`, { err })
|
|
71
71
|
return []
|
|
72
72
|
}
|
|
73
73
|
} else {
|
|
@@ -90,11 +90,11 @@ export class ProxyConnectionRpcLocal extends EventEmitter<Events> implements IPr
|
|
|
90
90
|
this.connections.set(senderId, {
|
|
91
91
|
direction: request.direction,
|
|
92
92
|
userId: toEthereumAddress(binaryToHex(request.userId, true)),
|
|
93
|
-
remote: new
|
|
93
|
+
remote: new ContentDeliveryRpcRemote(
|
|
94
94
|
this.config.localPeerDescriptor,
|
|
95
95
|
senderPeerDescriptor,
|
|
96
96
|
this.config.rpcCommunicator,
|
|
97
|
-
|
|
97
|
+
ContentDeliveryRpcClient
|
|
98
98
|
)
|
|
99
99
|
})
|
|
100
100
|
const response: ProxyConnectionResponse = {
|
|
@@ -19,7 +19,7 @@ export class ProxyConnectionRpcRemote extends RpcRemote<ProxyConnectionRpcClient
|
|
|
19
19
|
const res = await this.getClient().requestConnection(request, options)
|
|
20
20
|
return res.accepted
|
|
21
21
|
} catch (err) {
|
|
22
|
-
logger.debug(`ProxyConnectionRequest failed with error
|
|
22
|
+
logger.debug(`ProxyConnectionRequest failed with error`, { err })
|
|
23
23
|
return false
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
} from '../../proto/packages/trackerless-network/protos/NetworkRpc'
|
|
7
7
|
import { ITemporaryConnectionRpc } from '../../proto/packages/trackerless-network/protos/NetworkRpc.server'
|
|
8
8
|
import { ConnectionLocker, DhtAddress, DhtCallContext, ListeningRpcCommunicator, getNodeIdFromPeerDescriptor } from '@streamr/dht'
|
|
9
|
-
import {
|
|
9
|
+
import { ContentDeliveryRpcClient } from '../../proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
10
10
|
import { NodeList } from '../NodeList'
|
|
11
|
-
import {
|
|
11
|
+
import { ContentDeliveryRpcRemote } from '../ContentDeliveryRpcRemote'
|
|
12
12
|
import { PeerDescriptor } from '../../proto/packages/dht/protos/DhtRpc'
|
|
13
13
|
import { Empty } from '../../proto/google/protobuf/empty'
|
|
14
14
|
import { StreamPartID } from '@streamr/protocol'
|
|
@@ -20,7 +20,7 @@ interface TemporaryConnectionRpcLocalConfig {
|
|
|
20
20
|
connectionLocker: ConnectionLocker
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const LOCK_ID_BASE = 'system/delivery/temporary-connection/'
|
|
23
|
+
const LOCK_ID_BASE = 'system/content-delivery/temporary-connection/'
|
|
24
24
|
|
|
25
25
|
export class TemporaryConnectionRpcLocal implements ITemporaryConnectionRpc {
|
|
26
26
|
|
|
@@ -52,11 +52,11 @@ export class TemporaryConnectionRpcLocal implements ITemporaryConnectionRpc {
|
|
|
52
52
|
context: ServerCallContext
|
|
53
53
|
): Promise<TemporaryConnectionResponse> {
|
|
54
54
|
const sender = (context as DhtCallContext).incomingSourceDescriptor!
|
|
55
|
-
const remote = new
|
|
55
|
+
const remote = new ContentDeliveryRpcRemote(
|
|
56
56
|
this.config.localPeerDescriptor,
|
|
57
57
|
sender,
|
|
58
58
|
this.config.rpcCommunicator,
|
|
59
|
-
|
|
59
|
+
ContentDeliveryRpcClient
|
|
60
60
|
)
|
|
61
61
|
this.temporaryNodes.add(remote)
|
|
62
62
|
this.config.connectionLocker.weakLockConnection(getNodeIdFromPeerDescriptor(sender), this.lockId)
|
|
@@ -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
|
|
14
|
+
logger.debug(`temporaryConnection to ${getNodeIdFromPeerDescriptor(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
|
|
26
|
+
logger.trace(`closeConnection to ${getNodeIdFromPeerDescriptor(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 :=
|
|
94
|
+
* any, err := anypb.New(foo)
|
|
95
|
+
* if err != nil {
|
|
96
|
+
* ...
|
|
97
|
+
* }
|
|
91
98
|
* ...
|
|
92
99
|
* foo := &pb.Foo{}
|
|
93
|
-
* if err :=
|
|
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
|
-
*
|
|
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://
|
|
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 {
|
|
@@ -35,6 +35,8 @@ import type { Empty } from "../../../google/protobuf/empty";
|
|
|
35
35
|
import type { LeaveNotice } from "./DhtRpc";
|
|
36
36
|
import type { PingResponse } from "./DhtRpc";
|
|
37
37
|
import type { PingRequest } from "./DhtRpc";
|
|
38
|
+
import type { ClosestRingPeersResponse } from "./DhtRpc";
|
|
39
|
+
import type { ClosestRingPeersRequest } from "./DhtRpc";
|
|
38
40
|
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
|
|
39
41
|
import type { ClosestPeersResponse } from "./DhtRpc";
|
|
40
42
|
import type { ClosestPeersRequest } from "./DhtRpc";
|
|
@@ -48,6 +50,10 @@ export interface IDhtNodeRpcClient {
|
|
|
48
50
|
* @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse);
|
|
49
51
|
*/
|
|
50
52
|
getClosestPeers(input: ClosestPeersRequest, options?: RpcOptions): UnaryCall<ClosestPeersRequest, ClosestPeersResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* @generated from protobuf rpc: getClosestRingPeers(dht.ClosestRingPeersRequest) returns (dht.ClosestRingPeersResponse);
|
|
55
|
+
*/
|
|
56
|
+
getClosestRingPeers(input: ClosestRingPeersRequest, options?: RpcOptions): UnaryCall<ClosestRingPeersRequest, ClosestRingPeersResponse>;
|
|
51
57
|
/**
|
|
52
58
|
* @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse);
|
|
53
59
|
*/
|
|
@@ -73,18 +79,25 @@ export class DhtNodeRpcClient implements IDhtNodeRpcClient, ServiceInfo {
|
|
|
73
79
|
const method = this.methods[0], opt = this._transport.mergeOptions(options);
|
|
74
80
|
return stackIntercept<ClosestPeersRequest, ClosestPeersResponse>("unary", this._transport, method, opt, input);
|
|
75
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* @generated from protobuf rpc: getClosestRingPeers(dht.ClosestRingPeersRequest) returns (dht.ClosestRingPeersResponse);
|
|
84
|
+
*/
|
|
85
|
+
getClosestRingPeers(input: ClosestRingPeersRequest, options?: RpcOptions): UnaryCall<ClosestRingPeersRequest, ClosestRingPeersResponse> {
|
|
86
|
+
const method = this.methods[1], opt = this._transport.mergeOptions(options);
|
|
87
|
+
return stackIntercept<ClosestRingPeersRequest, ClosestRingPeersResponse>("unary", this._transport, method, opt, input);
|
|
88
|
+
}
|
|
76
89
|
/**
|
|
77
90
|
* @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse);
|
|
78
91
|
*/
|
|
79
92
|
ping(input: PingRequest, options?: RpcOptions): UnaryCall<PingRequest, PingResponse> {
|
|
80
|
-
const method = this.methods[
|
|
93
|
+
const method = this.methods[2], opt = this._transport.mergeOptions(options);
|
|
81
94
|
return stackIntercept<PingRequest, PingResponse>("unary", this._transport, method, opt, input);
|
|
82
95
|
}
|
|
83
96
|
/**
|
|
84
97
|
* @generated from protobuf rpc: leaveNotice(dht.LeaveNotice) returns (google.protobuf.Empty);
|
|
85
98
|
*/
|
|
86
99
|
leaveNotice(input: LeaveNotice, options?: RpcOptions): UnaryCall<LeaveNotice, Empty> {
|
|
87
|
-
const method = this.methods[
|
|
100
|
+
const method = this.methods[3], opt = this._transport.mergeOptions(options);
|
|
88
101
|
return stackIntercept<LeaveNotice, Empty>("unary", this._transport, method, opt, input);
|
|
89
102
|
}
|
|
90
103
|
}
|
|
@@ -24,6 +24,8 @@ import { Empty } from "../../../google/protobuf/empty";
|
|
|
24
24
|
import { LeaveNotice } from "./DhtRpc";
|
|
25
25
|
import { PingResponse } from "./DhtRpc";
|
|
26
26
|
import { PingRequest } from "./DhtRpc";
|
|
27
|
+
import { ClosestRingPeersResponse } from "./DhtRpc";
|
|
28
|
+
import { ClosestRingPeersRequest } from "./DhtRpc";
|
|
27
29
|
import { ClosestPeersResponse } from "./DhtRpc";
|
|
28
30
|
import { ClosestPeersRequest } from "./DhtRpc";
|
|
29
31
|
import { ServerCallContext } from "@protobuf-ts/runtime-rpc";
|
|
@@ -35,6 +37,10 @@ export interface IDhtNodeRpc<T = ServerCallContext> {
|
|
|
35
37
|
* @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse);
|
|
36
38
|
*/
|
|
37
39
|
getClosestPeers(request: ClosestPeersRequest, context: T): Promise<ClosestPeersResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* @generated from protobuf rpc: getClosestRingPeers(dht.ClosestRingPeersRequest) returns (dht.ClosestRingPeersResponse);
|
|
42
|
+
*/
|
|
43
|
+
getClosestRingPeers(request: ClosestRingPeersRequest, context: T): Promise<ClosestRingPeersResponse>;
|
|
38
44
|
/**
|
|
39
45
|
* @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse);
|
|
40
46
|
*/
|
|
@@ -133,6 +133,36 @@ export interface ClosestPeersResponse {
|
|
|
133
133
|
*/
|
|
134
134
|
requestId: string;
|
|
135
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* @generated from protobuf message dht.ClosestRingPeersRequest
|
|
138
|
+
*/
|
|
139
|
+
export interface ClosestRingPeersRequest {
|
|
140
|
+
/**
|
|
141
|
+
* @generated from protobuf field: bytes ringId = 1;
|
|
142
|
+
*/
|
|
143
|
+
ringId: Uint8Array;
|
|
144
|
+
/**
|
|
145
|
+
* @generated from protobuf field: string requestId = 2;
|
|
146
|
+
*/
|
|
147
|
+
requestId: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* @generated from protobuf message dht.ClosestRingPeersResponse
|
|
151
|
+
*/
|
|
152
|
+
export interface ClosestRingPeersResponse {
|
|
153
|
+
/**
|
|
154
|
+
* @generated from protobuf field: repeated dht.PeerDescriptor leftPeers = 1;
|
|
155
|
+
*/
|
|
156
|
+
leftPeers: PeerDescriptor[];
|
|
157
|
+
/**
|
|
158
|
+
* @generated from protobuf field: repeated dht.PeerDescriptor rightPeers = 2;
|
|
159
|
+
*/
|
|
160
|
+
rightPeers: PeerDescriptor[];
|
|
161
|
+
/**
|
|
162
|
+
* @generated from protobuf field: string requestId = 3;
|
|
163
|
+
*/
|
|
164
|
+
requestId: string;
|
|
165
|
+
}
|
|
136
166
|
/**
|
|
137
167
|
* @generated from protobuf message dht.RecursiveOperationRequest
|
|
138
168
|
*/
|
|
@@ -764,6 +794,33 @@ class ClosestPeersResponse$Type extends MessageType<ClosestPeersResponse> {
|
|
|
764
794
|
*/
|
|
765
795
|
export const ClosestPeersResponse = new ClosestPeersResponse$Type();
|
|
766
796
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
797
|
+
class ClosestRingPeersRequest$Type extends MessageType<ClosestRingPeersRequest> {
|
|
798
|
+
constructor() {
|
|
799
|
+
super("dht.ClosestRingPeersRequest", [
|
|
800
|
+
{ no: 1, name: "ringId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
|
801
|
+
{ no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
802
|
+
]);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* @generated MessageType for protobuf message dht.ClosestRingPeersRequest
|
|
807
|
+
*/
|
|
808
|
+
export const ClosestRingPeersRequest = new ClosestRingPeersRequest$Type();
|
|
809
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
810
|
+
class ClosestRingPeersResponse$Type extends MessageType<ClosestRingPeersResponse> {
|
|
811
|
+
constructor() {
|
|
812
|
+
super("dht.ClosestRingPeersResponse", [
|
|
813
|
+
{ no: 1, name: "leftPeers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor },
|
|
814
|
+
{ no: 2, name: "rightPeers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor },
|
|
815
|
+
{ no: 3, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
816
|
+
]);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* @generated MessageType for protobuf message dht.ClosestRingPeersResponse
|
|
821
|
+
*/
|
|
822
|
+
export const ClosestRingPeersResponse = new ClosestRingPeersResponse$Type();
|
|
823
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
767
824
|
class RecursiveOperationRequest$Type extends MessageType<RecursiveOperationRequest> {
|
|
768
825
|
constructor() {
|
|
769
826
|
super("dht.RecursiveOperationRequest", [
|
|
@@ -1107,6 +1164,7 @@ export const ExternalFetchDataResponse = new ExternalFetchDataResponse$Type();
|
|
|
1107
1164
|
*/
|
|
1108
1165
|
export const DhtNodeRpc = new ServiceType("dht.DhtNodeRpc", [
|
|
1109
1166
|
{ name: "getClosestPeers", options: {}, I: ClosestPeersRequest, O: ClosestPeersResponse },
|
|
1167
|
+
{ name: "getClosestRingPeers", options: {}, I: ClosestRingPeersRequest, O: ClosestRingPeersResponse },
|
|
1110
1168
|
{ name: "ping", options: {}, I: PingRequest, O: PingResponse },
|
|
1111
1169
|
{ name: "leaveNotice", options: {}, I: LeaveNotice, O: Empty }
|
|
1112
1170
|
]);
|
|
@@ -20,7 +20,7 @@ import type { ProxyConnectionResponse } from "./NetworkRpc";
|
|
|
20
20
|
import type { ProxyConnectionRequest } from "./NetworkRpc";
|
|
21
21
|
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
|
22
22
|
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
|
|
23
|
-
import {
|
|
23
|
+
import { ContentDeliveryRpc } from "./NetworkRpc";
|
|
24
24
|
import type { LeaveStreamPartNotice } from "./NetworkRpc";
|
|
25
25
|
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
|
|
26
26
|
import type { Empty } from "../../../google/protobuf/empty";
|
|
@@ -28,9 +28,9 @@ import type { StreamMessage } from "./NetworkRpc";
|
|
|
28
28
|
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
29
29
|
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
|
|
30
30
|
/**
|
|
31
|
-
* @generated from protobuf service
|
|
31
|
+
* @generated from protobuf service ContentDeliveryRpc
|
|
32
32
|
*/
|
|
33
|
-
export interface
|
|
33
|
+
export interface IContentDeliveryRpcClient {
|
|
34
34
|
/**
|
|
35
35
|
* @generated from protobuf rpc: sendStreamMessage(StreamMessage) returns (google.protobuf.Empty);
|
|
36
36
|
*/
|
|
@@ -41,12 +41,12 @@ export interface IDeliveryRpcClient {
|
|
|
41
41
|
leaveStreamPartNotice(input: LeaveStreamPartNotice, options?: RpcOptions): UnaryCall<LeaveStreamPartNotice, Empty>;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
* @generated from protobuf service
|
|
44
|
+
* @generated from protobuf service ContentDeliveryRpc
|
|
45
45
|
*/
|
|
46
|
-
export class
|
|
47
|
-
typeName =
|
|
48
|
-
methods =
|
|
49
|
-
options =
|
|
46
|
+
export class ContentDeliveryRpcClient implements IContentDeliveryRpcClient, ServiceInfo {
|
|
47
|
+
typeName = ContentDeliveryRpc.typeName;
|
|
48
|
+
methods = ContentDeliveryRpc.methods;
|
|
49
|
+
options = ContentDeliveryRpc.options;
|
|
50
50
|
constructor(private readonly _transport: RpcTransport) {
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
@@ -18,9 +18,9 @@ import { Empty } from "../../../google/protobuf/empty";
|
|
|
18
18
|
import { StreamMessage } from "./NetworkRpc";
|
|
19
19
|
import { ServerCallContext } from "@protobuf-ts/runtime-rpc";
|
|
20
20
|
/**
|
|
21
|
-
* @generated from protobuf service
|
|
21
|
+
* @generated from protobuf service ContentDeliveryRpc
|
|
22
22
|
*/
|
|
23
|
-
export interface
|
|
23
|
+
export interface IContentDeliveryRpc<T = ServerCallContext> {
|
|
24
24
|
/**
|
|
25
25
|
* @generated from protobuf rpc: sendStreamMessage(StreamMessage) returns (google.protobuf.Empty);
|
|
26
26
|
*/
|