@streamr/trackerless-network 102.0.0-beta.1 → 102.0.0-beta.3
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 +5 -5
- package/package.json +5 -5
- package/src/NetworkNode.ts +0 -142
- package/src/NetworkStack.ts +0 -197
- package/src/exports.ts +0 -18
- package/src/logic/ContentDeliveryLayerNode.ts +0 -424
- package/src/logic/ContentDeliveryManager.ts +0 -401
- package/src/logic/ContentDeliveryRpcLocal.ts +0 -48
- package/src/logic/ContentDeliveryRpcRemote.ts +0 -44
- package/src/logic/ControlLayerNode.ts +0 -17
- package/src/logic/DiscoveryLayerNode.ts +0 -30
- package/src/logic/DuplicateMessageDetector.ts +0 -167
- package/src/logic/ExternalNetworkRpc.ts +0 -42
- package/src/logic/NodeList.ts +0 -114
- package/src/logic/PeerDescriptorStoreManager.ts +0 -96
- package/src/logic/StreamPartNetworkSplitAvoidance.ts +0 -90
- package/src/logic/StreamPartReconnect.ts +0 -38
- package/src/logic/createContentDeliveryLayerNode.ts +0 -130
- package/src/logic/formStreamPartDeliveryServiceId.ts +0 -7
- package/src/logic/inspect/InspectSession.ts +0 -55
- package/src/logic/inspect/Inspector.ts +0 -100
- package/src/logic/neighbor-discovery/HandshakeRpcLocal.ts +0 -138
- package/src/logic/neighbor-discovery/HandshakeRpcRemote.ts +0 -66
- package/src/logic/neighbor-discovery/Handshaker.ts +0 -215
- package/src/logic/neighbor-discovery/NeighborFinder.ts +0 -77
- package/src/logic/neighbor-discovery/NeighborUpdateManager.ts +0 -69
- package/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts +0 -75
- package/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.ts +0 -35
- package/src/logic/node-info/NodeInfoClient.ts +0 -23
- package/src/logic/node-info/NodeInfoRpcLocal.ts +0 -28
- package/src/logic/node-info/NodeInfoRpcRemote.ts +0 -11
- package/src/logic/propagation/FifoMapWithTTL.ts +0 -116
- package/src/logic/propagation/Propagation.ts +0 -84
- package/src/logic/propagation/PropagationTaskStore.ts +0 -41
- package/src/logic/proxy/ProxyClient.ts +0 -286
- package/src/logic/proxy/ProxyConnectionRpcLocal.ts +0 -106
- package/src/logic/proxy/ProxyConnectionRpcRemote.ts +0 -26
- package/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts +0 -73
- package/src/logic/temporary-connection/TemporaryConnectionRpcRemote.ts +0 -29
- package/src/logic/utils.ts +0 -18
- package/src/types.ts +0 -13
- package/test/benchmark/StreamPartIdDataKeyDistribution.test.ts +0 -60
- package/test/benchmark/first-message.ts +0 -171
- package/test/end-to-end/content-delivery-layer-node-with-real-connections.test.ts +0 -165
- package/test/end-to-end/external-network-rpc.test.ts +0 -67
- package/test/end-to-end/inspect.test.ts +0 -124
- package/test/end-to-end/proxy-and-full-node.test.ts +0 -143
- package/test/end-to-end/proxy-connections.test.ts +0 -226
- package/test/end-to-end/proxy-key-exchange.test.ts +0 -126
- package/test/end-to-end/webrtc-full-node-network.test.ts +0 -83
- package/test/end-to-end/websocket-full-node-network.test.ts +0 -82
- package/test/integration/ContentDeliveryLayerNode-Layer1Node-Latencies.test.ts +0 -139
- package/test/integration/ContentDeliveryLayerNode-Layer1Node.test.ts +0 -162
- package/test/integration/ContentDeliveryManager.test.ts +0 -160
- package/test/integration/ContentDeliveryRpcRemote.test.ts +0 -100
- package/test/integration/HandshakeRpcRemote.test.ts +0 -79
- package/test/integration/Handshakes.test.ts +0 -141
- package/test/integration/Inspect.test.ts +0 -89
- package/test/integration/NeighborUpdateRpcRemote.test.ts +0 -82
- package/test/integration/NetworkNode.test.ts +0 -115
- package/test/integration/NetworkRpc.test.ts +0 -52
- package/test/integration/NetworkStack.test.ts +0 -72
- package/test/integration/NodeInfoRpc.test.ts +0 -109
- package/test/integration/Propagation.test.ts +0 -76
- package/test/integration/joining-streams-on-offline-peers.test.ts +0 -82
- package/test/integration/stream-without-default-entrypoints.test.ts +0 -128
- package/test/integration/streamEntryPointReplacing.test.ts +0 -97
- package/test/types/global.d.ts +0 -1
- package/test/unit/ContentDeliveryLayerNode.test.ts +0 -112
- package/test/unit/ContentDeliveryManager.test.ts +0 -96
- package/test/unit/ContentDeliveryRpcLocal.test.ts +0 -60
- package/test/unit/DuplicateMessageDetector.test.ts +0 -192
- package/test/unit/ExternalNetworkRpc.test.ts +0 -48
- package/test/unit/FifoMapWithTtl.test.ts +0 -253
- package/test/unit/HandshakeRpcLocal.test.ts +0 -155
- package/test/unit/Handshaker.test.ts +0 -69
- package/test/unit/InspectSession.test.ts +0 -83
- package/test/unit/Inspector.test.ts +0 -51
- package/test/unit/NeighborFinder.test.ts +0 -51
- package/test/unit/NeighborUpdateRpcLocal.test.ts +0 -139
- package/test/unit/NetworkNode.test.ts +0 -42
- package/test/unit/NodeList.test.ts +0 -164
- package/test/unit/NumberPair.test.ts +0 -22
- package/test/unit/PeerDescriptorStoreManager.test.ts +0 -103
- package/test/unit/Propagation.test.ts +0 -151
- package/test/unit/ProxyConnectionRpcRemote.test.ts +0 -39
- package/test/unit/StreamPartIDDataKey.test.ts +0 -12
- package/test/unit/StreamPartNetworkSplitAvoidance.test.ts +0 -31
- package/test/unit/StreamPartReconnect.test.ts +0 -30
- package/test/unit/TemporaryConnectionRpcLocal.test.ts +0 -38
- package/test/utils/fake/FakePeerDescriptorStoreManager.ts +0 -29
- package/test/utils/mock/MockConnectionsView.ts +0 -18
- package/test/utils/mock/MockControlLayerNode.ts +0 -78
- package/test/utils/mock/MockDiscoveryLayerNode.ts +0 -60
- package/test/utils/mock/MockHandshaker.ts +0 -17
- package/test/utils/mock/MockNeighborFinder.ts +0 -20
- package/test/utils/mock/MockNeighborUpdateManager.ts +0 -21
- package/test/utils/mock/MockTransport.ts +0 -30
- package/test/utils/utils.ts +0 -144
- package/tsconfig.browser.json +0 -13
- package/tsconfig.jest.json +0 -17
- package/tsconfig.json +0 -3
- package/tsconfig.node.json +0 -17
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ITransport, PeerDescriptor, TransportEvents } from '@streamr/dht'
|
|
2
|
-
import { EventEmitter } from 'eventemitter3'
|
|
3
|
-
|
|
4
|
-
export class MockTransport extends EventEmitter<TransportEvents> implements ITransport {
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line class-methods-use-this
|
|
7
|
-
async send(): Promise<void> {
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// eslint-disable-next-line class-methods-use-this
|
|
12
|
-
getLocalPeerDescriptor(): PeerDescriptor {
|
|
13
|
-
return PeerDescriptor.create()
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// eslint-disable-next-line class-methods-use-this
|
|
17
|
-
stop(): void {
|
|
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
|
-
|
|
30
|
-
}
|
package/test/utils/utils.ts
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConnectionLocker,
|
|
3
|
-
DhtNode,
|
|
4
|
-
NodeType,
|
|
5
|
-
PeerDescriptor,
|
|
6
|
-
Simulator,
|
|
7
|
-
SimulatorTransport,
|
|
8
|
-
randomDhtAddress,
|
|
9
|
-
getRandomRegion,
|
|
10
|
-
toDhtAddressRaw
|
|
11
|
-
} from '@streamr/dht'
|
|
12
|
-
import { RpcCommunicator } from '@streamr/proto-rpc'
|
|
13
|
-
import { StreamPartID, StreamPartIDUtils, UserID, hexToBinary, toUserIdRaw, utf8ToBinary } from '@streamr/utils'
|
|
14
|
-
import { NetworkNode, createNetworkNode } from '../../src/NetworkNode'
|
|
15
|
-
import { ContentDeliveryLayerNode } from '../../src/logic/ContentDeliveryLayerNode'
|
|
16
|
-
import { ContentDeliveryRpcRemote } from '../../src/logic/ContentDeliveryRpcRemote'
|
|
17
|
-
import { DiscoveryLayerNode } from '../../src/logic/DiscoveryLayerNode'
|
|
18
|
-
import { createContentDeliveryLayerNode } from '../../src/logic/createContentDeliveryLayerNode'
|
|
19
|
-
import { HandshakeRpcRemote } from '../../src/logic/neighbor-discovery/HandshakeRpcRemote'
|
|
20
|
-
import {
|
|
21
|
-
ContentType,
|
|
22
|
-
EncryptionType,
|
|
23
|
-
MessageID,
|
|
24
|
-
SignatureType,
|
|
25
|
-
StreamMessage
|
|
26
|
-
} from '../../generated/packages/trackerless-network/protos/NetworkRpc'
|
|
27
|
-
import { ContentDeliveryRpcClient, HandshakeRpcClient } from '../../generated/packages/trackerless-network/protos/NetworkRpc.client'
|
|
28
|
-
|
|
29
|
-
export const mockConnectionLocker: ConnectionLocker = {
|
|
30
|
-
lockConnection: () => {},
|
|
31
|
-
unlockConnection: () => {},
|
|
32
|
-
weakLockConnection: () => {},
|
|
33
|
-
weakUnlockConnection: () => {},
|
|
34
|
-
getLocalLockedConnectionCount: () => 0,
|
|
35
|
-
getRemoteLockedConnectionCount: () => 0,
|
|
36
|
-
getWeakLockedConnectionCount: () => 0,
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const createMockContentDeliveryLayerNodeAndDhtNode = async (
|
|
40
|
-
localPeerDescriptor: PeerDescriptor,
|
|
41
|
-
entryPointDescriptor: PeerDescriptor,
|
|
42
|
-
streamPartId: StreamPartID,
|
|
43
|
-
simulator: Simulator
|
|
44
|
-
): Promise<[ DiscoveryLayerNode, ContentDeliveryLayerNode ]> => {
|
|
45
|
-
const mockCm = new SimulatorTransport(localPeerDescriptor, simulator)
|
|
46
|
-
await mockCm.start()
|
|
47
|
-
const discoveryLayerNode = new DhtNode({
|
|
48
|
-
transport: mockCm,
|
|
49
|
-
connectionsView: mockCm,
|
|
50
|
-
peerDescriptor: localPeerDescriptor,
|
|
51
|
-
numberOfNodesPerKBucket: 4,
|
|
52
|
-
entryPoints: [entryPointDescriptor],
|
|
53
|
-
rpcRequestTimeout: 5000,
|
|
54
|
-
neighborPingLimit: 16
|
|
55
|
-
})
|
|
56
|
-
const contentDeliveryLayerNode = createContentDeliveryLayerNode({
|
|
57
|
-
streamPartId,
|
|
58
|
-
transport: mockCm,
|
|
59
|
-
discoveryLayerNode,
|
|
60
|
-
connectionLocker: mockCm,
|
|
61
|
-
localPeerDescriptor,
|
|
62
|
-
rpcRequestTimeout: 5000,
|
|
63
|
-
isLocalNodeEntryPoint: () => false
|
|
64
|
-
})
|
|
65
|
-
return [discoveryLayerNode, contentDeliveryLayerNode]
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export const createStreamMessage = (
|
|
69
|
-
content: string,
|
|
70
|
-
streamPartId: StreamPartID,
|
|
71
|
-
publisherId: UserID,
|
|
72
|
-
timestamp?: number,
|
|
73
|
-
sequenceNumber?: number
|
|
74
|
-
): StreamMessage => {
|
|
75
|
-
const messageId: MessageID = {
|
|
76
|
-
streamId: StreamPartIDUtils.getStreamID(streamPartId),
|
|
77
|
-
streamPartition: StreamPartIDUtils.getStreamPartition(streamPartId),
|
|
78
|
-
sequenceNumber: sequenceNumber ?? 0,
|
|
79
|
-
timestamp: timestamp ?? Date.now(),
|
|
80
|
-
publisherId: toUserIdRaw(publisherId),
|
|
81
|
-
messageChainId: 'messageChain0',
|
|
82
|
-
}
|
|
83
|
-
const msg: StreamMessage = {
|
|
84
|
-
messageId,
|
|
85
|
-
signatureType: SignatureType.SECP256K1,
|
|
86
|
-
signature: hexToBinary('0x1234'),
|
|
87
|
-
body: {
|
|
88
|
-
oneofKind: 'contentMessage',
|
|
89
|
-
contentMessage: {
|
|
90
|
-
encryptionType: EncryptionType.NONE,
|
|
91
|
-
contentType: ContentType.JSON,
|
|
92
|
-
content: utf8ToBinary(content)
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return msg
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export const createMockPeerDescriptor = (opts?: Omit<Partial<PeerDescriptor>, 'nodeId' | 'type'>): PeerDescriptor => {
|
|
100
|
-
return {
|
|
101
|
-
...opts,
|
|
102
|
-
nodeId: toDhtAddressRaw(randomDhtAddress()),
|
|
103
|
-
type: NodeType.NODEJS,
|
|
104
|
-
region: getRandomRegion()
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export const createMockContentDeliveryRpcRemote = (remotePeerDescriptor?: PeerDescriptor): ContentDeliveryRpcRemote => {
|
|
109
|
-
return new ContentDeliveryRpcRemote(
|
|
110
|
-
createMockPeerDescriptor(),
|
|
111
|
-
remotePeerDescriptor ?? createMockPeerDescriptor(),
|
|
112
|
-
new RpcCommunicator(),
|
|
113
|
-
ContentDeliveryRpcClient
|
|
114
|
-
)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export const createMockHandshakeRpcRemote = (): HandshakeRpcRemote => {
|
|
118
|
-
return new HandshakeRpcRemote(
|
|
119
|
-
createMockPeerDescriptor(),
|
|
120
|
-
createMockPeerDescriptor(),
|
|
121
|
-
new RpcCommunicator(),
|
|
122
|
-
HandshakeRpcClient
|
|
123
|
-
)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export const createNetworkNodeWithSimulator = async (
|
|
127
|
-
peerDescriptor: PeerDescriptor,
|
|
128
|
-
simulator: Simulator,
|
|
129
|
-
entryPoints: PeerDescriptor[]
|
|
130
|
-
): Promise<NetworkNode> => {
|
|
131
|
-
const transport = new SimulatorTransport(peerDescriptor, simulator)
|
|
132
|
-
await transport.start()
|
|
133
|
-
return createNetworkNode({
|
|
134
|
-
layer0: {
|
|
135
|
-
peerDescriptor,
|
|
136
|
-
entryPoints,
|
|
137
|
-
transport,
|
|
138
|
-
connectionsView: transport,
|
|
139
|
-
maxConnections: 25,
|
|
140
|
-
storeHighestTtl: 120000,
|
|
141
|
-
storeMaxTtl: 120000
|
|
142
|
-
}
|
|
143
|
-
})
|
|
144
|
-
}
|
package/tsconfig.browser.json
DELETED
package/tsconfig.jest.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.jest.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"noEmit": true,
|
|
5
|
-
"noImplicitOverride": false
|
|
6
|
-
},
|
|
7
|
-
"include": [
|
|
8
|
-
"src/**/*",
|
|
9
|
-
"generated/**/*",
|
|
10
|
-
"test/**/*",
|
|
11
|
-
"package.json"
|
|
12
|
-
],
|
|
13
|
-
"references": [
|
|
14
|
-
{ "path": "../proto-rpc/tsconfig.node.json" },
|
|
15
|
-
{ "path": "../dht/tsconfig.node.json" }
|
|
16
|
-
]
|
|
17
|
-
}
|
package/tsconfig.json
DELETED
package/tsconfig.node.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.node.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "dist",
|
|
5
|
-
"noImplicitOverride": false
|
|
6
|
-
},
|
|
7
|
-
"include": [
|
|
8
|
-
"src/**/*",
|
|
9
|
-
"generated/**/*",
|
|
10
|
-
"test/benchmark/first-message.ts",
|
|
11
|
-
"test/utils/utils.ts",
|
|
12
|
-
"package.json"
|
|
13
|
-
],
|
|
14
|
-
"references": [
|
|
15
|
-
{ "path": "../dht/tsconfig.node.json" }
|
|
16
|
-
]
|
|
17
|
-
}
|