@streamr/dht 101.1.2 → 102.0.0-beta.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 +17 -18
- package/dist/src/connection/Connection.d.ts +1 -1
- package/dist/src/connection/ConnectionLockRpcLocal.d.ts +5 -3
- package/dist/src/connection/ConnectionLockRpcLocal.js +9 -3
- package/dist/src/connection/ConnectionLockRpcLocal.js.map +1 -1
- package/dist/src/connection/ConnectionLockRpcRemote.d.ts +3 -2
- package/dist/src/connection/ConnectionLockRpcRemote.js +14 -3
- package/dist/src/connection/ConnectionLockRpcRemote.js.map +1 -1
- package/dist/src/connection/ConnectionLockStates.d.ts +5 -0
- package/dist/src/connection/ConnectionLockStates.js +14 -0
- package/dist/src/connection/ConnectionLockStates.js.map +1 -1
- package/dist/src/connection/ConnectionManager.d.ts +8 -1
- package/dist/src/connection/ConnectionManager.js +96 -32
- package/dist/src/connection/ConnectionManager.js.map +1 -1
- package/dist/src/connection/ConnectionsView.d.ts +1 -1
- package/dist/src/connection/ConnectorFacade.d.ts +1 -1
- package/dist/src/connection/Handshaker.d.ts +2 -2
- package/dist/src/connection/Handshaker.js +11 -7
- package/dist/src/connection/Handshaker.js.map +1 -1
- package/dist/src/connection/ManagedConnection.d.ts +7 -1
- package/dist/src/connection/ManagedConnection.js +41 -8
- package/dist/src/connection/ManagedConnection.js.map +1 -1
- package/dist/src/connection/PendingConnection.d.ts +1 -1
- package/dist/src/connection/connectivityChecker.d.ts +1 -1
- package/dist/src/connection/connectivityChecker.js +22 -11
- package/dist/src/connection/connectivityChecker.js.map +1 -1
- package/dist/src/connection/connectivityRequestHandler.js +4 -4
- package/dist/src/connection/connectivityRequestHandler.js.map +1 -1
- package/dist/src/connection/simulator/Simulator.d.ts +1 -1
- package/dist/src/connection/simulator/Simulator.js +5 -4
- package/dist/src/connection/simulator/Simulator.js.map +1 -1
- package/dist/src/connection/simulator/SimulatorConnection.d.ts +1 -1
- package/dist/src/connection/simulator/SimulatorConnection.js +9 -9
- package/dist/src/connection/simulator/SimulatorConnection.js.map +1 -1
- package/dist/src/connection/simulator/SimulatorConnector.d.ts +1 -1
- package/dist/src/connection/simulator/SimulatorConnector.js +4 -4
- package/dist/src/connection/simulator/SimulatorConnector.js.map +1 -1
- package/dist/src/connection/simulator/SimulatorTransport.d.ts +1 -1
- package/dist/src/connection/simulator/SimulatorTransport.js +2 -1
- package/dist/src/connection/simulator/SimulatorTransport.js.map +1 -1
- package/dist/src/connection/simulator/pings.d.ts +1 -1
- package/dist/src/connection/simulator/pings.js +3 -3
- package/dist/src/connection/simulator/pings.js.map +1 -1
- package/dist/src/connection/webrtc/NodeWebrtcConnection.d.ts +2 -1
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js +13 -8
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnector.d.ts +2 -1
- package/dist/src/connection/webrtc/WebrtcConnector.js +28 -17
- package/dist/src/connection/webrtc/WebrtcConnector.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.d.ts +3 -3
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js +4 -4
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.d.ts +1 -1
- package/dist/src/connection/webrtc/iceServerAsString.js +1 -2
- package/dist/src/connection/webrtc/iceServerAsString.js.map +1 -1
- package/dist/src/connection/websocket/AbstractWebsocketClientConnection.d.ts +0 -1
- package/dist/src/connection/websocket/WebsocketClientConnector.d.ts +1 -1
- package/dist/src/connection/websocket/WebsocketClientConnector.js +3 -3
- package/dist/src/connection/websocket/WebsocketClientConnector.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcLocal.d.ts +3 -4
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcLocal.js +1 -1
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcLocal.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcRemote.d.ts +1 -1
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcRemote.js +1 -1
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcRemote.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketServerConnection.d.ts +0 -1
- package/dist/src/connection/websocket/WebsocketServerConnector.d.ts +1 -1
- package/dist/src/connection/websocket/WebsocketServerConnector.js +34 -24
- package/dist/src/connection/websocket/WebsocketServerConnector.js.map +1 -1
- package/dist/src/dht/DhtNode.d.ts +5 -2
- package/dist/src/dht/DhtNode.js +20 -8
- package/dist/src/dht/DhtNode.js.map +1 -1
- package/dist/src/dht/DhtNodeRpcLocal.d.ts +4 -4
- package/dist/src/dht/DhtNodeRpcLocal.js +3 -3
- package/dist/src/dht/DhtNodeRpcLocal.js.map +1 -1
- package/dist/src/dht/DhtNodeRpcRemote.d.ts +2 -2
- package/dist/src/dht/DhtNodeRpcRemote.js +3 -3
- package/dist/src/dht/DhtNodeRpcRemote.js.map +1 -1
- package/dist/src/dht/ExternalApiRpcLocal.d.ts +3 -3
- package/dist/src/dht/ExternalApiRpcLocal.js +3 -3
- package/dist/src/dht/ExternalApiRpcLocal.js.map +1 -1
- package/dist/src/dht/ExternalApiRpcRemote.d.ts +3 -3
- package/dist/src/dht/ExternalApiRpcRemote.js +2 -2
- package/dist/src/dht/ExternalApiRpcRemote.js.map +1 -1
- package/dist/src/dht/PeerManager.d.ts +3 -2
- package/dist/src/dht/PeerManager.js +12 -11
- package/dist/src/dht/PeerManager.js.map +1 -1
- package/dist/src/dht/contact/Contact.d.ts +1 -1
- package/dist/src/dht/contact/Contact.js +1 -1
- package/dist/src/dht/contact/Contact.js.map +1 -1
- package/dist/src/dht/contact/RingContactList.d.ts +1 -1
- package/dist/src/dht/contact/RingContactList.js +1 -1
- package/dist/src/dht/contact/RingContactList.js.map +1 -1
- package/dist/src/dht/contact/RpcRemote.d.ts +1 -1
- package/dist/src/dht/contact/SortedContactList.js +2 -2
- package/dist/src/dht/contact/SortedContactList.js.map +1 -1
- package/dist/src/dht/contact/ringIdentifiers.d.ts +1 -1
- package/dist/src/dht/discovery/DiscoverySession.d.ts +1 -2
- package/dist/src/dht/discovery/DiscoverySession.js +3 -3
- package/dist/src/dht/discovery/DiscoverySession.js.map +1 -1
- package/dist/src/dht/discovery/PeerDiscovery.d.ts +1 -2
- package/dist/src/dht/discovery/PeerDiscovery.js +7 -7
- package/dist/src/dht/discovery/PeerDiscovery.js.map +1 -1
- package/dist/src/dht/discovery/RingDiscoverySession.d.ts +0 -1
- package/dist/src/dht/discovery/RingDiscoverySession.js +1 -1
- package/dist/src/dht/discovery/RingDiscoverySession.js.map +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.d.ts +3 -3
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js +8 -8
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js.map +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.d.ts +2 -2
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js +2 -2
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js.map +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.d.ts +2 -2
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js +3 -3
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js.map +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.d.ts +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js +7 -7
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js.map +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.d.ts +3 -3
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js.map +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.d.ts +2 -2
- package/dist/src/dht/routing/DuplicateDetector.js.map +1 -1
- package/dist/src/dht/routing/Router.d.ts +4 -1
- package/dist/src/dht/routing/Router.js +17 -9
- package/dist/src/dht/routing/Router.js.map +1 -1
- package/dist/src/dht/routing/RouterRpcLocal.d.ts +2 -2
- package/dist/src/dht/routing/RouterRpcLocal.js +5 -5
- package/dist/src/dht/routing/RouterRpcLocal.js.map +1 -1
- package/dist/src/dht/routing/RouterRpcRemote.d.ts +2 -2
- package/dist/src/dht/routing/RouterRpcRemote.js +7 -7
- package/dist/src/dht/routing/RouterRpcRemote.js.map +1 -1
- package/dist/src/dht/routing/RoutingSession.d.ts +1 -1
- package/dist/src/dht/routing/RoutingSession.js +7 -8
- package/dist/src/dht/routing/RoutingSession.js.map +1 -1
- package/dist/src/dht/routing/RoutingTablesCache.d.ts +1 -1
- package/dist/src/dht/routing/getPreviousPeer.d.ts +1 -1
- package/dist/src/dht/store/LocalDataStore.d.ts +1 -1
- package/dist/src/dht/store/LocalDataStore.js +3 -3
- package/dist/src/dht/store/LocalDataStore.js.map +1 -1
- package/dist/src/dht/store/StoreManager.d.ts +3 -3
- package/dist/src/dht/store/StoreManager.js +8 -8
- package/dist/src/dht/store/StoreManager.js.map +1 -1
- package/dist/src/dht/store/StoreRpcLocal.d.ts +4 -4
- package/dist/src/dht/store/StoreRpcLocal.js +4 -4
- package/dist/src/dht/store/StoreRpcLocal.js.map +1 -1
- package/dist/src/dht/store/StoreRpcRemote.d.ts +3 -3
- package/dist/src/dht/store/StoreRpcRemote.js +7 -4
- package/dist/src/dht/store/StoreRpcRemote.js.map +1 -1
- package/dist/src/exports.d.ts +2 -2
- package/dist/src/exports.js +6 -6
- package/dist/src/exports.js.map +1 -1
- package/dist/src/helpers/AddressTools.js +2 -3
- package/dist/src/helpers/AddressTools.js.map +1 -1
- package/dist/src/helpers/Connectivity.d.ts +1 -1
- package/dist/src/helpers/Connectivity.js +1 -1
- package/dist/src/helpers/Connectivity.js.map +1 -1
- package/dist/src/helpers/createPeerDescriptor.d.ts +1 -1
- package/dist/src/helpers/createPeerDescriptor.js +2 -2
- package/dist/src/helpers/createPeerDescriptor.js.map +1 -1
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.d.ts +1 -1
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.js +1 -1
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.js.map +1 -1
- package/dist/src/helpers/debugHelpers.js +2 -2
- package/dist/src/helpers/debugHelpers.js.map +1 -1
- package/dist/src/helpers/protoClasses.d.ts +1 -1
- package/dist/src/helpers/protoClasses.js +1 -1
- package/dist/src/helpers/protoClasses.js.map +1 -1
- package/dist/src/helpers/protoToString.js +1 -2
- package/dist/src/helpers/protoToString.js.map +1 -1
- package/dist/src/helpers/version.d.ts +1 -1
- package/dist/src/helpers/version.js +4 -4
- package/dist/src/helpers/version.js.map +1 -1
- package/dist/src/identifiers.d.ts +5 -5
- package/dist/src/identifiers.js +11 -11
- package/dist/src/identifiers.js.map +1 -1
- package/dist/src/rpc-protocol/DhtCallContext.d.ts +1 -1
- package/dist/src/rpc-protocol/DhtRpcOptions.d.ts +1 -1
- package/dist/src/transport/ITransport.d.ts +2 -1
- package/dist/src/transport/ListeningRpcCommunicator.d.ts +2 -1
- package/dist/src/transport/ListeningRpcCommunicator.js +13 -4
- package/dist/src/transport/ListeningRpcCommunicator.js.map +1 -1
- package/dist/src/transport/RoutingRpcCommunicator.d.ts +1 -1
- package/eslint.config.mjs +12 -0
- package/jest.config.ts +12 -0
- package/package.json +17 -18
- package/proto.sh +2 -3
- package/protos/DhtRpc.proto +11 -4
- package/src/connection/Connection.ts +1 -1
- package/src/connection/ConnectionLockRpcLocal.ts +16 -7
- package/src/connection/ConnectionLockRpcRemote.ts +18 -6
- package/src/connection/ConnectionLockStates.ts +18 -0
- package/src/connection/ConnectionManager.ts +93 -27
- package/src/connection/ConnectionsView.ts +1 -1
- package/src/connection/ConnectorFacade.ts +1 -1
- package/src/connection/Handshaker.ts +18 -14
- package/src/connection/ManagedConnection.ts +28 -3
- package/src/connection/PendingConnection.ts +1 -1
- package/src/connection/connectivityChecker.ts +6 -5
- package/src/connection/connectivityRequestHandler.ts +4 -4
- package/src/connection/simulator/Simulator.ts +8 -7
- package/src/connection/simulator/SimulatorConnection.ts +10 -10
- package/src/connection/simulator/SimulatorConnector.ts +5 -5
- package/src/connection/simulator/SimulatorTransport.ts +3 -2
- package/src/connection/simulator/pings.ts +1 -1
- package/src/connection/webrtc/BrowserWebrtcConnection.ts +10 -1
- package/src/connection/webrtc/NodeWebrtcConnection.ts +15 -11
- package/src/connection/webrtc/WebrtcConnector.ts +13 -11
- package/src/connection/webrtc/WebrtcConnectorRpcLocal.ts +8 -8
- package/src/connection/webrtc/WebrtcConnectorRpcRemote.ts +2 -2
- package/src/connection/websocket/WebsocketClientConnector.ts +5 -5
- package/src/connection/websocket/WebsocketClientConnectorRpcLocal.ts +5 -5
- package/src/connection/websocket/WebsocketClientConnectorRpcRemote.ts +4 -4
- package/src/connection/websocket/WebsocketServerConnector.ts +24 -20
- package/src/dht/DhtNode.ts +29 -11
- package/src/dht/DhtNodeRpcLocal.ts +8 -8
- package/src/dht/DhtNodeRpcRemote.ts +5 -5
- package/src/dht/ExternalApiRpcLocal.ts +8 -8
- package/src/dht/ExternalApiRpcRemote.ts +6 -6
- package/src/dht/PeerManager.ts +16 -14
- package/src/dht/contact/Contact.ts +3 -3
- package/src/dht/contact/RingContactList.ts +3 -3
- package/src/dht/contact/RpcRemote.ts +1 -1
- package/src/dht/contact/SortedContactList.ts +3 -3
- package/src/dht/contact/ringIdentifiers.ts +1 -1
- package/src/dht/discovery/DiscoverySession.ts +5 -5
- package/src/dht/discovery/PeerDiscovery.ts +12 -12
- package/src/dht/discovery/RingDiscoverySession.ts +3 -3
- package/src/dht/recursive-operation/RecursiveOperationManager.ts +10 -10
- package/src/dht/recursive-operation/RecursiveOperationRpcLocal.ts +4 -4
- package/src/dht/recursive-operation/RecursiveOperationRpcRemote.ts +6 -6
- package/src/dht/recursive-operation/RecursiveOperationSession.ts +8 -8
- package/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.ts +5 -5
- package/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.ts +2 -2
- package/src/dht/routing/DuplicateDetector.ts +1 -1
- package/src/dht/routing/Router.ts +19 -10
- package/src/dht/routing/RouterRpcLocal.ts +7 -7
- package/src/dht/routing/RouterRpcRemote.ts +9 -9
- package/src/dht/routing/RoutingSession.ts +9 -10
- package/src/dht/routing/RoutingTablesCache.ts +1 -1
- package/src/dht/routing/getPreviousPeer.ts +1 -1
- package/src/dht/store/LocalDataStore.ts +5 -5
- package/src/dht/store/StoreManager.ts +13 -13
- package/src/dht/store/StoreRpcLocal.ts +9 -9
- package/src/dht/store/StoreRpcRemote.ts +10 -7
- package/src/exports.ts +5 -5
- package/src/helpers/Connectivity.ts +1 -1
- package/src/helpers/createPeerDescriptor.ts +3 -3
- package/src/helpers/createPeerDescriptorSignaturePayload.ts +1 -1
- package/src/helpers/protoClasses.ts +2 -2
- package/src/helpers/version.ts +2 -2
- package/src/identifiers.ts +7 -7
- package/src/rpc-protocol/DhtCallContext.ts +1 -1
- package/src/rpc-protocol/DhtRpcOptions.ts +1 -1
- package/src/transport/ITransport.ts +2 -1
- package/src/transport/ListeningRpcCommunicator.ts +14 -6
- package/src/transport/RoutingRpcCommunicator.ts +2 -2
- package/test/benchmark/Find.test.ts +9 -9
- package/test/benchmark/KademliaCorrectness.test.ts +7 -7
- package/test/benchmark/RingCorrectness.test.ts +8 -8
- package/test/benchmark/SortedContactListBenchmark.test.ts +10 -10
- package/test/benchmark/hybrid-network-simulation/RingContactList.test.ts +3 -3
- package/test/end-to-end/Layer0Webrtc-Layer1.test.ts +6 -6
- package/test/end-to-end/Layer0Webrtc.test.ts +6 -6
- package/test/end-to-end/RecoveryFromFailedAutoCertification.test.ts +1 -1
- package/test/end-to-end/WebsocketConnectionRequest.test.ts +3 -3
- package/test/end-to-end/memory-leak.test.ts +6 -6
- package/test/integration/ConnectionLocking.test.ts +48 -37
- package/test/integration/ConnectionManager.test.ts +62 -6
- package/test/integration/ConnectivityChecking.test.ts +3 -2
- package/test/integration/DhtJoinPeerDiscovery.test.ts +2 -2
- package/test/integration/DhtNode.test.ts +6 -6
- package/test/integration/DhtNodeExternalAPI.test.ts +7 -7
- package/test/integration/DhtNodeRpcRemote.test.ts +9 -9
- package/test/integration/DhtRpc.test.ts +12 -13
- package/test/integration/Find.test.ts +5 -5
- package/test/integration/GeoIpConnectivityChecking.test.ts +8 -7
- package/test/integration/Layer1-scale.test.ts +3 -3
- package/test/integration/Mock-Layer1-Layer0.test.ts +6 -6
- package/test/integration/MultipleEntryPointJoining.test.ts +1 -1
- package/test/integration/ReplicateData.test.ts +10 -11
- package/test/integration/RouteMessage.test.ts +13 -13
- package/test/integration/RouterRpcRemote.test.ts +7 -7
- package/test/integration/SimultaneousConnections.test.ts +14 -13
- package/test/integration/Store.test.ts +9 -9
- package/test/integration/StoreAndDelete.test.ts +10 -10
- package/test/integration/StoreOnDhtWithThreeNodes.test.ts +10 -10
- package/test/integration/StoreOnDhtWithTwoNodes.test.ts +10 -10
- package/test/integration/StoreRpcRemote.test.ts +11 -11
- package/test/integration/WebrtcConnectionManagement.test.ts +4 -31
- package/test/integration/WebrtcConnectorRpc.test.ts +14 -14
- package/test/integration/Websocket.test.ts +0 -2
- package/test/integration/WebsocketClientConnectorRpc.test.ts +8 -8
- package/test/integration/WebsocketConnectionManagement.test.ts +11 -12
- package/test/integration/{rpc-connections-over-webrpc.test.ts → rpc-connections-over-webrtc.test.ts} +12 -46
- package/test/unit/AutoCertifierClientFacade.test.ts +6 -6
- package/test/unit/ConnectionManager.test.ts +4 -3
- package/test/unit/ConnectivityHelpers.test.ts +1 -1
- package/test/unit/DiscoverySession.test.ts +6 -6
- package/test/unit/Handshaker.test.ts +2 -2
- package/test/unit/ListeningRpcCommunicator.test.ts +52 -0
- package/test/unit/LocalDataStore.test.ts +21 -21
- package/test/unit/PeerManager.test.ts +15 -15
- package/test/unit/PendingConnection.test.ts +1 -1
- package/test/unit/ProtobufMessage.test.ts +1 -1
- package/test/unit/RandomContactList.test.ts +2 -2
- package/test/unit/RecursiveOperationManager.test.ts +3 -3
- package/test/unit/RecursiveOperationSession.test.ts +6 -6
- package/test/unit/Router.test.ts +6 -6
- package/test/unit/RoutingSession.test.ts +13 -6
- package/test/unit/SortedContactList.test.ts +8 -8
- package/test/unit/StoreManager.test.ts +12 -12
- package/test/unit/StoreRpcLocal.test.ts +9 -9
- package/test/unit/WebrtcConnection.test.ts +29 -0
- package/test/unit/WebsocketClientConnector.test.ts +1 -1
- package/test/unit/WebsocketServerConnector.test.ts +1 -1
- package/test/unit/connectivityRequestHandler.test.ts +6 -6
- package/test/unit/createPeerDescriptor.test.ts +4 -4
- package/test/unit/customMatchers.test.ts +18 -0
- package/test/unit/getClosestNodes.test.ts +5 -5
- package/test/unit/version.test.ts +9 -9
- package/test/utils/FakeConnectorFacade.ts +1 -1
- package/test/utils/FakeTransport.ts +12 -9
- package/test/utils/customMatchers.ts +9 -9
- package/test/utils/mock/MockConnectionsView.ts +1 -1
- package/test/utils/mock/MockRouter.ts +5 -1
- package/test/utils/mock/MockTransport.ts +6 -1
- package/test/utils/mock/mockDataEntry.ts +6 -6
- package/test/utils/topology.ts +3 -4
- package/test/utils/utils.ts +11 -11
- package/tsconfig.jest.json +2 -1
- package/tsconfig.node.json +1 -0
- package/.eslintignore +0 -5
- package/.eslintrc +0 -3
- package/dist/src/proto/google/protobuf/any.d.ts +0 -173
- package/dist/src/proto/google/protobuf/any.js +0 -155
- package/dist/src/proto/google/protobuf/any.js.map +0 -1
- package/dist/src/proto/google/protobuf/empty.d.ts +0 -32
- package/dist/src/proto/google/protobuf/empty.js +0 -32
- package/dist/src/proto/google/protobuf/empty.js.map +0 -1
- package/dist/src/proto/google/protobuf/timestamp.d.ts +0 -149
- package/dist/src/proto/google/protobuf/timestamp.js +0 -136
- package/dist/src/proto/google/protobuf/timestamp.js.map +0 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +0 -352
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +0 -278
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +0 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +0 -975
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +0 -661
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +0 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +0 -157
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.js +0 -3
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.js.map +0 -1
- package/dist/src/proto/packages/proto-rpc/protos/ProtoRpc.d.ts +0 -87
- package/dist/src/proto/packages/proto-rpc/protos/ProtoRpc.js +0 -66
- package/dist/src/proto/packages/proto-rpc/protos/ProtoRpc.js.map +0 -1
- package/dist/src/proto/tests.d.ts +0 -39
- package/dist/src/proto/tests.js +0 -34
- package/dist/src/proto/tests.js.map +0 -1
- package/jest.config.js +0 -5
- package/src/proto/google/protobuf/any.ts +0 -319
- package/src/proto/google/protobuf/empty.ts +0 -82
- package/src/proto/google/protobuf/timestamp.ts +0 -281
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +0 -407
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +0 -160
- package/src/proto/packages/dht/protos/DhtRpc.ts +0 -1244
- package/src/proto/packages/proto-rpc/protos/ProtoRpc.ts +0 -108
- package/src/proto/tests.ts +0 -52
- package/test/benchmark/any.test.ts +0 -28
- /package/{src/types/glogal.d.ts → test/types/global.d.ts} +0 -0
|
@@ -6,12 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.NodeWebrtcConnection = void 0;
|
|
7
7
|
const IConnection_1 = require("../IConnection");
|
|
8
8
|
const eventemitter3_1 = __importDefault(require("eventemitter3"));
|
|
9
|
-
// TODO: why does eslint import rule plugin not work?
|
|
10
|
-
// eslint-disable-next-line import/no-unresolved
|
|
11
9
|
const node_datachannel_1 = require("node-datachannel");
|
|
12
10
|
const utils_1 = require("@streamr/utils");
|
|
13
11
|
const errors_1 = require("../../helpers/errors");
|
|
14
12
|
const iceServerAsString_1 = require("./iceServerAsString");
|
|
13
|
+
const WebrtcConnector_1 = require("./WebrtcConnector");
|
|
15
14
|
const identifiers_1 = require("../../identifiers");
|
|
16
15
|
const Connection_1 = require("../Connection");
|
|
17
16
|
const logger = new utils_1.Logger(module);
|
|
@@ -42,6 +41,7 @@ class NodeWebrtcConnection extends eventemitter3_1.default {
|
|
|
42
41
|
maxMessageSize;
|
|
43
42
|
closed = false;
|
|
44
43
|
offering;
|
|
44
|
+
earlyTimeout;
|
|
45
45
|
constructor(params) {
|
|
46
46
|
super();
|
|
47
47
|
this.connectionId = (0, Connection_1.createRandomConnectionId)();
|
|
@@ -52,9 +52,12 @@ class NodeWebrtcConnection extends eventemitter3_1.default {
|
|
|
52
52
|
this.remotePeerDescriptor = params.remotePeerDescriptor;
|
|
53
53
|
this.maxMessageSize = params.maxMessageSize ?? 1048576;
|
|
54
54
|
this.portRange = params.portRange;
|
|
55
|
+
this.earlyTimeout = setTimeout(() => {
|
|
56
|
+
this.doClose(false, 'timed out due to remote descriptor not being set');
|
|
57
|
+
}, WebrtcConnector_1.EARLY_TIMEOUT);
|
|
55
58
|
}
|
|
56
59
|
start(isOffering) {
|
|
57
|
-
const nodeId = (0, identifiers_1.
|
|
60
|
+
const nodeId = (0, identifiers_1.toNodeId)(this.remotePeerDescriptor);
|
|
58
61
|
this.offering = isOffering;
|
|
59
62
|
logger.trace(`Starting new connection for peer ${nodeId}`, { isOffering });
|
|
60
63
|
this.connection = new node_datachannel_1.PeerConnection(nodeId, {
|
|
@@ -81,7 +84,8 @@ class NodeWebrtcConnection extends eventemitter3_1.default {
|
|
|
81
84
|
}
|
|
82
85
|
async setRemoteDescription(description, type) {
|
|
83
86
|
if (this.connection) {
|
|
84
|
-
|
|
87
|
+
clearTimeout(this.earlyTimeout);
|
|
88
|
+
const remoteNodeId = (0, identifiers_1.toNodeId)(this.remotePeerDescriptor);
|
|
85
89
|
try {
|
|
86
90
|
logger.trace(`Setting remote descriptor for peer: ${remoteNodeId}`);
|
|
87
91
|
this.connection.setRemoteDescription(description, type);
|
|
@@ -98,7 +102,7 @@ class NodeWebrtcConnection extends eventemitter3_1.default {
|
|
|
98
102
|
addRemoteCandidate(candidate, mid) {
|
|
99
103
|
if (this.connection) {
|
|
100
104
|
if (this.remoteDescriptionSet) {
|
|
101
|
-
const remoteNodeId = (0, identifiers_1.
|
|
105
|
+
const remoteNodeId = (0, identifiers_1.toNodeId)(this.remotePeerDescriptor);
|
|
102
106
|
try {
|
|
103
107
|
logger.trace(`Setting remote candidate for peer: ${remoteNodeId}`);
|
|
104
108
|
this.connection.addRemoteCandidate(candidate, mid);
|
|
@@ -122,7 +126,7 @@ class NodeWebrtcConnection extends eventemitter3_1.default {
|
|
|
122
126
|
this.dataChannel.sendMessageBinary(data);
|
|
123
127
|
}
|
|
124
128
|
catch (err) {
|
|
125
|
-
const remoteNodeId = (0, identifiers_1.
|
|
129
|
+
const remoteNodeId = (0, identifiers_1.toNodeId)(this.remotePeerDescriptor);
|
|
126
130
|
logger.debug('Failed to send binary message to ' + remoteNodeId + err);
|
|
127
131
|
}
|
|
128
132
|
}
|
|
@@ -132,7 +136,8 @@ class NodeWebrtcConnection extends eventemitter3_1.default {
|
|
|
132
136
|
}
|
|
133
137
|
doClose(gracefulLeave, reason) {
|
|
134
138
|
if (!this.closed) {
|
|
135
|
-
|
|
139
|
+
clearTimeout(this.earlyTimeout);
|
|
140
|
+
const remoteNodeId = (0, identifiers_1.toNodeId)(this.remotePeerDescriptor);
|
|
136
141
|
logger.trace(`Closing Node WebRTC Connection to ${remoteNodeId}` + `${(reason !== undefined) ? `, reason: ${reason}` : ''}`);
|
|
137
142
|
this.closed = true;
|
|
138
143
|
this.emit('disconnected', gracefulLeave, undefined, reason);
|
|
@@ -183,7 +188,7 @@ class NodeWebrtcConnection extends eventemitter3_1.default {
|
|
|
183
188
|
});
|
|
184
189
|
}
|
|
185
190
|
onDataChannelOpen() {
|
|
186
|
-
logger.trace(`DataChannel opened for peer ${(0, identifiers_1.
|
|
191
|
+
logger.trace(`DataChannel opened for peer ${(0, identifiers_1.toNodeId)(this.remotePeerDescriptor)}`);
|
|
187
192
|
this.emit('connected');
|
|
188
193
|
}
|
|
189
194
|
onStateChange(state) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeWebrtcConnection.js","sourceRoot":"","sources":["../../../../src/connection/webrtc/NodeWebrtcConnection.ts"],"names":[],"mappings":";;;;;;AACA,gDAA4F;AAE5F,kEAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"NodeWebrtcConnection.js","sourceRoot":"","sources":["../../../../src/connection/webrtc/NodeWebrtcConnection.ts"],"names":[],"mappings":";;;;;;AACA,gDAA4F;AAE5F,kEAAwC;AACxC,uDAA2F;AAC3F,0CAAuC;AACvC,iDAAoE;AACpE,2DAAuD;AACvD,uDAA4D;AAE5D,mDAA4C;AAC5C,8CAAwD;AAExD,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAWjC,sGAAsG;AACtG,2DAA2D;AAE3D,IAAK,0BAOJ;AAPD,WAAK,0BAA0B;IAC3B,+CAAiB,CAAA;IACjB,qDAAuB,CAAA;IACvB,uDAAyB,CAAA;IACzB,2DAA6B,CAAA;IAC7B,+CAAiB,CAAA;IACjB,yCAAW,CAAA;AACf,CAAC,EAPI,0BAA0B,KAA1B,0BAA0B,QAO9B;AAED,IAAA,6BAAU,EAAC,OAAO,CAAC,CAAA;AAMnB,MAAa,oBAAqB,SAAQ,uBAAoB;IAEnD,YAAY,CAAc;IACzB,UAAU,CAAiB;IAC3B,WAAW,CAAc;IACzB,SAAS,GAA2B,YAAY,CAAA;IAChD,oBAAoB,GAAG,K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C;IAEM,eAAe,CAAC,YAA0B;QAC7C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IACpC,CAAC;CACJ;AA1MD,oDA0MC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { PeerDescriptor } from '
|
|
1
|
+
import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc';
|
|
2
2
|
import { ITransport } from '../../transport/ITransport';
|
|
3
3
|
import { NodeWebrtcConnection } from './NodeWebrtcConnection';
|
|
4
4
|
import { PortRange } from '../ConnectionManager';
|
|
5
5
|
import { PendingConnection } from '../PendingConnection';
|
|
6
6
|
export declare const replaceInternalIpWithExternalIp: (candidate: string, ip: string) => string;
|
|
7
|
+
export declare const EARLY_TIMEOUT = 5000;
|
|
7
8
|
export interface WebrtcConnectorOptions {
|
|
8
9
|
onNewConnection: (connection: PendingConnection) => boolean;
|
|
9
10
|
transport: ITransport;
|
|
@@ -15,20 +15,30 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.WebrtcConnector = exports.replaceInternalIpWithExternalIp = void 0;
|
|
27
|
-
const DhtRpc_1 = require("
|
|
36
|
+
exports.WebrtcConnector = exports.EARLY_TIMEOUT = exports.replaceInternalIpWithExternalIp = void 0;
|
|
37
|
+
const DhtRpc_1 = require("../../../generated/packages/dht/protos/DhtRpc");
|
|
28
38
|
const ListeningRpcCommunicator_1 = require("../../transport/ListeningRpcCommunicator");
|
|
29
39
|
const NodeWebrtcConnection_1 = require("./NodeWebrtcConnection");
|
|
30
40
|
const WebrtcConnectorRpcRemote_1 = require("./WebrtcConnectorRpcRemote");
|
|
31
|
-
const DhtRpc_client_1 = require("
|
|
41
|
+
const DhtRpc_client_1 = require("../../../generated/packages/dht/protos/DhtRpc.client");
|
|
32
42
|
const utils_1 = require("@streamr/utils");
|
|
33
43
|
const Err = __importStar(require("../../helpers/errors"));
|
|
34
44
|
const WebrtcConnectorRpcLocal_1 = require("./WebrtcConnectorRpcLocal");
|
|
@@ -47,6 +57,7 @@ const replaceInternalIpWithExternalIp = (candidate, ip) => {
|
|
|
47
57
|
return parsed.join(' ');
|
|
48
58
|
};
|
|
49
59
|
exports.replaceInternalIpWithExternalIp = replaceInternalIpWithExternalIp;
|
|
60
|
+
exports.EARLY_TIMEOUT = 5000;
|
|
50
61
|
class WebrtcConnector {
|
|
51
62
|
static WEBRTC_CONNECTOR_SERVICE_ID = 'system/webrtc-connector';
|
|
52
63
|
rpcCommunicator;
|
|
@@ -107,15 +118,15 @@ class WebrtcConnector {
|
|
|
107
118
|
if ((0, identifiers_1.areEqualPeerDescriptors)(targetPeerDescriptor, this.localPeerDescriptor)) {
|
|
108
119
|
throw new Err.CannotConnectToSelf('Cannot open WebRTC Connection to self');
|
|
109
120
|
}
|
|
110
|
-
logger.trace(`Opening WebRTC connection to ${(0, identifiers_1.
|
|
111
|
-
const nodeId = (0, identifiers_1.
|
|
121
|
+
logger.trace(`Opening WebRTC connection to ${(0, identifiers_1.toNodeId)(targetPeerDescriptor)}`);
|
|
122
|
+
const nodeId = (0, identifiers_1.toNodeId)(targetPeerDescriptor);
|
|
112
123
|
const existingConnection = this.ongoingConnectAttempts.get(nodeId);
|
|
113
124
|
if (existingConnection) {
|
|
114
125
|
return existingConnection.managedConnection;
|
|
115
126
|
}
|
|
116
127
|
const connection = this.createConnection(targetPeerDescriptor);
|
|
117
|
-
const localNodeId = (0, identifiers_1.
|
|
118
|
-
const targetNodeId = (0, identifiers_1.
|
|
128
|
+
const localNodeId = (0, identifiers_1.toNodeId)(this.localPeerDescriptor);
|
|
129
|
+
const targetNodeId = (0, identifiers_1.toNodeId)(targetPeerDescriptor);
|
|
119
130
|
const offering = ((0, offering_1.getOfferer)(localNodeId, targetNodeId) === 'local');
|
|
120
131
|
let pendingConnection;
|
|
121
132
|
const remoteConnector = new WebrtcConnectorRpcRemote_1.WebrtcConnectorRpcRemote(this.localPeerDescriptor, targetPeerDescriptor, this.rpcCommunicator, DhtRpc_client_1.WebrtcConnectorRpcClient);
|
|
@@ -140,8 +151,8 @@ class WebrtcConnector {
|
|
|
140
151
|
remoteConnector.sendRtcAnswer(description, connection.connectionId);
|
|
141
152
|
});
|
|
142
153
|
handshaker.on('handshakeRequest', (_sourceDescriptor, remoteVersion) => {
|
|
143
|
-
if (!(0, version_1.
|
|
144
|
-
(0, Handshaker_1.rejectHandshake)(pendingConnection, connection, handshaker, DhtRpc_1.HandshakeError.
|
|
154
|
+
if (!(0, version_1.isMaybeSupportedProtocolVersion)(remoteVersion)) {
|
|
155
|
+
(0, Handshaker_1.rejectHandshake)(pendingConnection, connection, handshaker, DhtRpc_1.HandshakeError.UNSUPPORTED_PROTOCOL_VERSION);
|
|
145
156
|
}
|
|
146
157
|
else {
|
|
147
158
|
(0, Handshaker_1.acceptHandshake)(handshaker, pendingConnection, connection);
|
|
@@ -188,7 +199,7 @@ class WebrtcConnector {
|
|
|
188
199
|
const attempts = Array.from(this.ongoingConnectAttempts.values());
|
|
189
200
|
await Promise.allSettled(attempts.map(async (conn) => {
|
|
190
201
|
conn.connection.destroy();
|
|
191
|
-
|
|
202
|
+
conn.managedConnection.close(false);
|
|
192
203
|
}));
|
|
193
204
|
this.rpcCommunicator.destroy();
|
|
194
205
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebrtcConnector.js","sourceRoot":"","sources":["../../../../src/connection/webrtc/WebrtcConnector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebrtcConnector.js","sourceRoot":"","sources":["../../../../src/connection/webrtc/WebrtcConnector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0EAMsD;AAEtD,uFAAmF;AACnF,iEAA6D;AAC7D,yEAAqE;AACrE,wFAA+F;AAC/F,0CAAuC;AACvC,0DAA2C;AAG3C,uEAAmE;AACnE,mDAAiF;AACjF,qDAAmD;AACnD,8CAAoH;AACpH,mDAAuE;AACvE,4DAAwD;AAExD,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAE1B,MAAM,+BAA+B,GAAG,CAAC,SAAiB,EAAE,EAAU,EAAU,EAAE;IACrF,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACnC,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;IACtB,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QAClB,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;IAClB,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC3B,CAAC,CAAA;AAPY,QAAA,+BAA+B,mCAO3C;AAEY,QAAA,aAAa,GAAG,IAAI,CAAA;AA2BjC,MAAa,eAAe;IAEhB,MAAM,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IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QAEnB,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,MAAM,EAAE,CAAC,CAAA;QACjE,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACjD,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAA;YACzB,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACvC,CAAC,CAAC,CAAC,CAAA;QAEH,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAA;IAClC,CAAC;;AA3KL,0CA4KC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ServerCallContext } from '@protobuf-ts/runtime-rpc';
|
|
2
|
-
import { Empty } from '
|
|
3
|
-
import { IceCandidate, PeerDescriptor, RtcAnswer, RtcOffer } from '
|
|
4
|
-
import { IWebrtcConnectorRpc } from '
|
|
2
|
+
import { Empty } from '../../../generated/google/protobuf/empty';
|
|
3
|
+
import { IceCandidate, PeerDescriptor, RtcAnswer, RtcOffer } from '../../../generated/packages/dht/protos/DhtRpc';
|
|
4
|
+
import { IWebrtcConnectorRpc } from '../../../generated/packages/dht/protos/DhtRpc.server';
|
|
5
5
|
import { ListeningRpcCommunicator } from '../../transport/ListeningRpcCommunicator';
|
|
6
6
|
import { DhtAddress } from '../../identifiers';
|
|
7
7
|
import { ConnectingConnection } from './WebrtcConnector';
|
|
@@ -12,7 +12,7 @@ class WebrtcConnectorRpcLocal {
|
|
|
12
12
|
}
|
|
13
13
|
async requestConnection(context) {
|
|
14
14
|
const targetPeerDescriptor = context.incomingSourceDescriptor;
|
|
15
|
-
if (this.options.ongoingConnectAttempts.has((0, identifiers_1.
|
|
15
|
+
if (this.options.ongoingConnectAttempts.has((0, identifiers_1.toNodeId)(targetPeerDescriptor))) {
|
|
16
16
|
return {};
|
|
17
17
|
}
|
|
18
18
|
const pendingConnection = this.options.connect(targetPeerDescriptor, false);
|
|
@@ -21,7 +21,7 @@ class WebrtcConnectorRpcLocal {
|
|
|
21
21
|
}
|
|
22
22
|
async rtcOffer(request, context) {
|
|
23
23
|
const remotePeerDescriptor = context.incomingSourceDescriptor;
|
|
24
|
-
const nodeId = (0, identifiers_1.
|
|
24
|
+
const nodeId = (0, identifiers_1.toNodeId)(remotePeerDescriptor);
|
|
25
25
|
let connection;
|
|
26
26
|
let pendingConnection;
|
|
27
27
|
if (!this.options.ongoingConnectAttempts.has(nodeId)) {
|
|
@@ -40,7 +40,7 @@ class WebrtcConnectorRpcLocal {
|
|
|
40
40
|
}
|
|
41
41
|
async rtcAnswer(request, context) {
|
|
42
42
|
const remotePeerDescriptor = context.incomingSourceDescriptor;
|
|
43
|
-
const nodeId = (0, identifiers_1.
|
|
43
|
+
const nodeId = (0, identifiers_1.toNodeId)(remotePeerDescriptor);
|
|
44
44
|
const connection = this.options.ongoingConnectAttempts.get(nodeId)?.connection;
|
|
45
45
|
if (!connection) {
|
|
46
46
|
return {};
|
|
@@ -54,7 +54,7 @@ class WebrtcConnectorRpcLocal {
|
|
|
54
54
|
}
|
|
55
55
|
async iceCandidate(request, context) {
|
|
56
56
|
const remotePeerDescriptor = context.incomingSourceDescriptor;
|
|
57
|
-
const nodeId = (0, identifiers_1.
|
|
57
|
+
const nodeId = (0, identifiers_1.toNodeId)(remotePeerDescriptor);
|
|
58
58
|
const connection = this.options.ongoingConnectAttempts.get(nodeId)?.connection;
|
|
59
59
|
if (!connection) {
|
|
60
60
|
return {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebrtcConnectorRpcLocal.js","sourceRoot":"","sources":["../../../../src/connection/webrtc/WebrtcConnectorRpcLocal.ts"],"names":[],"mappings":";;;AACA,0CAAuC;AACvC,6DAAsF;AAYtF,
|
|
1
|
+
{"version":3,"file":"WebrtcConnectorRpcLocal.js","sourceRoot":"","sources":["../../../../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AoB,CAAC,CAAA;QAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,UAAU,CAAA;QAC9E,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,OAAO,EAAE,CAAA;QACb,CAAC;aAAM,IAAI,UAAU,CAAC,YAAY,KAAK,OAAO,CAAC,YAAY,EAAE,CAAC;YAC1D,MAAM,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAA;YACtE,OAAO,EAAE,CAAA;QACb,CAAC;aAAM,IAAI,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YACvD,UAAU,CAAC,kBAAkB,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA;QACjE,CAAC;QACD,OAAO,EAAE,CAAA;IACb,CAAC;IAEO,qBAAqB,CAAC,SAAiB;QAC3C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;YACtC,MAAM,OAAO,GAAG,IAAA,yCAA0B,EAAC,SAAS,CAAC,CAAA;YACrD,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,IAAI,IAAA,4BAAa,EAAC,OAAO,CAAC,EAAE,CAAC;gBACpD,OAAO,KAAK,CAAA;YAChB,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAA;IACf,CAAC;CACJ;AA5ED,0DA4EC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RpcRemote } from '../../dht/contact/RpcRemote';
|
|
2
|
-
import { WebrtcConnectorRpcClient } from '
|
|
2
|
+
import { WebrtcConnectorRpcClient } from '../../../generated/packages/dht/protos/DhtRpc.client';
|
|
3
3
|
export declare class WebrtcConnectorRpcRemote extends RpcRemote<WebrtcConnectorRpcClient> {
|
|
4
4
|
requestConnection(): void;
|
|
5
5
|
sendRtcOffer(description: string, connectionId: string): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.iceServerAsString =
|
|
3
|
+
exports.iceServerAsString = iceServerAsString;
|
|
4
4
|
function iceServerAsString({ url, port, username, password, tcp }) {
|
|
5
5
|
const [protocol, hostname] = url.split(':');
|
|
6
6
|
if (hostname === undefined) {
|
|
@@ -14,5 +14,4 @@ function iceServerAsString({ url, port, username, password, tcp }) {
|
|
|
14
14
|
}
|
|
15
15
|
throw new Error(`username (${username}) and password (${password}) must be supplied together`);
|
|
16
16
|
}
|
|
17
|
-
exports.iceServerAsString = iceServerAsString;
|
|
18
17
|
//# sourceMappingURL=iceServerAsString.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iceServerAsString.js","sourceRoot":"","sources":["../../../../src/connection/webrtc/iceServerAsString.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"iceServerAsString.js","sourceRoot":"","sources":["../../../../src/connection/webrtc/iceServerAsString.ts"],"names":[],"mappings":";;AAEA,8CAYC;AAZD,SAAgB,iBAAiB,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAa;IAC/E,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC3C,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,EAAE,CAAC,CAAA;IACvD,CAAC;IACD,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACnD,OAAO,GAAG,QAAQ,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAA;IAC5C,CAAC;IACD,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACnD,OAAO,GAAG,QAAQ,IAAI,QAAQ,IAAI,QAAQ,IAAI,QAAQ,IAAI,IAAI,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;IAClH,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,aAAa,QAAQ,mBAAmB,QAAQ,6BAA6B,CAAC,CAAA;AAClG,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ListeningRpcCommunicator } from '../../transport/ListeningRpcCommunicator';
|
|
2
|
-
import { ConnectivityMethod, PeerDescriptor } from '
|
|
2
|
+
import { ConnectivityMethod, PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc';
|
|
3
3
|
import { DhtAddress } from '../../identifiers';
|
|
4
4
|
import { PendingConnection } from '../PendingConnection';
|
|
5
5
|
export type Action = 'connectivityRequest' | 'connectivityProbe';
|
|
@@ -4,7 +4,7 @@ exports.WebsocketClientConnector = exports.connectivityMethodToWebsocketUrl = vo
|
|
|
4
4
|
const NodeWebsocketClientConnection_1 = require("./NodeWebsocketClientConnection");
|
|
5
5
|
const IConnection_1 = require("../IConnection");
|
|
6
6
|
const WebsocketClientConnectorRpcLocal_1 = require("./WebsocketClientConnectorRpcLocal");
|
|
7
|
-
const DhtRpc_1 = require("
|
|
7
|
+
const DhtRpc_1 = require("../../../generated/packages/dht/protos/DhtRpc");
|
|
8
8
|
const Handshaker_1 = require("../Handshaker");
|
|
9
9
|
const Connectivity_1 = require("../../helpers/Connectivity");
|
|
10
10
|
const identifiers_1 = require("../../identifiers");
|
|
@@ -47,7 +47,7 @@ class WebsocketClientConnector {
|
|
|
47
47
|
return connectionType === IConnection_1.ConnectionType.WEBSOCKET_CLIENT;
|
|
48
48
|
}
|
|
49
49
|
connect(targetPeerDescriptor) {
|
|
50
|
-
const nodeId = (0, identifiers_1.
|
|
50
|
+
const nodeId = (0, identifiers_1.toNodeId)(targetPeerDescriptor);
|
|
51
51
|
const existingConnection = this.connectingConnections.get(nodeId);
|
|
52
52
|
if (existingConnection) {
|
|
53
53
|
return existingConnection;
|
|
@@ -79,7 +79,7 @@ class WebsocketClientConnector {
|
|
|
79
79
|
const requests = Array.from(this.connectingConnections.values());
|
|
80
80
|
await Promise.allSettled(requests.map((conn) => conn.close(true)));
|
|
81
81
|
await this.websocketServer?.stop();
|
|
82
|
-
|
|
82
|
+
this.geoIpLocator?.stop();
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
exports.WebsocketClientConnector = WebsocketClientConnector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebsocketClientConnector.js","sourceRoot":"","sources":["../../../../src/connection/websocket/WebsocketClientConnector.ts"],"names":[],"mappings":";;;AAAA,mFAA2E;AAC3E,gDAA+C;AAE/C,yFAAqF;AACrF,
|
|
1
|
+
{"version":3,"file":"WebsocketClientConnector.js","sourceRoot":"","sources":["../../../../src/connection/websocket/WebsocketClientConnector.ts"],"names":[],"mappings":";;;AAAA,mFAA2E;AAC3E,gDAA+C;AAE/C,yFAAqF;AACrF,0EAIsD;AAEtD,8CAAwD;AAExD,6DAAmE;AAEnE,mDAAwD;AAExD,4DAAwD;AAIjD,MAAM,gCAAgC,GAAG,CAAC,EAAsB,EAAE,MAAe,EAAU,EAAE;IAChG,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AACxH,CAAC,CAAA;AAFY,QAAA,gCAAgC,oCAE5C;AAQD,MAAa,wBAAwB;IAE1B,MAAM,CAAU,8BAA8B,GAAG,4BAA4B,CAAA;IACnE,eAAe,CAAkB;IAC1C,YAAY,CAAe;IAE3B,mBAAmB,CAAiB;IACpC,q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MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QAE1B,OAAO,iBAAiB,CAAA;IAC5B,CAAC;IAEM,sBAAsB,CAAC,cAA8B;QACxD,IAAI,CAAC,mBAAmB,GAAG,cAAc,CAAA;IAC7C,CAAC;IAEM,KAAK,CAAC,OAAO;QAChB,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAA;QAE5B,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,CAAC,CAAA;QAChE,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAElE,MAAM,IAAI,CAAC,eAAe,EAAE,IAAI,EAAE,CAAA;QAClC,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,CAAA;IAC7B,CAAC;;AAvFL,4DAwFC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { ServerCallContext } from '@protobuf-ts/runtime-rpc';
|
|
3
|
-
import { PeerDescriptor, WebsocketConnectionRequest } from '
|
|
4
|
-
import { IWebsocketClientConnectorRpc } from '
|
|
5
|
-
import { Empty } from '
|
|
2
|
+
import { PeerDescriptor, WebsocketConnectionRequest } from '../../../generated/packages/dht/protos/DhtRpc';
|
|
3
|
+
import { IWebsocketClientConnectorRpc } from '../../../generated/packages/dht/protos/DhtRpc.server';
|
|
4
|
+
import { Empty } from '../../../generated/google/protobuf/empty';
|
|
6
5
|
import { DhtAddress } from '../../identifiers';
|
|
7
6
|
import { PendingConnection } from '../PendingConnection';
|
|
8
7
|
interface WebsocketClientConnectorRpcLocalOptions {
|
|
@@ -12,7 +12,7 @@ class WebsocketClientConnectorRpcLocal {
|
|
|
12
12
|
return {};
|
|
13
13
|
}
|
|
14
14
|
const senderPeerDescriptor = context.incomingSourceDescriptor;
|
|
15
|
-
if (!this.options.hasConnection((0, identifiers_1.
|
|
15
|
+
if (!this.options.hasConnection((0, identifiers_1.toNodeId)(senderPeerDescriptor))) {
|
|
16
16
|
const connection = this.options.connect(senderPeerDescriptor);
|
|
17
17
|
this.options.onNewConnection(connection);
|
|
18
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebsocketClientConnectorRpcLocal.js","sourceRoot":"","sources":["../../../../src/connection/websocket/WebsocketClientConnectorRpcLocal.ts"],"names":[],"mappings":";;;AAQA,
|
|
1
|
+
{"version":3,"file":"WebsocketClientConnectorRpcLocal.js","sourceRoot":"","sources":["../../../../src/connection/websocket/WebsocketClientConnectorRpcLocal.ts"],"names":[],"mappings":";;;AAQA,mDAAwD;AAUxD,MAAa,gCAAgC;IAExB,OAAO,CAAyC;IAEjE,YAAY,OAAgD;QACxD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IAC1B,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,QAAoC,EAAE,OAA0B;QAC3F,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YACnC,OAAO,EAAE,CAAA;QACb,CAAC;QACD,MAAM,oBAAoB,GAAI,OAA0B,CAAC,wBAAyB,CAAA;QAClF,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAA,sBAAQ,EAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC;YAC9D,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAA;YAC7D,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAA;QAC5C,CAAC;QACD,OAAO,EAAE,CAAA;IACb,CAAC;CACJ;AAnBD,4EAmBC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RpcRemote } from '../../dht/contact/RpcRemote';
|
|
2
|
-
import { WebsocketClientConnectorRpcClient } from '
|
|
2
|
+
import { WebsocketClientConnectorRpcClient } from '../../../generated/packages/dht/protos/DhtRpc.client';
|
|
3
3
|
export declare class WebsocketClientConnectorRpcRemote extends RpcRemote<WebsocketClientConnectorRpcClient> {
|
|
4
4
|
requestConnection(): Promise<void>;
|
|
5
5
|
}
|
|
@@ -7,7 +7,7 @@ const identifiers_1 = require("../../identifiers");
|
|
|
7
7
|
const logger = new utils_1.Logger(module);
|
|
8
8
|
class WebsocketClientConnectorRpcRemote extends RpcRemote_1.RpcRemote {
|
|
9
9
|
async requestConnection() {
|
|
10
|
-
logger.trace(`Requesting WebSocket connection from ${(0, identifiers_1.
|
|
10
|
+
logger.trace(`Requesting WebSocket connection from ${(0, identifiers_1.toNodeId)(this.getLocalPeerDescriptor())}`);
|
|
11
11
|
const request = {};
|
|
12
12
|
const options = this.formDhtRpcOptions();
|
|
13
13
|
return this.getClient().requestConnection(request, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebsocketClientConnectorRpcRemote.js","sourceRoot":"","sources":["../../../../src/connection/websocket/WebsocketClientConnectorRpcRemote.ts"],"names":[],"mappings":";;;AAGA,0CAAuC;AACvC,2DAAuD;AAEvD,
|
|
1
|
+
{"version":3,"file":"WebsocketClientConnectorRpcRemote.js","sourceRoot":"","sources":["../../../../src/connection/websocket/WebsocketClientConnectorRpcRemote.ts"],"names":[],"mappings":";;;AAGA,0CAAuC;AACvC,2DAAuD;AAEvD,mDAA4C;AAE5C,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAEjC,MAAa,iCAAkC,SAAQ,qBAA4C;IAE/F,KAAK,CAAC,iBAAiB;QACnB,MAAM,CAAC,KAAK,CAAC,wCAAwC,IAAA,sBAAQ,EAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,EAAE,CAAC,CAAA;QAC/F,MAAM,OAAO,GAA+B,EAAE,CAAA;QAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;QACxC,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC/D,CAAC;CACJ;AARD,8EAQC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ListeningRpcCommunicator } from '../../transport/ListeningRpcCommunicator';
|
|
2
2
|
import { DhtAddress } from '../../identifiers';
|
|
3
|
-
import { ConnectivityResponse, PeerDescriptor } from '
|
|
3
|
+
import { ConnectivityResponse, PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc';
|
|
4
4
|
import { PortRange, TlsCertificate } from '../ConnectionManager';
|
|
5
5
|
import { ITransport } from '../../transport/ITransport';
|
|
6
6
|
import { PendingConnection } from '../PendingConnection';
|