@streamr/trackerless-network 101.1.1 → 102.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +7 -7
- package/dist/src/NetworkNode.d.ts +6 -6
- package/dist/src/NetworkNode.js +5 -3
- package/dist/src/NetworkNode.js.map +1 -1
- package/dist/src/NetworkStack.js +3 -2
- package/dist/src/NetworkStack.js.map +1 -1
- package/dist/src/logic/ContentDeliveryLayerNode.d.ts +4 -1
- package/dist/src/logic/ContentDeliveryLayerNode.js +25 -5
- package/dist/src/logic/ContentDeliveryLayerNode.js.map +1 -1
- package/dist/src/logic/ContentDeliveryManager.d.ts +6 -2
- package/dist/src/logic/ContentDeliveryManager.js +26 -6
- package/dist/src/logic/ContentDeliveryManager.js.map +1 -1
- package/dist/src/logic/ContentDeliveryRpcLocal.js +2 -2
- package/dist/src/logic/ContentDeliveryRpcLocal.js.map +1 -1
- package/dist/src/logic/ContentDeliveryRpcRemote.d.ts +3 -0
- package/dist/src/logic/ContentDeliveryRpcRemote.js +7 -0
- package/dist/src/logic/ContentDeliveryRpcRemote.js.map +1 -1
- package/dist/src/logic/DuplicateMessageDetector.js +2 -2
- package/dist/src/logic/DuplicateMessageDetector.js.map +1 -1
- package/dist/src/logic/ExternalNetworkRpc.js.map +1 -1
- package/dist/src/logic/NodeList.js +2 -2
- package/dist/src/logic/NodeList.js.map +1 -1
- package/dist/src/logic/PeerDescriptorStoreManager.js +0 -1
- package/dist/src/logic/PeerDescriptorStoreManager.js.map +1 -1
- package/dist/src/logic/StreamPartNetworkSplitAvoidance.js +4 -3
- package/dist/src/logic/StreamPartNetworkSplitAvoidance.js.map +1 -1
- package/dist/src/logic/createContentDeliveryLayerNode.js +1 -1
- package/dist/src/logic/createContentDeliveryLayerNode.js.map +1 -1
- package/dist/src/logic/inspect/Inspector.js +3 -3
- package/dist/src/logic/inspect/Inspector.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js +9 -9
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js +5 -5
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/Handshaker.js +12 -12
- package/dist/src/logic/neighbor-discovery/Handshaker.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborFinder.js +5 -0
- package/dist/src/logic/neighbor-discovery/NeighborFinder.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js +3 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js +3 -3
- 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/propagation/Propagation.js +0 -1
- package/dist/src/logic/propagation/Propagation.js.map +1 -1
- package/dist/src/logic/proxy/ProxyClient.d.ts +3 -2
- package/dist/src/logic/proxy/ProxyClient.js +9 -4
- 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 +1 -1
- 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 +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/trackerless-network/protos/NetworkRpc.d.ts +26 -2
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js +16 -2
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js.map +1 -1
- package/dist/test/benchmark/first-message.js +1 -2
- 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 +1 -1
- package/dist/test/utils/utils.js.map +1 -1
- package/jest.config.js +3 -0
- package/karma-setup.js +7 -0
- package/karma.config.js +1 -1
- package/package.json +7 -7
- package/protos/NetworkRpc.proto +7 -1
- package/src/NetworkNode.ts +10 -8
- package/src/NetworkStack.ts +4 -3
- package/src/logic/ContentDeliveryLayerNode.ts +30 -6
- package/src/logic/ContentDeliveryManager.ts +37 -11
- package/src/logic/ContentDeliveryRpcLocal.ts +3 -3
- package/src/logic/ContentDeliveryRpcRemote.ts +10 -0
- package/src/logic/DuplicateMessageDetector.ts +2 -2
- package/src/logic/ExternalNetworkRpc.ts +0 -1
- package/src/logic/NodeList.ts +4 -3
- package/src/logic/PeerDescriptorStoreManager.ts +0 -1
- package/src/logic/StreamPartNetworkSplitAvoidance.ts +5 -4
- package/src/logic/createContentDeliveryLayerNode.ts +2 -2
- package/src/logic/inspect/Inspector.ts +4 -4
- package/src/logic/neighbor-discovery/HandshakeRpcLocal.ts +11 -11
- package/src/logic/neighbor-discovery/HandshakeRpcRemote.ts +6 -6
- package/src/logic/neighbor-discovery/Handshaker.ts +13 -13
- package/src/logic/neighbor-discovery/NeighborFinder.ts +6 -1
- package/src/logic/neighbor-discovery/NeighborUpdateManager.ts +4 -2
- package/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts +4 -4
- package/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.ts +2 -2
- package/src/logic/propagation/Propagation.ts +0 -1
- package/src/logic/proxy/ProxyClient.ts +15 -9
- package/src/logic/proxy/ProxyConnectionRpcLocal.ts +5 -5
- package/src/logic/proxy/ProxyConnectionRpcRemote.ts +2 -2
- package/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts +4 -4
- package/src/logic/temporary-connection/TemporaryConnectionRpcRemote.ts +3 -3
- 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/trackerless-network/protos/NetworkRpc.ts +34 -3
- package/test/benchmark/first-message.ts +2 -3
- package/test/end-to-end/content-delivery-layer-node-with-real-connections.test.ts +2 -2
- package/test/end-to-end/inspect.test.ts +2 -2
- package/test/end-to-end/proxy-and-full-node.test.ts +4 -4
- package/test/end-to-end/proxy-connections.test.ts +3 -3
- package/test/end-to-end/proxy-key-exchange.test.ts +5 -3
- package/test/end-to-end/webrtc-full-node-network.test.ts +4 -4
- package/test/end-to-end/websocket-full-node-network.test.ts +4 -4
- package/test/integration/ContentDeliveryLayerNode-Layer1Node-Latencies.test.ts +4 -4
- package/test/integration/ContentDeliveryLayerNode-Layer1Node.test.ts +4 -4
- package/test/integration/ContentDeliveryManager.test.ts +35 -14
- package/test/integration/ContentDeliveryRpcRemote.test.ts +2 -2
- package/test/integration/Handshakes.test.ts +7 -7
- package/test/integration/Inspect.test.ts +2 -2
- package/test/integration/NetworkNode.test.ts +2 -1
- package/test/integration/NetworkRpc.test.ts +4 -4
- package/test/integration/NetworkStack.test.ts +2 -2
- package/test/integration/NodeInfoRpc.test.ts +6 -2
- package/test/integration/Propagation.test.ts +2 -2
- package/test/integration/joining-streams-on-offline-peers.test.ts +2 -2
- package/test/integration/stream-without-default-entrypoints.test.ts +2 -1
- package/test/integration/streamEntryPointReplacing.test.ts +2 -2
- package/test/types/global.d.ts +2 -0
- package/test/unit/ContentDeliveryLayerNode.test.ts +22 -10
- package/test/unit/ContentDeliveryManager.test.ts +5 -5
- package/test/unit/ContentDeliveryRpcLocal.test.ts +2 -2
- package/test/unit/HandshakeRpcLocal.test.ts +8 -8
- package/test/unit/Handshaker.test.ts +2 -2
- package/test/unit/InspectSession.test.ts +3 -3
- package/test/unit/Inspector.test.ts +4 -4
- package/test/unit/NeighborFinder.test.ts +3 -3
- package/test/unit/NeighborUpdateRpcLocal.test.ts +5 -5
- package/test/unit/NetworkNode.test.ts +2 -2
- package/test/unit/NodeList.test.ts +22 -22
- package/test/unit/PeerDescriptorStoreManager.test.ts +2 -2
- package/test/unit/Propagation.test.ts +6 -5
- package/test/unit/ProxyConnectionRpcRemote.test.ts +3 -3
- package/test/unit/TemporaryConnectionRpcLocal.test.ts +3 -3
- package/test/utils/mock/MockControlLayerNode.ts +5 -0
- package/test/utils/mock/MockTransport.ts +11 -0
- package/test/utils/utils.ts +5 -5
- package/tsconfig.jest.json +1 -1
- package/tsconfig.json +3 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toNodeId } from '@streamr/dht'
|
|
2
2
|
import { StreamPartIDUtils, waitForCondition } from '@streamr/utils'
|
|
3
3
|
import { ContentDeliveryLayerNode } from '../../src/logic/ContentDeliveryLayerNode'
|
|
4
4
|
import { NodeList } from '../../src/logic/NodeList'
|
|
@@ -22,7 +22,7 @@ describe('ContentDeliveryLayerNode', () => {
|
|
|
22
22
|
let discoveryLayerNode: MockDiscoveryLayerNode
|
|
23
23
|
|
|
24
24
|
beforeEach(async () => {
|
|
25
|
-
const nodeId =
|
|
25
|
+
const nodeId = toNodeId(peerDescriptor)
|
|
26
26
|
|
|
27
27
|
neighbors = new NodeList(nodeId, 10)
|
|
28
28
|
randomNodeView = new NodeList(nodeId, 10)
|
|
@@ -54,14 +54,14 @@ describe('ContentDeliveryLayerNode', () => {
|
|
|
54
54
|
const mockRemote = createMockContentDeliveryRpcRemote()
|
|
55
55
|
neighbors.add(mockRemote)
|
|
56
56
|
const result = contentDeliveryLayerNode.getNeighbors()
|
|
57
|
-
expect(
|
|
57
|
+
expect(toNodeId(result[0])).toEqual(toNodeId(mockRemote.getPeerDescriptor()))
|
|
58
58
|
})
|
|
59
59
|
|
|
60
60
|
it('getNearbyNodeView', () => {
|
|
61
61
|
const mockRemote = createMockContentDeliveryRpcRemote()
|
|
62
62
|
nearbyNodeView.add(mockRemote)
|
|
63
63
|
const ids = contentDeliveryLayerNode.getNearbyNodeView().getIds()
|
|
64
|
-
expect(ids[0]).toEqual(
|
|
64
|
+
expect(ids[0]).toEqual(toNodeId(mockRemote.getPeerDescriptor()))
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
it('Adds Closest Nodes from layer1 nearbyContactAdded event to nearbyNodeView', async () => {
|
|
@@ -70,8 +70,8 @@ describe('ContentDeliveryLayerNode', () => {
|
|
|
70
70
|
discoveryLayerNode.setClosestContacts([peerDescriptor1, peerDescriptor2])
|
|
71
71
|
discoveryLayerNode.emit('nearbyContactAdded', peerDescriptor1)
|
|
72
72
|
await waitForCondition(() => nearbyNodeView.size() === 2)
|
|
73
|
-
expect(nearbyNodeView.get(
|
|
74
|
-
expect(nearbyNodeView.get(
|
|
73
|
+
expect(nearbyNodeView.get(toNodeId(peerDescriptor1))).toBeTruthy()
|
|
74
|
+
expect(nearbyNodeView.get(toNodeId(peerDescriptor2))).toBeTruthy()
|
|
75
75
|
})
|
|
76
76
|
|
|
77
77
|
it('Adds Random Nodes from layer1 randomContactAdded event to randomNodeView', async () => {
|
|
@@ -80,8 +80,8 @@ describe('ContentDeliveryLayerNode', () => {
|
|
|
80
80
|
discoveryLayerNode.setRandomContacts([peerDescriptor1, peerDescriptor2])
|
|
81
81
|
discoveryLayerNode.emit('randomContactAdded', peerDescriptor1)
|
|
82
82
|
await waitForCondition(() => randomNodeView.size() === 2)
|
|
83
|
-
expect(randomNodeView.get(
|
|
84
|
-
expect(randomNodeView.get(
|
|
83
|
+
expect(randomNodeView.get(toNodeId(peerDescriptor1))).toBeTruthy()
|
|
84
|
+
expect(randomNodeView.get(toNodeId(peerDescriptor2))).toBeTruthy()
|
|
85
85
|
})
|
|
86
86
|
|
|
87
87
|
it('Adds Nodes from layer1 neighbors to nearbyNodeView if its size is below nodeViewSize', async () => {
|
|
@@ -93,8 +93,20 @@ describe('ContentDeliveryLayerNode', () => {
|
|
|
93
93
|
await waitForCondition(() => {
|
|
94
94
|
return nearbyNodeView.size() === 3
|
|
95
95
|
}, 20000)
|
|
96
|
-
expect(nearbyNodeView.get(
|
|
97
|
-
expect(nearbyNodeView.get(
|
|
96
|
+
expect(nearbyNodeView.get(toNodeId(peerDescriptor1))).toBeTruthy()
|
|
97
|
+
expect(nearbyNodeView.get(toNodeId(peerDescriptor2))).toBeTruthy()
|
|
98
98
|
}, 25000)
|
|
99
99
|
|
|
100
|
+
it('getInfo', () => {
|
|
101
|
+
const nodeWithRtt = createMockContentDeliveryRpcRemote()
|
|
102
|
+
neighbors.add(nodeWithRtt)
|
|
103
|
+
const nodeWithoutRtt = createMockContentDeliveryRpcRemote()
|
|
104
|
+
neighbors.add(nodeWithoutRtt)
|
|
105
|
+
nodeWithRtt.setRtt(100)
|
|
106
|
+
const info = contentDeliveryLayerNode.getInfos()
|
|
107
|
+
expect(info[0].rtt).toEqual(100)
|
|
108
|
+
expect(info[0].peerDescriptor).toEqual(nodeWithRtt.getPeerDescriptor())
|
|
109
|
+
expect(info[1].rtt).toBeUndefined()
|
|
110
|
+
expect(info[1].peerDescriptor).toEqual(nodeWithoutRtt.getPeerDescriptor())
|
|
111
|
+
})
|
|
100
112
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { areEqualPeerDescriptors } from '@streamr/dht'
|
|
2
|
-
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
3
2
|
import { StreamPartIDUtils, waitForCondition } from '@streamr/utils'
|
|
4
3
|
import { ContentDeliveryManager } from '../../src/logic/ContentDeliveryManager'
|
|
5
4
|
import { ProxyDirection } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
6
5
|
import { MockControlLayerNode } from '../utils/mock/MockControlLayerNode'
|
|
7
6
|
import { MockTransport } from '../utils/mock/MockTransport'
|
|
8
7
|
import { createMockPeerDescriptor, createStreamMessage, mockConnectionLocker } from '../utils/utils'
|
|
8
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
9
9
|
|
|
10
10
|
describe('ContentDeliveryManager', () => {
|
|
11
11
|
|
|
@@ -32,7 +32,7 @@ describe('ContentDeliveryManager', () => {
|
|
|
32
32
|
const message = createStreamMessage(
|
|
33
33
|
JSON.stringify({ hello: 'WORLD' }),
|
|
34
34
|
streamPartId,
|
|
35
|
-
|
|
35
|
+
randomUserId()
|
|
36
36
|
)
|
|
37
37
|
|
|
38
38
|
beforeEach(async () => {
|
|
@@ -61,7 +61,7 @@ describe('ContentDeliveryManager', () => {
|
|
|
61
61
|
it('happy path', async () => {
|
|
62
62
|
const streamPartId = StreamPartIDUtils.parse('stream#0')
|
|
63
63
|
const proxy = createMockPeerDescriptor()
|
|
64
|
-
const userId =
|
|
64
|
+
const userId = randomUserId()
|
|
65
65
|
await manager.setProxies(streamPartId, [proxy], ProxyDirection.PUBLISH, userId)
|
|
66
66
|
expect(manager.isProxiedStreamPart(streamPartId)).toBe(true)
|
|
67
67
|
await manager.setProxies(streamPartId, [], ProxyDirection.PUBLISH, userId)
|
|
@@ -71,7 +71,7 @@ describe('ContentDeliveryManager', () => {
|
|
|
71
71
|
it('empty node list', async () => {
|
|
72
72
|
const streamPartId = StreamPartIDUtils.parse('stream#0')
|
|
73
73
|
const proxy = createMockPeerDescriptor()
|
|
74
|
-
const userId =
|
|
74
|
+
const userId = randomUserId()
|
|
75
75
|
await manager.setProxies(streamPartId, [], ProxyDirection.PUBLISH, userId)
|
|
76
76
|
expect(manager.isProxiedStreamPart(streamPartId)).toBe(false)
|
|
77
77
|
await manager.setProxies(streamPartId, [proxy], ProxyDirection.PUBLISH, userId)
|
|
@@ -83,7 +83,7 @@ describe('ContentDeliveryManager', () => {
|
|
|
83
83
|
it('connection count to 0', async () => {
|
|
84
84
|
const streamPartId = StreamPartIDUtils.parse('stream#0')
|
|
85
85
|
const proxy = createMockPeerDescriptor()
|
|
86
|
-
const userId =
|
|
86
|
+
const userId = randomUserId()
|
|
87
87
|
await manager.setProxies(streamPartId, [proxy], ProxyDirection.PUBLISH, userId, 0)
|
|
88
88
|
expect(manager.isProxiedStreamPart(streamPartId)).toBe(false)
|
|
89
89
|
await manager.setProxies(streamPartId, [proxy], ProxyDirection.PUBLISH, userId)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ListeningRpcCommunicator } from '@streamr/dht'
|
|
2
|
-
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
3
2
|
import { StreamPartIDUtils } from '@streamr/utils'
|
|
4
3
|
import { ContentDeliveryRpcLocal } from '../../src/logic/ContentDeliveryRpcLocal'
|
|
5
4
|
import { LeaveStreamPartNotice } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
6
5
|
import { MockTransport } from '../utils/mock/MockTransport'
|
|
7
6
|
import { createMockPeerDescriptor, createStreamMessage } from '../utils/utils'
|
|
7
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
8
8
|
|
|
9
9
|
describe('ContentDeliveryRpcLocal', () => {
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ describe('ContentDeliveryRpcLocal', () => {
|
|
|
16
16
|
const message = createStreamMessage(
|
|
17
17
|
JSON.stringify({ hello: 'WORLD' }),
|
|
18
18
|
StreamPartIDUtils.parse('random-graph#0'),
|
|
19
|
-
|
|
19
|
+
randomUserId()
|
|
20
20
|
)
|
|
21
21
|
|
|
22
22
|
let mockBroadcast: jest.Mock
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DhtAddress, NodeType,
|
|
1
|
+
import { DhtAddress, NodeType, toNodeId, toDhtAddressRaw } from '@streamr/dht'
|
|
2
2
|
import { StreamPartIDUtils } from '@streamr/utils'
|
|
3
3
|
import { NodeList } from '../../src/logic/NodeList'
|
|
4
4
|
import { HandshakeRpcLocal } from '../../src/logic/neighbor-discovery/HandshakeRpcLocal'
|
|
@@ -19,7 +19,7 @@ describe('HandshakeRpcLocal', () => {
|
|
|
19
19
|
let handshakeWithInterleaving: jest.Mock
|
|
20
20
|
|
|
21
21
|
beforeEach(() => {
|
|
22
|
-
neighbors = new NodeList(
|
|
22
|
+
neighbors = new NodeList(toNodeId(localPeerDescriptor), 10)
|
|
23
23
|
ongoingHandshakes = new Set()
|
|
24
24
|
ongoingInterleaves = new Set()
|
|
25
25
|
handshakeWithInterleaving = jest.fn()
|
|
@@ -86,7 +86,7 @@ describe('HandshakeRpcLocal', () => {
|
|
|
86
86
|
it('handshakeWithInterleaving success', async () => {
|
|
87
87
|
const req: InterleaveRequest = {
|
|
88
88
|
interleaveTargetDescriptor: {
|
|
89
|
-
nodeId:
|
|
89
|
+
nodeId: toDhtAddressRaw('0x2222' as DhtAddress),
|
|
90
90
|
type: NodeType.NODEJS
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -99,7 +99,7 @@ describe('HandshakeRpcLocal', () => {
|
|
|
99
99
|
it('handshakeWithInterleaving success', async () => {
|
|
100
100
|
const req: InterleaveRequest = {
|
|
101
101
|
interleaveTargetDescriptor: {
|
|
102
|
-
nodeId:
|
|
102
|
+
nodeId: toDhtAddressRaw('0x2222' as DhtAddress),
|
|
103
103
|
type: NodeType.NODEJS
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -115,7 +115,7 @@ describe('HandshakeRpcLocal', () => {
|
|
|
115
115
|
neighbors.add(createMockContentDeliveryRpcRemote())
|
|
116
116
|
neighbors.add(createMockContentDeliveryRpcRemote())
|
|
117
117
|
const requestor = createMockPeerDescriptor()
|
|
118
|
-
ongoingInterleaves.add(
|
|
118
|
+
ongoingInterleaves.add(toNodeId(requestor))
|
|
119
119
|
const req = StreamPartHandshakeRequest.create({
|
|
120
120
|
streamPartId: STREAM_PART_ID,
|
|
121
121
|
requestId: 'requestId'
|
|
@@ -134,9 +134,9 @@ describe('HandshakeRpcLocal', () => {
|
|
|
134
134
|
neighbors.add(createMockContentDeliveryRpcRemote(interleavingPeer2))
|
|
135
135
|
neighbors.add(createMockContentDeliveryRpcRemote(interleavingPeer3))
|
|
136
136
|
neighbors.add(createMockContentDeliveryRpcRemote())
|
|
137
|
-
ongoingInterleaves.add(
|
|
138
|
-
ongoingInterleaves.add(
|
|
139
|
-
ongoingInterleaves.add(
|
|
137
|
+
ongoingInterleaves.add(toNodeId(interleavingPeer1))
|
|
138
|
+
ongoingInterleaves.add(toNodeId(interleavingPeer2))
|
|
139
|
+
ongoingInterleaves.add(toNodeId(interleavingPeer3))
|
|
140
140
|
const req = StreamPartHandshakeRequest.create({
|
|
141
141
|
streamPartId: STREAM_PART_ID,
|
|
142
142
|
requestId: 'requestId'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ListeningRpcCommunicator, Simulator, SimulatorTransport,
|
|
1
|
+
import { ListeningRpcCommunicator, Simulator, SimulatorTransport, toNodeId } from '@streamr/dht'
|
|
2
2
|
import { StreamPartIDUtils } from '@streamr/utils'
|
|
3
3
|
import { range } from 'lodash'
|
|
4
4
|
import { NodeList } from '../../src/logic/NodeList'
|
|
@@ -28,7 +28,7 @@ describe('Handshaker', () => {
|
|
|
28
28
|
await simulatorTransport.start()
|
|
29
29
|
const rpcCommunicator = new ListeningRpcCommunicator(streamPartId, simulatorTransport)
|
|
30
30
|
|
|
31
|
-
const nodeId =
|
|
31
|
+
const nodeId = toNodeId(peerDescriptor)
|
|
32
32
|
neighbors = new NodeList(nodeId, 10)
|
|
33
33
|
leftNodeView = new NodeList(nodeId, 20)
|
|
34
34
|
rightNodeView = new NodeList(nodeId, 20)
|
|
@@ -2,7 +2,7 @@ import { InspectSession, Events } from '../../src/logic/inspect/InspectSession'
|
|
|
2
2
|
import { MessageID } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
3
3
|
import { waitForEvent3 } from '../../../utils/dist/src/waitForEvent3'
|
|
4
4
|
import { utf8ToBinary } from '@streamr/utils'
|
|
5
|
-
import { DhtAddress,
|
|
5
|
+
import { DhtAddress, randomDhtAddress } from '@streamr/dht'
|
|
6
6
|
|
|
7
7
|
describe('InspectSession', () => {
|
|
8
8
|
|
|
@@ -30,8 +30,8 @@ describe('InspectSession', () => {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
beforeEach(() => {
|
|
33
|
-
inspectedNode =
|
|
34
|
-
anotherNode =
|
|
33
|
+
inspectedNode = randomDhtAddress()
|
|
34
|
+
anotherNode = randomDhtAddress()
|
|
35
35
|
inspectSession = new InspectSession({
|
|
36
36
|
inspectedNode
|
|
37
37
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ListeningRpcCommunicator,
|
|
1
|
+
import { ListeningRpcCommunicator, randomDhtAddress, toNodeId } from '@streamr/dht'
|
|
2
2
|
import { StreamPartIDUtils, utf8ToBinary } from '@streamr/utils'
|
|
3
3
|
import { Inspector } from '../../src/logic/inspect/Inspector'
|
|
4
4
|
import { MockTransport } from '../utils/mock/MockTransport'
|
|
@@ -11,7 +11,7 @@ describe('Inspector', () => {
|
|
|
11
11
|
|
|
12
12
|
const inspectedDescriptor = createMockPeerDescriptor()
|
|
13
13
|
|
|
14
|
-
const nodeId =
|
|
14
|
+
const nodeId = randomDhtAddress()
|
|
15
15
|
let mockConnect: jest.Mock
|
|
16
16
|
|
|
17
17
|
const messageRef = {
|
|
@@ -40,11 +40,11 @@ describe('Inspector', () => {
|
|
|
40
40
|
|
|
41
41
|
it('Opens inspection connection and runs successfully', async () => {
|
|
42
42
|
setTimeout(() => {
|
|
43
|
-
inspector.markMessage(
|
|
43
|
+
inspector.markMessage(toNodeId(inspectedDescriptor), messageRef)
|
|
44
44
|
inspector.markMessage(nodeId, messageRef)
|
|
45
45
|
}, 250)
|
|
46
46
|
await inspector.inspect(inspectedDescriptor)
|
|
47
|
-
expect(inspector.isInspected(
|
|
47
|
+
expect(inspector.isInspected(toNodeId(inspectedDescriptor))).toBe(false)
|
|
48
48
|
expect(mockConnect).toBeCalledTimes(1)
|
|
49
49
|
})
|
|
50
50
|
|
|
@@ -4,11 +4,11 @@ import { waitForCondition } from '@streamr/utils'
|
|
|
4
4
|
import { range } from 'lodash'
|
|
5
5
|
import { expect } from 'expect'
|
|
6
6
|
import { createMockContentDeliveryRpcRemote } from '../utils/utils'
|
|
7
|
-
import { DhtAddress,
|
|
7
|
+
import { DhtAddress, randomDhtAddress, toNodeId } from '@streamr/dht'
|
|
8
8
|
|
|
9
9
|
describe('NeighborFinder', () => {
|
|
10
10
|
|
|
11
|
-
const nodeId =
|
|
11
|
+
const nodeId = randomDhtAddress()
|
|
12
12
|
let neighbors: NodeList
|
|
13
13
|
let nearbyNodeView: NodeList
|
|
14
14
|
let neighborFinder: NeighborFinder
|
|
@@ -24,7 +24,7 @@ describe('NeighborFinder', () => {
|
|
|
24
24
|
if (Math.random() < 0.5) {
|
|
25
25
|
neighbors.add(target!)
|
|
26
26
|
} else {
|
|
27
|
-
excluded.push(
|
|
27
|
+
excluded.push(toNodeId(target!.getPeerDescriptor()))
|
|
28
28
|
}
|
|
29
29
|
return excluded
|
|
30
30
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DhtAddress, ListeningRpcCommunicator,
|
|
1
|
+
import { DhtAddress, ListeningRpcCommunicator, toNodeId } from '@streamr/dht'
|
|
2
2
|
import { StreamPartIDUtils } from '@streamr/utils'
|
|
3
3
|
import { range } from 'lodash'
|
|
4
4
|
import { ContentDeliveryRpcRemote } from '../../src/logic/ContentDeliveryRpcRemote'
|
|
@@ -35,8 +35,8 @@ describe('NeighborUpdateRpcLocal', () => {
|
|
|
35
35
|
|
|
36
36
|
beforeEach(() => {
|
|
37
37
|
rpcCommunicator = new ListeningRpcCommunicator('mock', new MockTransport())
|
|
38
|
-
neighbors = new NodeList(
|
|
39
|
-
nearbyNodeView = new NodeList(
|
|
38
|
+
neighbors = new NodeList(toNodeId(localPeerDescriptor), neighborTargetCount + 1)
|
|
39
|
+
nearbyNodeView = new NodeList(toNodeId(localPeerDescriptor), neighborTargetCount)
|
|
40
40
|
neighborFinder = {
|
|
41
41
|
start: jest.fn()
|
|
42
42
|
} as any
|
|
@@ -122,12 +122,12 @@ describe('NeighborUpdateRpcLocal', () => {
|
|
|
122
122
|
removeMe: false
|
|
123
123
|
}, { incomingSourceDescriptor: caller } as any)
|
|
124
124
|
expect(res.removeMe).toEqual(true)
|
|
125
|
-
expect(neighbors.has(
|
|
125
|
+
expect(neighbors.has(toNodeId(caller))).toEqual(false)
|
|
126
126
|
})
|
|
127
127
|
|
|
128
128
|
it('does not ask to be removed if there is an ongoing handshake to the caller', async () => {
|
|
129
129
|
const caller = createMockPeerDescriptor()
|
|
130
|
-
ongoingHandshakes.add(
|
|
130
|
+
ongoingHandshakes.add(toNodeId(caller))
|
|
131
131
|
const res = await rpcLocal.neighborUpdate({
|
|
132
132
|
streamPartId,
|
|
133
133
|
neighborDescriptors: [localPeerDescriptor],
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
2
1
|
import { StreamPartIDUtils } from '@streamr/utils'
|
|
3
2
|
import { EventEmitter } from 'eventemitter3'
|
|
4
3
|
import { NetworkNode } from '../../src/NetworkNode'
|
|
@@ -6,9 +5,10 @@ import { NetworkStack } from '../../src/NetworkStack'
|
|
|
6
5
|
import { Events } from '../../src/logic/ContentDeliveryManager'
|
|
7
6
|
import { StreamMessage } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
8
7
|
import { createStreamMessage } from '../utils/utils'
|
|
8
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
9
9
|
|
|
10
10
|
const STREAM_PART = StreamPartIDUtils.parse('stream#0')
|
|
11
|
-
const PUBLISHER_ID =
|
|
11
|
+
const PUBLISHER_ID = randomUserId()
|
|
12
12
|
|
|
13
13
|
const createMessage = (id: number): StreamMessage => {
|
|
14
14
|
return createStreamMessage(`${id}`, STREAM_PART, PUBLISHER_ID)
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
ListeningRpcCommunicator,
|
|
3
3
|
NodeType,
|
|
4
4
|
PeerDescriptor,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
randomDhtAddress,
|
|
6
|
+
toDhtAddress,
|
|
7
|
+
toNodeId,
|
|
8
8
|
} from '@streamr/dht'
|
|
9
9
|
import { StreamPartIDUtils } from '@streamr/utils'
|
|
10
10
|
import { expect } from 'expect'
|
|
@@ -26,7 +26,7 @@ describe('NodeList', () => {
|
|
|
26
26
|
new Uint8Array([1, 1, 4]),
|
|
27
27
|
new Uint8Array([1, 1, 5])
|
|
28
28
|
]
|
|
29
|
-
const ownId =
|
|
29
|
+
const ownId = randomDhtAddress()
|
|
30
30
|
let nodeList: NodeList
|
|
31
31
|
|
|
32
32
|
const createRemoteGraphNode = (peerDescriptor: PeerDescriptor) => {
|
|
@@ -57,7 +57,7 @@ describe('NodeList', () => {
|
|
|
57
57
|
}
|
|
58
58
|
const newNode = createRemoteGraphNode(newDescriptor)
|
|
59
59
|
nodeList.add(newNode)
|
|
60
|
-
expect(nodeList.has(
|
|
60
|
+
expect(nodeList.has(toNodeId(newDescriptor))).toEqual(true)
|
|
61
61
|
|
|
62
62
|
const newDescriptor2 = {
|
|
63
63
|
nodeId: new Uint8Array([1, 2, 4]),
|
|
@@ -65,26 +65,26 @@ describe('NodeList', () => {
|
|
|
65
65
|
}
|
|
66
66
|
const newNode2 = createRemoteGraphNode(newDescriptor2)
|
|
67
67
|
nodeList.add(newNode2)
|
|
68
|
-
expect(nodeList.has(
|
|
68
|
+
expect(nodeList.has(toNodeId(newDescriptor2))).toEqual(false)
|
|
69
69
|
})
|
|
70
70
|
|
|
71
71
|
it('remove', () => {
|
|
72
72
|
const toRemove = nodeList.getFirst([])
|
|
73
|
-
const nodeId =
|
|
73
|
+
const nodeId = toNodeId(toRemove!.getPeerDescriptor())
|
|
74
74
|
nodeList.remove(nodeId)
|
|
75
75
|
expect(nodeList.has(nodeId)).toEqual(false)
|
|
76
76
|
})
|
|
77
77
|
|
|
78
78
|
it('getFirst', () => {
|
|
79
79
|
const closest = nodeList.getFirst([])
|
|
80
|
-
expect(
|
|
81
|
-
.toEqual(
|
|
80
|
+
expect(toNodeId(closest!.getPeerDescriptor()))
|
|
81
|
+
.toEqual(toDhtAddress(new Uint8Array([1, 1, 1])))
|
|
82
82
|
})
|
|
83
83
|
|
|
84
84
|
it('getFirst with exclude', () => {
|
|
85
|
-
const closest = nodeList.getFirst([
|
|
86
|
-
expect(
|
|
87
|
-
.toEqual(
|
|
85
|
+
const closest = nodeList.getFirst([toDhtAddress(new Uint8Array([1, 1, 1]))])
|
|
86
|
+
expect(toNodeId(closest!.getPeerDescriptor()))
|
|
87
|
+
.toEqual(toDhtAddress(new Uint8Array([1, 1, 2])))
|
|
88
88
|
})
|
|
89
89
|
|
|
90
90
|
it('getFirst wsOnly', () => {
|
|
@@ -95,14 +95,14 @@ describe('NodeList', () => {
|
|
|
95
95
|
|
|
96
96
|
it('getLast', () => {
|
|
97
97
|
const closest = nodeList.getLast([])
|
|
98
|
-
expect(
|
|
99
|
-
.toEqual(
|
|
98
|
+
expect(toNodeId(closest!.getPeerDescriptor()))
|
|
99
|
+
.toEqual(toDhtAddress(new Uint8Array([1, 1, 5])))
|
|
100
100
|
})
|
|
101
101
|
|
|
102
102
|
it('getLast with exclude', () => {
|
|
103
|
-
const closest = nodeList.getLast([
|
|
104
|
-
expect(
|
|
105
|
-
.toEqual(
|
|
103
|
+
const closest = nodeList.getLast([toDhtAddress(new Uint8Array([1, 1, 5]))])
|
|
104
|
+
expect(toNodeId(closest!.getPeerDescriptor()))
|
|
105
|
+
.toEqual(toDhtAddress(new Uint8Array([1, 1, 4])))
|
|
106
106
|
})
|
|
107
107
|
|
|
108
108
|
it('getFirstAndLast', () => {
|
|
@@ -132,17 +132,17 @@ describe('NodeList', () => {
|
|
|
132
132
|
|
|
133
133
|
it('getFirstAndLast with exclude', () => {
|
|
134
134
|
const results = nodeList.getFirstAndLast([
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
toDhtAddress(new Uint8Array([1, 1, 1])),
|
|
136
|
+
toDhtAddress(new Uint8Array([1, 1, 5]))
|
|
137
137
|
])
|
|
138
138
|
expect(results).toEqual([
|
|
139
|
-
nodeList.getFirst([
|
|
140
|
-
nodeList.getLast([
|
|
139
|
+
nodeList.getFirst([toDhtAddress(new Uint8Array([1, 1, 1]))]),
|
|
140
|
+
nodeList.getLast([toDhtAddress(new Uint8Array([1, 1, 5]))])
|
|
141
141
|
])
|
|
142
142
|
})
|
|
143
143
|
|
|
144
144
|
it('items are in insertion order', () => {
|
|
145
|
-
const list = new NodeList(
|
|
145
|
+
const list = new NodeList(randomDhtAddress(), 100)
|
|
146
146
|
const item1 = createRemoteGraphNode(createMockPeerDescriptor())
|
|
147
147
|
const item2 = createRemoteGraphNode(createMockPeerDescriptor())
|
|
148
148
|
const item3 = createRemoteGraphNode(createMockPeerDescriptor())
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { PeerDescriptor, areEqualPeerDescriptors,
|
|
1
|
+
import { PeerDescriptor, areEqualPeerDescriptors, randomDhtAddress } from '@streamr/dht'
|
|
2
2
|
import { wait } from '@streamr/utils'
|
|
3
3
|
import { PeerDescriptorStoreManager } from '../../src/logic/PeerDescriptorStoreManager'
|
|
4
4
|
import { Any } from '../../src/proto/google/protobuf/any'
|
|
5
5
|
import { DataEntry } from '../../src/proto/packages/dht/protos/DhtRpc'
|
|
6
6
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
7
7
|
|
|
8
|
-
const KEY =
|
|
8
|
+
const KEY = randomDhtAddress()
|
|
9
9
|
|
|
10
10
|
describe('PeerDescriptorStoreManager', () => {
|
|
11
11
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { DhtAddress } from '@streamr/dht'
|
|
2
|
+
import { hexToBinary, wait } from '@streamr/utils'
|
|
3
|
+
import { Propagation } from '../../src/logic/propagation/Propagation'
|
|
1
4
|
import {
|
|
2
5
|
ContentType,
|
|
3
6
|
EncryptionType,
|
|
@@ -5,11 +8,9 @@ import {
|
|
|
5
8
|
SignatureType,
|
|
6
9
|
StreamMessage
|
|
7
10
|
} from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
8
|
-
import {
|
|
9
|
-
import { hexToBinary, toEthereumAddress, utf8ToBinary, wait } from '@streamr/utils'
|
|
10
|
-
import { DhtAddress } from '@streamr/dht'
|
|
11
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
11
12
|
|
|
12
|
-
const PUBLISHER_ID =
|
|
13
|
+
const PUBLISHER_ID = randomUserId()
|
|
13
14
|
|
|
14
15
|
function makeMsg(streamId: string, partition: number, ts: number, msgNo: number): StreamMessage {
|
|
15
16
|
const messageId: MessageID = {
|
|
@@ -18,7 +19,7 @@ function makeMsg(streamId: string, partition: number, ts: number, msgNo: number)
|
|
|
18
19
|
timestamp: ts,
|
|
19
20
|
sequenceNumber: msgNo,
|
|
20
21
|
messageChainId: 'msgChain',
|
|
21
|
-
publisherId:
|
|
22
|
+
publisherId: hexToBinary(PUBLISHER_ID)
|
|
22
23
|
}
|
|
23
24
|
return {
|
|
24
25
|
messageId,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RpcCommunicator } from '@streamr/proto-rpc'
|
|
2
|
-
import {
|
|
2
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
3
3
|
import { hexToBinary } from '@streamr/utils'
|
|
4
4
|
import { ProxyConnectionRpcRemote } from '../../src/logic/proxy/ProxyConnectionRpcRemote'
|
|
5
5
|
import { ProxyConnectionRequest, ProxyDirection } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
@@ -21,14 +21,14 @@ describe('ProxyConnectionRpcRemote', () => {
|
|
|
21
21
|
ProxyConnectionRpcClient
|
|
22
22
|
)
|
|
23
23
|
|
|
24
|
-
const userId =
|
|
24
|
+
const userId = randomUserId()
|
|
25
25
|
await rpcRemote.requestConnection(ProxyDirection.PUBLISH, userId)
|
|
26
26
|
|
|
27
27
|
const [rpcMessage, _, callContext] = onOutgoingMessage.mock.calls[0]
|
|
28
28
|
const request = ProxyConnectionRequest.fromBinary(rpcMessage.body.value)
|
|
29
29
|
expect(request).toEqual({
|
|
30
30
|
direction: ProxyDirection.PUBLISH,
|
|
31
|
-
userId:
|
|
31
|
+
userId: expect.toEqualBinary(hexToBinary(userId))
|
|
32
32
|
})
|
|
33
33
|
expect(callContext).toMatchObject({
|
|
34
34
|
sourceDescriptor: clientPeerDescriptor,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ListeningRpcCommunicator,
|
|
1
|
+
import { ListeningRpcCommunicator, toDhtAddress } from '@streamr/dht'
|
|
2
2
|
import { StreamPartIDUtils } from '@streamr/utils'
|
|
3
3
|
import { TemporaryConnectionRpcLocal } from '../../src/logic/temporary-connection/TemporaryConnectionRpcLocal'
|
|
4
4
|
import { MockTransport } from '../utils/mock/MockTransport'
|
|
@@ -30,9 +30,9 @@ describe('TemporaryConnectionRpcLocal', () => {
|
|
|
30
30
|
it('Open and Close Connection', async () => {
|
|
31
31
|
const caller = createMockPeerDescriptor()
|
|
32
32
|
await rpcLocal.openConnection({}, { incomingSourceDescriptor: caller } as any)
|
|
33
|
-
expect(rpcLocal.getNodes().get(
|
|
33
|
+
expect(rpcLocal.getNodes().get(toDhtAddress(caller.nodeId))).toBeDefined()
|
|
34
34
|
await rpcLocal.closeConnection({}, { incomingSourceDescriptor: caller } as any)
|
|
35
|
-
expect(rpcLocal.getNodes().get(
|
|
35
|
+
expect(rpcLocal.getNodes().get(toDhtAddress(caller.nodeId))).toBeUndefined()
|
|
36
36
|
})
|
|
37
37
|
|
|
38
38
|
})
|
|
@@ -70,4 +70,9 @@ export class MockControlLayerNode extends EventEmitter<TransportEvents> implemen
|
|
|
70
70
|
// eslint-disable-next-line class-methods-use-this
|
|
71
71
|
async stop(): Promise<void> {
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
// eslint-disable-next-line class-methods-use-this
|
|
75
|
+
getDiagnosticInfo(): Record<string, unknown> {
|
|
76
|
+
return {}
|
|
77
|
+
}
|
|
73
78
|
}
|
|
@@ -16,4 +16,15 @@ export class MockTransport extends EventEmitter<TransportEvents> implements ITra
|
|
|
16
16
|
// eslint-disable-next-line class-methods-use-this
|
|
17
17
|
stop(): void {
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line class-methods-use-this
|
|
21
|
+
getDiagnosticInfo(): Record<string, unknown> {
|
|
22
|
+
return {}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// eslint-disable-next-line class-methods-use-this
|
|
26
|
+
enablePrivateClientMode(): void {
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
19
30
|
}
|
package/test/utils/utils.ts
CHANGED
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
PeerDescriptor,
|
|
6
6
|
Simulator,
|
|
7
7
|
SimulatorTransport,
|
|
8
|
-
|
|
8
|
+
randomDhtAddress,
|
|
9
9
|
getRandomRegion,
|
|
10
|
-
|
|
10
|
+
toDhtAddressRaw
|
|
11
11
|
} from '@streamr/dht'
|
|
12
12
|
import { RpcCommunicator } from '@streamr/proto-rpc'
|
|
13
|
-
import {
|
|
13
|
+
import { StreamPartID, StreamPartIDUtils, UserID, hexToBinary, utf8ToBinary } from '@streamr/utils'
|
|
14
14
|
import { NetworkNode, createNetworkNode } from '../../src/NetworkNode'
|
|
15
15
|
import { ContentDeliveryLayerNode } from '../../src/logic/ContentDeliveryLayerNode'
|
|
16
16
|
import { ContentDeliveryRpcRemote } from '../../src/logic/ContentDeliveryRpcRemote'
|
|
@@ -67,7 +67,7 @@ export const createMockContentDeliveryLayerNodeAndDhtNode = async (
|
|
|
67
67
|
export const createStreamMessage = (
|
|
68
68
|
content: string,
|
|
69
69
|
streamPartId: StreamPartID,
|
|
70
|
-
publisherId:
|
|
70
|
+
publisherId: UserID,
|
|
71
71
|
timestamp?: number,
|
|
72
72
|
sequenceNumber?: number
|
|
73
73
|
): StreamMessage => {
|
|
@@ -98,7 +98,7 @@ export const createStreamMessage = (
|
|
|
98
98
|
export const createMockPeerDescriptor = (opts?: Omit<Partial<PeerDescriptor>, 'nodeId' | 'type'>): PeerDescriptor => {
|
|
99
99
|
return {
|
|
100
100
|
...opts,
|
|
101
|
-
nodeId:
|
|
101
|
+
nodeId: toDhtAddressRaw(randomDhtAddress()),
|
|
102
102
|
type: NodeType.NODEJS,
|
|
103
103
|
region: getRandomRegion()
|
|
104
104
|
}
|
package/tsconfig.jest.json
CHANGED
package/tsconfig.json
ADDED