@streamr/dht 0.0.1-tatum.1 → 0.0.1-tatum.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/src/connection/ConnectionManager.d.ts +6 -1
- package/dist/src/connection/ConnectionManager.js +21 -26
- package/dist/src/connection/ConnectionManager.js.map +1 -1
- package/dist/src/connection/ConnectivityChecker.d.ts +4 -2
- package/dist/src/connection/ConnectivityChecker.js +23 -19
- package/dist/src/connection/ConnectivityChecker.js.map +1 -1
- package/dist/src/connection/ManagedConnection.js +2 -6
- package/dist/src/connection/ManagedConnection.js.map +1 -1
- package/dist/src/connection/Simulator/SimulatorTransport.js +1 -1
- package/dist/src/connection/Simulator/SimulatorTransport.js.map +1 -1
- package/dist/src/connection/WebRTC/WebRtcConnector.d.ts +2 -0
- package/dist/src/connection/WebRTC/WebRtcConnector.js +14 -1
- package/dist/src/connection/WebRTC/WebRtcConnector.js.map +1 -1
- package/dist/src/connection/WebSocket/WebSocketConnector.d.ts +5 -3
- package/dist/src/connection/WebSocket/WebSocketConnector.js +19 -12
- package/dist/src/connection/WebSocket/WebSocketConnector.js.map +1 -1
- package/dist/src/connection/WebSocket/WebSocketServer.d.ts +2 -2
- package/dist/src/connection/WebSocket/WebSocketServer.js +29 -37
- package/dist/src/connection/WebSocket/WebSocketServer.js.map +1 -1
- package/dist/src/dht/DhtNode.d.ts +9 -6
- package/dist/src/dht/DhtNode.js +14 -21
- package/dist/src/dht/DhtNode.js.map +1 -1
- package/dist/src/dht/DhtPeer.js +1 -1
- package/dist/src/dht/discovery/PeerDiscovery.d.ts +4 -2
- package/dist/src/dht/discovery/PeerDiscovery.js +18 -33
- package/dist/src/dht/discovery/PeerDiscovery.js.map +1 -1
- package/dist/src/dht/routing/RemoteRouter.js +2 -4
- package/dist/src/dht/routing/RemoteRouter.js.map +1 -1
- package/dist/src/dht/store/DataStore.js +6 -6
- package/dist/src/exports.d.ts +1 -1
- package/dist/src/exports.js.map +1 -1
- package/dist/src/helpers/errors.d.ts +1 -1
- package/dist/src/helpers/errors.js +3 -3
- package/dist/src/helpers/errors.js.map +1 -1
- package/dist/src/helpers/protoClasses.js +0 -2
- package/dist/src/helpers/protoClasses.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +14 -50
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +9 -35
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/proto-rpc/protos/ProtoRpc.js +1 -1
- package/package.json +9 -9
- package/protos/DhtRpc.proto +7 -16
- package/src/connection/ConnectionManager.ts +31 -28
- package/src/connection/ConnectivityChecker.ts +28 -23
- package/src/connection/ManagedConnection.ts +2 -6
- package/src/connection/Simulator/SimulatorTransport.ts +1 -1
- package/src/connection/WebRTC/BrowserWebRtcConnection.ts +13 -2
- package/src/connection/WebRTC/WebRtcConnector.ts +14 -0
- package/src/connection/WebSocket/WebSocketConnector.ts +23 -12
- package/src/connection/WebSocket/WebSocketServer.ts +33 -20
- package/src/dht/DhtNode.ts +23 -24
- package/src/dht/DhtPeer.ts +1 -1
- package/src/dht/discovery/PeerDiscovery.ts +17 -8
- package/src/dht/routing/RemoteRouter.ts +2 -4
- package/src/dht/store/DataStore.ts +6 -6
- package/src/exports.ts +1 -1
- package/src/helpers/errors.ts +1 -1
- package/src/helpers/protoClasses.ts +1 -5
- package/src/proto/google/protobuf/any.ts +1 -1
- package/src/proto/google/protobuf/empty.ts +1 -1
- package/src/proto/google/protobuf/timestamp.ts +1 -1
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +1 -1
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +1 -1
- package/src/proto/packages/dht/protos/DhtRpc.ts +22 -69
- package/src/proto/packages/proto-rpc/protos/ProtoRpc.ts +1 -1
- package/test/benchmark/KademliaCorrectness.test.ts +1 -1
- package/test/benchmark/RecursiveFind.test.ts +1 -1
- package/test/end-to-end/Layer0-Layer1.test.ts +3 -3
- package/test/end-to-end/Layer0.test.ts +5 -5
- package/test/end-to-end/Layer0MixedConnectionTypes.test.ts +6 -6
- package/test/end-to-end/Layer0WebRTC-Layer1.test.ts +18 -19
- package/test/end-to-end/Layer0WebRTC.test.ts +18 -24
- package/test/end-to-end/Layer1-Scale-WebRTC.test.ts +2 -2
- package/test/end-to-end/Layer1-Scale-WebSocket.test.ts +2 -2
- package/test/end-to-end/WebSocketConnectionRequest.test.ts +3 -3
- package/test/integration/ConnectionManager.test.ts +10 -9
- package/test/integration/DhtRpc.test.ts +2 -2
- package/test/integration/MigrateData.test.ts +3 -3
- package/test/integration/RouteMessage.test.ts +2 -2
- package/test/integration/ScaleDownDht.test.ts +1 -1
- package/test/integration/SimultaneousConnections.test.ts +9 -6
- package/test/integration/WebRtcConnectionManagement.test.ts +2 -2
- package/test/integration/WebRtcConnectorRpc.test.ts +2 -2
- package/test/integration/WebSocketConnectionManagement.test.ts +3 -2
- package/test/integration/WebSocketConnectorRpc.test.ts +4 -4
- package/test/unit/WebSocketServer.test.ts +1 -8
- package/test/unit/webrtcReplaceInternalIpWithExternalIp.ts +18 -0
- package/test/utils/utils.ts +1 -2
|
@@ -35,10 +35,10 @@ describe('WebRTC Connection Management', () => {
|
|
|
35
35
|
simulator = new Simulator(LatencyType.FIXED, 500)
|
|
36
36
|
|
|
37
37
|
connectorTransport1 = new SimulatorTransport(peerDescriptor1, simulator)
|
|
38
|
-
manager1 = new ConnectionManager({ transportLayer: connectorTransport1
|
|
38
|
+
manager1 = new ConnectionManager({ transportLayer: connectorTransport1 })
|
|
39
39
|
|
|
40
40
|
connectorTransport2 = new SimulatorTransport(peerDescriptor2, simulator)
|
|
41
|
-
manager2 = new ConnectionManager({ transportLayer: connectorTransport2
|
|
41
|
+
manager2 = new ConnectionManager({ transportLayer: connectorTransport2 })
|
|
42
42
|
|
|
43
43
|
await manager1.start((_msg) => peerDescriptor1)
|
|
44
44
|
await manager2.start((_msg) => peerDescriptor2)
|
|
@@ -57,8 +57,8 @@ describe('WebSocketConnectorRpc', () => {
|
|
|
57
57
|
})
|
|
58
58
|
|
|
59
59
|
afterEach(async () => {
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
rpcCommunicator1.stop()
|
|
61
|
+
rpcCommunicator2.stop()
|
|
62
62
|
})
|
|
63
63
|
|
|
64
64
|
it('Happy path', async () => {
|
|
@@ -71,7 +71,7 @@ describe('WebSocketConnectorRpc', () => {
|
|
|
71
71
|
{ targetDescriptor: peerDescriptor2 },
|
|
72
72
|
)
|
|
73
73
|
const res1 = await response1
|
|
74
|
-
|
|
74
|
+
expect(res1.accepted).toEqual(true)
|
|
75
75
|
|
|
76
76
|
const response2 = client2.requestConnection({
|
|
77
77
|
requester: peerDescriptor2,
|
|
@@ -82,6 +82,6 @@ describe('WebSocketConnectorRpc', () => {
|
|
|
82
82
|
{ targetDescriptor: peerDescriptor1 },
|
|
83
83
|
)
|
|
84
84
|
const res2 = await response2
|
|
85
|
-
|
|
85
|
+
expect(res2.accepted).toEqual(true)
|
|
86
86
|
})
|
|
87
87
|
})
|
|
@@ -2,14 +2,7 @@ import { WebSocketServer } from '../../src/connection/WebSocket/WebSocketServer'
|
|
|
2
2
|
|
|
3
3
|
describe('WebSocketServer', () => {
|
|
4
4
|
|
|
5
|
-
it('starts and stops
|
|
6
|
-
const server = new WebSocketServer()
|
|
7
|
-
const port = await server.start({ min: 19792, max: 19792 }, '127.0.0.1')
|
|
8
|
-
expect(port).toEqual(19792)
|
|
9
|
-
await server.stop()
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
it('starts and stops if no host given', async () => {
|
|
5
|
+
it('starts and stops', async () => {
|
|
13
6
|
const server = new WebSocketServer()
|
|
14
7
|
const port = await server.start({ min: 19792, max: 19792 })
|
|
15
8
|
expect(port).toEqual(19792)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { replaceInternalIpWithExternalIp } from '../../src/connection/WebRTC/WebRtcConnector'
|
|
2
|
+
|
|
3
|
+
describe('replaceIpIfCandidateTypeIsHost', () => {
|
|
4
|
+
|
|
5
|
+
const hostCandidate = 'candidate:1 1 UDP 2013266431 127.0.0.1 30000 typ host'
|
|
6
|
+
const srflxCandidate = 'candidate:1 1 UDP 2013266431 127.0.0.1 30000 typ srflx'
|
|
7
|
+
|
|
8
|
+
it('replaces ip if candidate type is host', () => {
|
|
9
|
+
const replaced = replaceInternalIpWithExternalIp(hostCandidate, '0.0.0.0')
|
|
10
|
+
expect(replaced).toEqual('candidate:1 1 UDP 2013266431 0.0.0.0 30000 typ host')
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
it('does not replace candidate if type is not host', () => {
|
|
14
|
+
const replaced = replaceInternalIpWithExternalIp(srflxCandidate, '0.0.0.0')
|
|
15
|
+
expect(replaced).toEqual(srflxCandidate)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
})
|
package/test/utils/utils.ts
CHANGED
|
@@ -66,8 +66,7 @@ export const createMockConnectionDhtNode = async (stringId: string,
|
|
|
66
66
|
|
|
67
67
|
const mockConnectionManager = new ConnectionManager({
|
|
68
68
|
ownPeerDescriptor: peerDescriptor,
|
|
69
|
-
simulator: simulator
|
|
70
|
-
nodeName: nodeName ? nodeName : stringId
|
|
69
|
+
simulator: simulator
|
|
71
70
|
})
|
|
72
71
|
|
|
73
72
|
const node = new DhtNode({
|