@streamr/dht 103.1.2 → 103.2.0-experiment.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/exports-browser.cjs +7636 -0
- package/dist/exports-browser.cjs.map +1 -0
- package/dist/exports-browser.d.ts +1321 -0
- package/dist/exports-browser.js +7611 -0
- package/dist/exports-browser.js.map +1 -0
- package/dist/exports-nodejs.cjs +7833 -0
- package/dist/exports-nodejs.cjs.map +1 -0
- package/dist/exports-nodejs.d.ts +1321 -0
- package/dist/exports-nodejs.js +7808 -0
- package/dist/exports-nodejs.js.map +1 -0
- package/package.json +41 -25
- package/dist/generated/google/protobuf/any.d.ts +0 -180
- package/dist/generated/google/protobuf/any.js +0 -155
- package/dist/generated/google/protobuf/any.js.map +0 -1
- package/dist/generated/google/protobuf/empty.d.ts +0 -31
- package/dist/generated/google/protobuf/empty.js +0 -45
- package/dist/generated/google/protobuf/empty.js.map +0 -1
- package/dist/generated/google/protobuf/timestamp.d.ts +0 -156
- package/dist/generated/google/protobuf/timestamp.js +0 -136
- package/dist/generated/google/protobuf/timestamp.js.map +0 -1
- package/dist/generated/packages/dht/protos/DhtRpc.client.d.ts +0 -371
- package/dist/generated/packages/dht/protos/DhtRpc.client.js +0 -292
- package/dist/generated/packages/dht/protos/DhtRpc.client.js.map +0 -1
- package/dist/generated/packages/dht/protos/DhtRpc.d.ts +0 -1031
- package/dist/generated/packages/dht/protos/DhtRpc.js +0 -702
- package/dist/generated/packages/dht/protos/DhtRpc.js.map +0 -1
- package/dist/generated/packages/dht/protos/DhtRpc.server.d.ts +0 -168
- package/dist/generated/packages/dht/protos/DhtRpc.server.js +0 -3
- package/dist/generated/packages/dht/protos/DhtRpc.server.js.map +0 -1
- package/dist/generated/packages/proto-rpc/protos/ProtoRpc.d.ts +0 -87
- package/dist/generated/packages/proto-rpc/protos/ProtoRpc.js +0 -66
- package/dist/generated/packages/proto-rpc/protos/ProtoRpc.js.map +0 -1
- package/dist/package.json +0 -61
- package/dist/src/connection/Connection.d.ts +0 -12
- package/dist/src/connection/Connection.js +0 -30
- package/dist/src/connection/Connection.js.map +0 -1
- package/dist/src/connection/ConnectionLockRpcLocal.d.ts +0 -22
- package/dist/src/connection/ConnectionLockRpcLocal.js +0 -54
- package/dist/src/connection/ConnectionLockRpcLocal.js.map +0 -1
- package/dist/src/connection/ConnectionLockRpcRemote.d.ts +0 -10
- package/dist/src/connection/ConnectionLockRpcRemote.js +0 -61
- package/dist/src/connection/ConnectionLockRpcRemote.js.map +0 -1
- package/dist/src/connection/ConnectionLockStates.d.ts +0 -27
- package/dist/src/connection/ConnectionLockStates.js +0 -114
- package/dist/src/connection/ConnectionLockStates.js.map +0 -1
- package/dist/src/connection/ConnectionManager.d.ts +0 -85
- package/dist/src/connection/ConnectionManager.js +0 -569
- package/dist/src/connection/ConnectionManager.js.map +0 -1
- package/dist/src/connection/ConnectionsView.d.ts +0 -7
- package/dist/src/connection/ConnectionsView.js +0 -3
- package/dist/src/connection/ConnectionsView.js.map +0 -1
- package/dist/src/connection/ConnectorFacade.d.ts +0 -58
- package/dist/src/connection/ConnectorFacade.js +0 -154
- package/dist/src/connection/ConnectorFacade.js.map +0 -1
- package/dist/src/connection/Handshaker.d.ts +0 -27
- package/dist/src/connection/Handshaker.js +0 -179
- package/dist/src/connection/Handshaker.js.map +0 -1
- package/dist/src/connection/IConnection.d.ts +0 -32
- package/dist/src/connection/IConnection.js +0 -12
- package/dist/src/connection/IConnection.js.map +0 -1
- package/dist/src/connection/ManagedConnection.d.ts +0 -30
- package/dist/src/connection/ManagedConnection.js +0 -129
- package/dist/src/connection/ManagedConnection.js.map +0 -1
- package/dist/src/connection/OutputBuffer.d.ts +0 -9
- package/dist/src/connection/OutputBuffer.js +0 -26
- package/dist/src/connection/OutputBuffer.js.map +0 -1
- package/dist/src/connection/PendingConnection.d.ts +0 -19
- package/dist/src/connection/PendingConnection.js +0 -59
- package/dist/src/connection/PendingConnection.js.map +0 -1
- package/dist/src/connection/connectivityChecker.d.ts +0 -9
- package/dist/src/connection/connectivityChecker.js +0 -138
- package/dist/src/connection/connectivityChecker.js.map +0 -1
- package/dist/src/connection/connectivityRequestHandler.d.ts +0 -4
- package/dist/src/connection/connectivityRequestHandler.js +0 -108
- package/dist/src/connection/connectivityRequestHandler.js.map +0 -1
- package/dist/src/connection/simulator/Simulator.d.ts +0 -36
- package/dist/src/connection/simulator/Simulator.js +0 -290
- package/dist/src/connection/simulator/Simulator.js.map +0 -1
- package/dist/src/connection/simulator/SimulatorConnection.d.ts +0 -18
- package/dist/src/connection/simulator/SimulatorConnection.js +0 -123
- package/dist/src/connection/simulator/SimulatorConnection.js.map +0 -1
- package/dist/src/connection/simulator/SimulatorConnector.d.ts +0 -16
- package/dist/src/connection/simulator/SimulatorConnector.js +0 -80
- package/dist/src/connection/simulator/SimulatorConnector.js.map +0 -1
- package/dist/src/connection/simulator/SimulatorTransport.d.ts +0 -6
- package/dist/src/connection/simulator/SimulatorTransport.js +0 -17
- package/dist/src/connection/simulator/SimulatorTransport.js.map +0 -1
- package/dist/src/connection/simulator/pings.d.ts +0 -21
- package/dist/src/connection/simulator/pings.js +0 -61
- package/dist/src/connection/simulator/pings.js.map +0 -1
- package/dist/src/connection/webrtc/BrowserWebrtcConnection.d.ts +0 -37
- package/dist/src/connection/webrtc/BrowserWebrtcConnection.js +0 -229
- package/dist/src/connection/webrtc/BrowserWebrtcConnection.js.map +0 -1
- package/dist/src/connection/webrtc/IWebrtcConnection.d.ts +0 -21
- package/dist/src/connection/webrtc/IWebrtcConnection.js +0 -9
- package/dist/src/connection/webrtc/IWebrtcConnection.js.map +0 -1
- package/dist/src/connection/webrtc/NodeWebrtcConnection.d.ts +0 -45
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js +0 -229
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js.map +0 -1
- package/dist/src/connection/webrtc/WebrtcConnector.d.ts +0 -43
- package/dist/src/connection/webrtc/WebrtcConnector.js +0 -208
- package/dist/src/connection/webrtc/WebrtcConnector.js.map +0 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.d.ts +0 -26
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js +0 -82
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js.map +0 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.d.ts +0 -8
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js +0 -50
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js.map +0 -1
- package/dist/src/connection/webrtc/iceServerAsString.d.ts +0 -2
- package/dist/src/connection/webrtc/iceServerAsString.js +0 -17
- package/dist/src/connection/webrtc/iceServerAsString.js.map +0 -1
- package/dist/src/connection/websocket/AbstractWebsocketClientConnection.d.ts +0 -27
- package/dist/src/connection/websocket/AbstractWebsocketClientConnection.js +0 -107
- package/dist/src/connection/websocket/AbstractWebsocketClientConnection.js.map +0 -1
- package/dist/src/connection/websocket/AutoCertifierClientFacade.d.ts +0 -26
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js +0 -39
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js.map +0 -1
- package/dist/src/connection/websocket/BrowserWebsocketClientConnection.d.ts +0 -7
- package/dist/src/connection/websocket/BrowserWebsocketClientConnection.js +0 -44
- package/dist/src/connection/websocket/BrowserWebsocketClientConnection.js.map +0 -1
- package/dist/src/connection/websocket/NodeWebsocketClientConnection.d.ts +0 -7
- package/dist/src/connection/websocket/NodeWebsocketClientConnection.js +0 -39
- package/dist/src/connection/websocket/NodeWebsocketClientConnection.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketClientConnector.d.ts +0 -26
- package/dist/src/connection/websocket/WebsocketClientConnector.js +0 -86
- package/dist/src/connection/websocket/WebsocketClientConnector.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcLocal.d.ts +0 -18
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcLocal.js +0 -23
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcLocal.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcRemote.d.ts +0 -5
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcRemote.js +0 -17
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcRemote.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketServer.d.ts +0 -25
- package/dist/src/connection/websocket/WebsocketServer.js +0 -146
- package/dist/src/connection/websocket/WebsocketServer.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketServerConnection.d.ts +0 -22
- package/dist/src/connection/websocket/WebsocketServerConnection.js +0 -101
- package/dist/src/connection/websocket/WebsocketServerConnection.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketServerConnector.d.ts +0 -44
- package/dist/src/connection/websocket/WebsocketServerConnector.js +0 -279
- package/dist/src/connection/websocket/WebsocketServerConnector.js.map +0 -1
- package/dist/src/dht/DhtNode.d.ts +0 -119
- package/dist/src/dht/DhtNode.js +0 -500
- package/dist/src/dht/DhtNode.js.map +0 -1
- package/dist/src/dht/DhtNodeRpcLocal.d.ts +0 -23
- package/dist/src/dht/DhtNodeRpcLocal.js +0 -54
- package/dist/src/dht/DhtNodeRpcLocal.js.map +0 -1
- package/dist/src/dht/DhtNodeRpcRemote.d.ts +0 -25
- package/dist/src/dht/DhtNodeRpcRemote.js +0 -83
- package/dist/src/dht/DhtNodeRpcRemote.js.map +0 -1
- package/dist/src/dht/ExternalApiRpcLocal.d.ts +0 -18
- package/dist/src/dht/ExternalApiRpcLocal.js +0 -32
- package/dist/src/dht/ExternalApiRpcLocal.js.map +0 -1
- package/dist/src/dht/ExternalApiRpcRemote.d.ts +0 -10
- package/dist/src/dht/ExternalApiRpcRemote.js +0 -58
- package/dist/src/dht/ExternalApiRpcRemote.js.map +0 -1
- package/dist/src/dht/PeerManager.d.ts +0 -63
- package/dist/src/dht/PeerManager.js +0 -251
- package/dist/src/dht/PeerManager.js.map +0 -1
- package/dist/src/dht/contact/Contact.d.ts +0 -8
- package/dist/src/dht/contact/Contact.js +0 -18
- package/dist/src/dht/contact/Contact.js.map +0 -1
- package/dist/src/dht/contact/ContactList.d.ts +0 -19
- package/dist/src/dht/contact/ContactList.js +0 -35
- package/dist/src/dht/contact/ContactList.js.map +0 -1
- package/dist/src/dht/contact/RandomContactList.d.ts +0 -11
- package/dist/src/dht/contact/RandomContactList.js +0 -47
- package/dist/src/dht/contact/RandomContactList.js.map +0 -1
- package/dist/src/dht/contact/RingContactList.d.ts +0 -28
- package/dist/src/dht/contact/RingContactList.js +0 -126
- package/dist/src/dht/contact/RingContactList.js.map +0 -1
- package/dist/src/dht/contact/RpcRemote.d.ts +0 -19
- package/dist/src/dht/contact/RpcRemote.js +0 -61
- package/dist/src/dht/contact/RpcRemote.js.map +0 -1
- package/dist/src/dht/contact/SortedContactList.d.ts +0 -37
- package/dist/src/dht/contact/SortedContactList.js +0 -134
- package/dist/src/dht/contact/SortedContactList.js.map +0 -1
- package/dist/src/dht/contact/getClosestNodes.d.ts +0 -6
- package/dist/src/dht/contact/getClosestNodes.js +0 -19
- package/dist/src/dht/contact/getClosestNodes.js.map +0 -1
- package/dist/src/dht/contact/ringIdentifiers.d.ts +0 -16
- package/dist/src/dht/contact/ringIdentifiers.js +0 -54
- package/dist/src/dht/contact/ringIdentifiers.js.map +0 -1
- package/dist/src/dht/discovery/DiscoverySession.d.ts +0 -29
- package/dist/src/dht/discovery/DiscoverySession.js +0 -102
- package/dist/src/dht/discovery/DiscoverySession.js.map +0 -1
- package/dist/src/dht/discovery/PeerDiscovery.d.ts +0 -42
- package/dist/src/dht/discovery/PeerDiscovery.js +0 -193
- package/dist/src/dht/discovery/PeerDiscovery.js.map +0 -1
- package/dist/src/dht/discovery/RingDiscoverySession.d.ts +0 -28
- package/dist/src/dht/discovery/RingDiscoverySession.js +0 -116
- package/dist/src/dht/discovery/RingDiscoverySession.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.d.ts +0 -38
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js +0 -165
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.d.ts +0 -14
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js +0 -26
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.d.ts +0 -6
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js +0 -44
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.d.ts +0 -45
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js +0 -185
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.d.ts +0 -14
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js +0 -20
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.d.ts +0 -6
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js +0 -21
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js.map +0 -1
- package/dist/src/dht/routing/DuplicateDetector.d.ts +0 -10
- package/dist/src/dht/routing/DuplicateDetector.js +0 -31
- package/dist/src/dht/routing/DuplicateDetector.js.map +0 -1
- package/dist/src/dht/routing/Router.d.ts +0 -35
- package/dist/src/dht/routing/Router.js +0 -204
- package/dist/src/dht/routing/Router.js.map +0 -1
- package/dist/src/dht/routing/RouterRpcLocal.d.ts +0 -20
- package/dist/src/dht/routing/RouterRpcLocal.js +0 -67
- package/dist/src/dht/routing/RouterRpcLocal.js.map +0 -1
- package/dist/src/dht/routing/RouterRpcRemote.d.ts +0 -8
- package/dist/src/dht/routing/RouterRpcRemote.js +0 -81
- package/dist/src/dht/routing/RouterRpcRemote.js.map +0 -1
- package/dist/src/dht/routing/RoutingSession.d.ts +0 -56
- package/dist/src/dht/routing/RoutingSession.js +0 -201
- package/dist/src/dht/routing/RoutingSession.js.map +0 -1
- package/dist/src/dht/routing/RoutingTablesCache.d.ts +0 -24
- package/dist/src/dht/routing/RoutingTablesCache.js +0 -46
- package/dist/src/dht/routing/RoutingTablesCache.js.map +0 -1
- package/dist/src/dht/routing/getPreviousPeer.d.ts +0 -2
- package/dist/src/dht/routing/getPreviousPeer.js +0 -12
- package/dist/src/dht/routing/getPreviousPeer.js.map +0 -1
- package/dist/src/dht/store/LocalDataStore.d.ts +0 -14
- package/dist/src/dht/store/LocalDataStore.js +0 -78
- package/dist/src/dht/store/LocalDataStore.js.map +0 -1
- package/dist/src/dht/store/StoreManager.d.ts +0 -32
- package/dist/src/dht/store/StoreManager.js +0 -126
- package/dist/src/dht/store/StoreManager.js.map +0 -1
- package/dist/src/dht/store/StoreRpcLocal.d.ts +0 -21
- package/dist/src/dht/store/StoreRpcLocal.js +0 -65
- package/dist/src/dht/store/StoreRpcLocal.js.map +0 -1
- package/dist/src/dht/store/StoreRpcRemote.d.ts +0 -7
- package/dist/src/dht/store/StoreRpcRemote.js +0 -29
- package/dist/src/dht/store/StoreRpcRemote.js.map +0 -1
- package/dist/src/exports.d.ts +0 -25
- package/dist/src/exports.js +0 -48
- package/dist/src/exports.js.map +0 -1
- package/dist/src/helpers/AddressTools.d.ts +0 -2
- package/dist/src/helpers/AddressTools.js +0 -32
- package/dist/src/helpers/AddressTools.js.map +0 -1
- package/dist/src/helpers/Connectivity.d.ts +0 -4
- package/dist/src/helpers/Connectivity.js +0 -24
- package/dist/src/helpers/Connectivity.js.map +0 -1
- package/dist/src/helpers/browser/isBrowserEnvironment.d.ts +0 -1
- package/dist/src/helpers/browser/isBrowserEnvironment.js +0 -6
- package/dist/src/helpers/browser/isBrowserEnvironment.js.map +0 -1
- package/dist/src/helpers/browser/isBrowserEnvironment_override.d.ts +0 -1
- package/dist/src/helpers/browser/isBrowserEnvironment_override.js +0 -7
- package/dist/src/helpers/browser/isBrowserEnvironment_override.js.map +0 -1
- package/dist/src/helpers/createPeerDescriptor.d.ts +0 -3
- package/dist/src/helpers/createPeerDescriptor.js +0 -58
- package/dist/src/helpers/createPeerDescriptor.js.map +0 -1
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.d.ts +0 -2
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.js +0 -30
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.js.map +0 -1
- package/dist/src/helpers/debugHelpers.d.ts +0 -3
- package/dist/src/helpers/debugHelpers.js +0 -11
- package/dist/src/helpers/debugHelpers.js.map +0 -1
- package/dist/src/helpers/errors.d.ts +0 -72
- package/dist/src/helpers/errors.js +0 -97
- package/dist/src/helpers/errors.js.map +0 -1
- package/dist/src/helpers/offering.d.ts +0 -4
- package/dist/src/helpers/offering.js +0 -18
- package/dist/src/helpers/offering.js.map +0 -1
- package/dist/src/helpers/protoClasses.d.ts +0 -2
- package/dist/src/helpers/protoClasses.js +0 -32
- package/dist/src/helpers/protoClasses.js.map +0 -1
- package/dist/src/helpers/protoToString.d.ts +0 -2
- package/dist/src/helpers/protoToString.js +0 -19
- package/dist/src/helpers/protoToString.js.map +0 -1
- package/dist/src/helpers/version.d.ts +0 -6
- package/dist/src/helpers/version.js +0 -38
- package/dist/src/helpers/version.js.map +0 -1
- package/dist/src/identifiers.d.ts +0 -10
- package/dist/src/identifiers.js +0 -31
- package/dist/src/identifiers.js.map +0 -1
- package/dist/src/rpc-protocol/DhtCallContext.d.ts +0 -12
- package/dist/src/rpc-protocol/DhtCallContext.js +0 -17
- package/dist/src/rpc-protocol/DhtCallContext.js.map +0 -1
- package/dist/src/rpc-protocol/DhtRpcOptions.d.ts +0 -10
- package/dist/src/rpc-protocol/DhtRpcOptions.js +0 -3
- package/dist/src/rpc-protocol/DhtRpcOptions.js.map +0 -1
- package/dist/src/transport/ITransport.d.ts +0 -31
- package/dist/src/transport/ITransport.js +0 -9
- package/dist/src/transport/ITransport.js.map +0 -1
- package/dist/src/transport/ListeningRpcCommunicator.d.ts +0 -11
- package/dist/src/transport/ListeningRpcCommunicator.js +0 -31
- package/dist/src/transport/ListeningRpcCommunicator.js.map +0 -1
- package/dist/src/transport/RoutingRpcCommunicator.d.ts +0 -10
- package/dist/src/transport/RoutingRpcCommunicator.js +0 -60
- package/dist/src/transport/RoutingRpcCommunicator.js.map +0 -1
- package/dist/src/types/ServiceID.d.ts +0 -1
- package/dist/src/types/ServiceID.js +0 -3
- package/dist/src/types/ServiceID.js.map +0 -1
|
@@ -0,0 +1,1321 @@
|
|
|
1
|
+
import { BrandedString, MetricsContext } from '@streamr/utils';
|
|
2
|
+
import { EventEmitter } from 'eventemitter3';
|
|
3
|
+
import { MessageType, IMessageType, BinaryReadOptions, JsonWriteOptions, JsonValue, JsonReadOptions, PartialMessage, IBinaryReader, IBinaryWriter, BinaryWriteOptions } from '@protobuf-ts/runtime';
|
|
4
|
+
import { ProtoRpcOptions, ProtoCallContext, RpcCommunicator, RpcCommunicatorOptions, ClassType, ClientTransport, ProtoRpcClient } from '@streamr/proto-rpc';
|
|
5
|
+
import { ServiceInfo } from '@protobuf-ts/runtime-rpc';
|
|
6
|
+
import { w3cwebsocket } from 'websocket';
|
|
7
|
+
|
|
8
|
+
declare class Any$Type extends MessageType<Any> {
|
|
9
|
+
constructor();
|
|
10
|
+
/**
|
|
11
|
+
* Pack the message into a new `Any`.
|
|
12
|
+
*
|
|
13
|
+
* Uses 'type.googleapis.com/full.type.name' as the type URL.
|
|
14
|
+
*/
|
|
15
|
+
pack<T extends object>(message: T, type: IMessageType<T>): Any;
|
|
16
|
+
/**
|
|
17
|
+
* Unpack the message from the `Any`.
|
|
18
|
+
*/
|
|
19
|
+
unpack<T extends object>(any: Any, type: IMessageType<T>, options?: Partial<BinaryReadOptions>): T;
|
|
20
|
+
/**
|
|
21
|
+
* Does the given `Any` contain a packed message of the given type?
|
|
22
|
+
*/
|
|
23
|
+
contains(any: Any, type: IMessageType<any> | string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Convert the message to canonical JSON value.
|
|
26
|
+
*
|
|
27
|
+
* You have to provide the `typeRegistry` option so that the
|
|
28
|
+
* packed message can be converted to JSON.
|
|
29
|
+
*
|
|
30
|
+
* The `typeRegistry` option is also required to read
|
|
31
|
+
* `google.protobuf.Any` from JSON format.
|
|
32
|
+
*/
|
|
33
|
+
internalJsonWrite(any: Any, options: JsonWriteOptions): JsonValue;
|
|
34
|
+
internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Any): Any;
|
|
35
|
+
typeNameToUrl(name: string): string;
|
|
36
|
+
typeUrlToName(url: string): string;
|
|
37
|
+
create(value?: PartialMessage<Any>): Any;
|
|
38
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Any): Any;
|
|
39
|
+
internalBinaryWrite(message: Any, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
43
|
+
* URL that describes the type of the serialized message.
|
|
44
|
+
*
|
|
45
|
+
* Protobuf library provides support to pack/unpack Any values in the form
|
|
46
|
+
* of utility functions or additional generated methods of the Any type.
|
|
47
|
+
*
|
|
48
|
+
* Example 1: Pack and unpack a message in C++.
|
|
49
|
+
*
|
|
50
|
+
* Foo foo = ...;
|
|
51
|
+
* Any any;
|
|
52
|
+
* any.PackFrom(foo);
|
|
53
|
+
* ...
|
|
54
|
+
* if (any.UnpackTo(&foo)) {
|
|
55
|
+
* ...
|
|
56
|
+
* }
|
|
57
|
+
*
|
|
58
|
+
* Example 2: Pack and unpack a message in Java.
|
|
59
|
+
*
|
|
60
|
+
* Foo foo = ...;
|
|
61
|
+
* Any any = Any.pack(foo);
|
|
62
|
+
* ...
|
|
63
|
+
* if (any.is(Foo.class)) {
|
|
64
|
+
* foo = any.unpack(Foo.class);
|
|
65
|
+
* }
|
|
66
|
+
* // or ...
|
|
67
|
+
* if (any.isSameTypeAs(Foo.getDefaultInstance())) {
|
|
68
|
+
* foo = any.unpack(Foo.getDefaultInstance());
|
|
69
|
+
* }
|
|
70
|
+
*
|
|
71
|
+
* Example 3: Pack and unpack a message in Python.
|
|
72
|
+
*
|
|
73
|
+
* foo = Foo(...)
|
|
74
|
+
* any = Any()
|
|
75
|
+
* any.Pack(foo)
|
|
76
|
+
* ...
|
|
77
|
+
* if any.Is(Foo.DESCRIPTOR):
|
|
78
|
+
* any.Unpack(foo)
|
|
79
|
+
* ...
|
|
80
|
+
*
|
|
81
|
+
* Example 4: Pack and unpack a message in Go
|
|
82
|
+
*
|
|
83
|
+
* foo := &pb.Foo{...}
|
|
84
|
+
* any, err := anypb.New(foo)
|
|
85
|
+
* if err != nil {
|
|
86
|
+
* ...
|
|
87
|
+
* }
|
|
88
|
+
* ...
|
|
89
|
+
* foo := &pb.Foo{}
|
|
90
|
+
* if err := any.UnmarshalTo(foo); err != nil {
|
|
91
|
+
* ...
|
|
92
|
+
* }
|
|
93
|
+
*
|
|
94
|
+
* The pack methods provided by protobuf library will by default use
|
|
95
|
+
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
|
96
|
+
* methods only use the fully qualified type name after the last '/'
|
|
97
|
+
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
|
98
|
+
* name "y.z".
|
|
99
|
+
*
|
|
100
|
+
* JSON
|
|
101
|
+
* ====
|
|
102
|
+
* The JSON representation of an `Any` value uses the regular
|
|
103
|
+
* representation of the deserialized, embedded message, with an
|
|
104
|
+
* additional field `@type` which contains the type URL. Example:
|
|
105
|
+
*
|
|
106
|
+
* package google.profile;
|
|
107
|
+
* message Person {
|
|
108
|
+
* string first_name = 1;
|
|
109
|
+
* string last_name = 2;
|
|
110
|
+
* }
|
|
111
|
+
*
|
|
112
|
+
* {
|
|
113
|
+
* "@type": "type.googleapis.com/google.profile.Person",
|
|
114
|
+
* "firstName": <string>,
|
|
115
|
+
* "lastName": <string>
|
|
116
|
+
* }
|
|
117
|
+
*
|
|
118
|
+
* If the embedded message type is well-known and has a custom JSON
|
|
119
|
+
* representation, that representation will be embedded adding a field
|
|
120
|
+
* `value` which holds the custom JSON in addition to the `@type`
|
|
121
|
+
* field. Example (for message [google.protobuf.Duration][]):
|
|
122
|
+
*
|
|
123
|
+
* {
|
|
124
|
+
* "@type": "type.googleapis.com/google.protobuf.Duration",
|
|
125
|
+
* "value": "1.212s"
|
|
126
|
+
* }
|
|
127
|
+
*
|
|
128
|
+
*
|
|
129
|
+
* @generated from protobuf message google.protobuf.Any
|
|
130
|
+
*/
|
|
131
|
+
interface Any {
|
|
132
|
+
/**
|
|
133
|
+
* A URL/resource name that uniquely identifies the type of the serialized
|
|
134
|
+
* protocol buffer message. This string must contain at least
|
|
135
|
+
* one "/" character. The last segment of the URL's path must represent
|
|
136
|
+
* the fully qualified name of the type (as in
|
|
137
|
+
* `path/google.protobuf.Duration`). The name should be in a canonical form
|
|
138
|
+
* (e.g., leading "." is not accepted).
|
|
139
|
+
*
|
|
140
|
+
* In practice, teams usually precompile into the binary all types that they
|
|
141
|
+
* expect it to use in the context of Any. However, for URLs which use the
|
|
142
|
+
* scheme `http`, `https`, or no scheme, one can optionally set up a type
|
|
143
|
+
* server that maps type URLs to message definitions as follows:
|
|
144
|
+
*
|
|
145
|
+
* * If no scheme is provided, `https` is assumed.
|
|
146
|
+
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
|
147
|
+
* value in binary format, or produce an error.
|
|
148
|
+
* * Applications are allowed to cache lookup results based on the
|
|
149
|
+
* URL, or have them precompiled into a binary to avoid any
|
|
150
|
+
* lookup. Therefore, binary compatibility needs to be preserved
|
|
151
|
+
* on changes to types. (Use versioned type names to manage
|
|
152
|
+
* breaking changes.)
|
|
153
|
+
*
|
|
154
|
+
* Note: this functionality is not currently available in the official
|
|
155
|
+
* protobuf release, and it is not used for type URLs beginning with
|
|
156
|
+
* type.googleapis.com. As of May 2023, there are no widely used type server
|
|
157
|
+
* implementations and no plans to implement one.
|
|
158
|
+
*
|
|
159
|
+
* Schemes other than `http`, `https` (or the empty scheme) might be
|
|
160
|
+
* used with implementation specific semantics.
|
|
161
|
+
*
|
|
162
|
+
*
|
|
163
|
+
* @generated from protobuf field: string type_url = 1
|
|
164
|
+
*/
|
|
165
|
+
typeUrl: string;
|
|
166
|
+
/**
|
|
167
|
+
* Must be a valid serialized protocol buffer of the above specified type.
|
|
168
|
+
*
|
|
169
|
+
* @generated from protobuf field: bytes value = 2
|
|
170
|
+
*/
|
|
171
|
+
value: Uint8Array;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* @generated MessageType for protobuf message google.protobuf.Any
|
|
175
|
+
*/
|
|
176
|
+
declare const Any: Any$Type;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* @generated from protobuf enum protorpc.RpcErrorType
|
|
180
|
+
*/
|
|
181
|
+
declare enum RpcErrorType {
|
|
182
|
+
/**
|
|
183
|
+
* @generated from protobuf enum value: SERVER_TIMEOUT = 0;
|
|
184
|
+
*/
|
|
185
|
+
SERVER_TIMEOUT = 0,
|
|
186
|
+
/**
|
|
187
|
+
* @generated from protobuf enum value: CLIENT_TIMEOUT = 1;
|
|
188
|
+
*/
|
|
189
|
+
CLIENT_TIMEOUT = 1,
|
|
190
|
+
/**
|
|
191
|
+
* @generated from protobuf enum value: UNKNOWN_RPC_METHOD = 2;
|
|
192
|
+
*/
|
|
193
|
+
UNKNOWN_RPC_METHOD = 2,
|
|
194
|
+
/**
|
|
195
|
+
* @generated from protobuf enum value: CLIENT_ERROR = 3;
|
|
196
|
+
*/
|
|
197
|
+
CLIENT_ERROR = 3,
|
|
198
|
+
/**
|
|
199
|
+
* @generated from protobuf enum value: SERVER_ERROR = 4;
|
|
200
|
+
*/
|
|
201
|
+
SERVER_ERROR = 4
|
|
202
|
+
}
|
|
203
|
+
declare class RpcMessage$Type extends MessageType<RpcMessage> {
|
|
204
|
+
constructor();
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* @generated from protobuf message protorpc.RpcMessage
|
|
208
|
+
*/
|
|
209
|
+
interface RpcMessage {
|
|
210
|
+
/**
|
|
211
|
+
* @generated from protobuf field: map<string, string> header = 1
|
|
212
|
+
*/
|
|
213
|
+
header: {
|
|
214
|
+
[key: string]: string;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* @generated from protobuf field: google.protobuf.Any body = 2
|
|
218
|
+
*/
|
|
219
|
+
body?: Any;
|
|
220
|
+
/**
|
|
221
|
+
* @generated from protobuf field: string requestId = 3
|
|
222
|
+
*/
|
|
223
|
+
requestId: string;
|
|
224
|
+
/**
|
|
225
|
+
* @generated from protobuf field: optional protorpc.RpcErrorType errorType = 4
|
|
226
|
+
*/
|
|
227
|
+
errorType?: RpcErrorType;
|
|
228
|
+
/**
|
|
229
|
+
* @generated from protobuf field: optional string errorClassName = 5
|
|
230
|
+
*/
|
|
231
|
+
errorClassName?: string;
|
|
232
|
+
/**
|
|
233
|
+
* @generated from protobuf field: optional string errorCode = 6
|
|
234
|
+
*/
|
|
235
|
+
errorCode?: string;
|
|
236
|
+
/**
|
|
237
|
+
* @generated from protobuf field: optional string errorMessage = 7
|
|
238
|
+
*/
|
|
239
|
+
errorMessage?: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* @generated MessageType for protobuf message protorpc.RpcMessage
|
|
243
|
+
*/
|
|
244
|
+
declare const RpcMessage: RpcMessage$Type;
|
|
245
|
+
|
|
246
|
+
declare class Timestamp$Type extends MessageType<Timestamp> {
|
|
247
|
+
constructor();
|
|
248
|
+
/**
|
|
249
|
+
* Creates a new `Timestamp` for the current time.
|
|
250
|
+
*/
|
|
251
|
+
now(): Timestamp;
|
|
252
|
+
/**
|
|
253
|
+
* Converts a `Timestamp` to a JavaScript Date.
|
|
254
|
+
*/
|
|
255
|
+
toDate(message: Timestamp): Date;
|
|
256
|
+
/**
|
|
257
|
+
* Converts a JavaScript Date to a `Timestamp`.
|
|
258
|
+
*/
|
|
259
|
+
fromDate(date: Date): Timestamp;
|
|
260
|
+
/**
|
|
261
|
+
* In JSON format, the `Timestamp` type is encoded as a string
|
|
262
|
+
* in the RFC 3339 format.
|
|
263
|
+
*/
|
|
264
|
+
internalJsonWrite(message: Timestamp, options: JsonWriteOptions): JsonValue;
|
|
265
|
+
/**
|
|
266
|
+
* In JSON format, the `Timestamp` type is encoded as a string
|
|
267
|
+
* in the RFC 3339 format.
|
|
268
|
+
*/
|
|
269
|
+
internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Timestamp): Timestamp;
|
|
270
|
+
create(value?: PartialMessage<Timestamp>): Timestamp;
|
|
271
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Timestamp): Timestamp;
|
|
272
|
+
internalBinaryWrite(message: Timestamp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* A Timestamp represents a point in time independent of any time zone or local
|
|
276
|
+
* calendar, encoded as a count of seconds and fractions of seconds at
|
|
277
|
+
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
|
278
|
+
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
|
279
|
+
* Gregorian calendar backwards to year one.
|
|
280
|
+
*
|
|
281
|
+
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
|
282
|
+
* second table is needed for interpretation, using a [24-hour linear
|
|
283
|
+
* smear](https://developers.google.com/time/smear).
|
|
284
|
+
*
|
|
285
|
+
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
|
286
|
+
* restricting to that range, we ensure that we can convert to and from [RFC
|
|
287
|
+
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
|
288
|
+
*
|
|
289
|
+
* # Examples
|
|
290
|
+
*
|
|
291
|
+
* Example 1: Compute Timestamp from POSIX `time()`.
|
|
292
|
+
*
|
|
293
|
+
* Timestamp timestamp;
|
|
294
|
+
* timestamp.set_seconds(time(NULL));
|
|
295
|
+
* timestamp.set_nanos(0);
|
|
296
|
+
*
|
|
297
|
+
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
|
298
|
+
*
|
|
299
|
+
* struct timeval tv;
|
|
300
|
+
* gettimeofday(&tv, NULL);
|
|
301
|
+
*
|
|
302
|
+
* Timestamp timestamp;
|
|
303
|
+
* timestamp.set_seconds(tv.tv_sec);
|
|
304
|
+
* timestamp.set_nanos(tv.tv_usec * 1000);
|
|
305
|
+
*
|
|
306
|
+
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
|
307
|
+
*
|
|
308
|
+
* FILETIME ft;
|
|
309
|
+
* GetSystemTimeAsFileTime(&ft);
|
|
310
|
+
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
|
311
|
+
*
|
|
312
|
+
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
|
313
|
+
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
|
314
|
+
* Timestamp timestamp;
|
|
315
|
+
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
|
316
|
+
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
|
317
|
+
*
|
|
318
|
+
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
|
319
|
+
*
|
|
320
|
+
* long millis = System.currentTimeMillis();
|
|
321
|
+
*
|
|
322
|
+
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
|
323
|
+
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
|
324
|
+
*
|
|
325
|
+
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
|
326
|
+
*
|
|
327
|
+
* Instant now = Instant.now();
|
|
328
|
+
*
|
|
329
|
+
* Timestamp timestamp =
|
|
330
|
+
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
|
331
|
+
* .setNanos(now.getNano()).build();
|
|
332
|
+
*
|
|
333
|
+
* Example 6: Compute Timestamp from current time in Python.
|
|
334
|
+
*
|
|
335
|
+
* timestamp = Timestamp()
|
|
336
|
+
* timestamp.GetCurrentTime()
|
|
337
|
+
*
|
|
338
|
+
* # JSON Mapping
|
|
339
|
+
*
|
|
340
|
+
* In JSON format, the Timestamp type is encoded as a string in the
|
|
341
|
+
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
|
342
|
+
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
|
343
|
+
* where {year} is always expressed using four digits while {month}, {day},
|
|
344
|
+
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
|
345
|
+
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
|
346
|
+
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
|
347
|
+
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
|
348
|
+
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
|
349
|
+
* able to accept both UTC and other timezones (as indicated by an offset).
|
|
350
|
+
*
|
|
351
|
+
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
|
352
|
+
* 01:30 UTC on January 15, 2017.
|
|
353
|
+
*
|
|
354
|
+
* In JavaScript, one can convert a Date object to this format using the
|
|
355
|
+
* standard
|
|
356
|
+
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
|
357
|
+
* method. In Python, a standard `datetime.datetime` object can be converted
|
|
358
|
+
* to this format using
|
|
359
|
+
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
|
360
|
+
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
|
361
|
+
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
|
362
|
+
* http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
|
|
363
|
+
* ) to obtain a formatter capable of generating timestamps in this format.
|
|
364
|
+
*
|
|
365
|
+
*
|
|
366
|
+
* @generated from protobuf message google.protobuf.Timestamp
|
|
367
|
+
*/
|
|
368
|
+
interface Timestamp {
|
|
369
|
+
/**
|
|
370
|
+
* Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must
|
|
371
|
+
* be between -315576000000 and 315576000000 inclusive (which corresponds to
|
|
372
|
+
* 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z).
|
|
373
|
+
*
|
|
374
|
+
* @generated from protobuf field: int64 seconds = 1
|
|
375
|
+
*/
|
|
376
|
+
seconds: number;
|
|
377
|
+
/**
|
|
378
|
+
* Non-negative fractions of a second at nanosecond resolution. This field is
|
|
379
|
+
* the nanosecond portion of the duration, not an alternative to seconds.
|
|
380
|
+
* Negative second values with fractions must still have non-negative nanos
|
|
381
|
+
* values that count forward in time. Must be between 0 and 999,999,999
|
|
382
|
+
* inclusive.
|
|
383
|
+
*
|
|
384
|
+
* @generated from protobuf field: int32 nanos = 2
|
|
385
|
+
*/
|
|
386
|
+
nanos: number;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* @generated MessageType for protobuf message google.protobuf.Timestamp
|
|
390
|
+
*/
|
|
391
|
+
declare const Timestamp: Timestamp$Type;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* @generated from protobuf enum dht.RecursiveOperation
|
|
395
|
+
*/
|
|
396
|
+
declare enum RecursiveOperation {
|
|
397
|
+
/**
|
|
398
|
+
* @generated from protobuf enum value: FIND_CLOSEST_NODES = 0;
|
|
399
|
+
*/
|
|
400
|
+
FIND_CLOSEST_NODES = 0,
|
|
401
|
+
/**
|
|
402
|
+
* @generated from protobuf enum value: FETCH_DATA = 1;
|
|
403
|
+
*/
|
|
404
|
+
FETCH_DATA = 1,
|
|
405
|
+
/**
|
|
406
|
+
* @generated from protobuf enum value: DELETE_DATA = 2;
|
|
407
|
+
*/
|
|
408
|
+
DELETE_DATA = 2
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* @generated from protobuf enum dht.NodeType
|
|
412
|
+
*/
|
|
413
|
+
declare enum NodeType {
|
|
414
|
+
/**
|
|
415
|
+
* @generated from protobuf enum value: NODEJS = 0;
|
|
416
|
+
*/
|
|
417
|
+
NODEJS = 0,
|
|
418
|
+
/**
|
|
419
|
+
* @generated from protobuf enum value: BROWSER = 1;
|
|
420
|
+
*/
|
|
421
|
+
BROWSER = 1
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* @generated from protobuf enum dht.HandshakeError
|
|
425
|
+
*/
|
|
426
|
+
declare enum HandshakeError {
|
|
427
|
+
/**
|
|
428
|
+
* @generated from protobuf enum value: DUPLICATE_CONNECTION = 0;
|
|
429
|
+
*/
|
|
430
|
+
DUPLICATE_CONNECTION = 0,
|
|
431
|
+
/**
|
|
432
|
+
* @generated from protobuf enum value: INVALID_TARGET_PEER_DESCRIPTOR = 1;
|
|
433
|
+
*/
|
|
434
|
+
INVALID_TARGET_PEER_DESCRIPTOR = 1,
|
|
435
|
+
/**
|
|
436
|
+
* @generated from protobuf enum value: UNSUPPORTED_PROTOCOL_VERSION = 2;
|
|
437
|
+
*/
|
|
438
|
+
UNSUPPORTED_PROTOCOL_VERSION = 2
|
|
439
|
+
}
|
|
440
|
+
declare class DataEntry$Type extends MessageType<DataEntry> {
|
|
441
|
+
constructor();
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* @generated from protobuf message dht.DataEntry
|
|
445
|
+
*/
|
|
446
|
+
interface DataEntry {
|
|
447
|
+
/**
|
|
448
|
+
* @generated from protobuf field: bytes key = 1
|
|
449
|
+
*/
|
|
450
|
+
key: Uint8Array;
|
|
451
|
+
/**
|
|
452
|
+
* @generated from protobuf field: google.protobuf.Any data = 2
|
|
453
|
+
*/
|
|
454
|
+
data?: Any;
|
|
455
|
+
/**
|
|
456
|
+
* @generated from protobuf field: bytes creator = 3
|
|
457
|
+
*/
|
|
458
|
+
creator: Uint8Array;
|
|
459
|
+
/**
|
|
460
|
+
* @generated from protobuf field: google.protobuf.Timestamp createdAt = 4
|
|
461
|
+
*/
|
|
462
|
+
createdAt?: Timestamp;
|
|
463
|
+
/**
|
|
464
|
+
* @generated from protobuf field: google.protobuf.Timestamp storedAt = 5
|
|
465
|
+
*/
|
|
466
|
+
storedAt?: Timestamp;
|
|
467
|
+
/**
|
|
468
|
+
* @generated from protobuf field: uint32 ttl = 6
|
|
469
|
+
*/
|
|
470
|
+
ttl: number;
|
|
471
|
+
/**
|
|
472
|
+
* @generated from protobuf field: bool stale = 7
|
|
473
|
+
*/
|
|
474
|
+
stale: boolean;
|
|
475
|
+
/**
|
|
476
|
+
* @generated from protobuf field: bool deleted = 8
|
|
477
|
+
*/
|
|
478
|
+
deleted: boolean;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* @generated MessageType for protobuf message dht.DataEntry
|
|
482
|
+
*/
|
|
483
|
+
declare const DataEntry: DataEntry$Type;
|
|
484
|
+
declare class RecursiveOperationRequest$Type extends MessageType<RecursiveOperationRequest> {
|
|
485
|
+
constructor();
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* @generated from protobuf message dht.RecursiveOperationRequest
|
|
489
|
+
*/
|
|
490
|
+
interface RecursiveOperationRequest {
|
|
491
|
+
/**
|
|
492
|
+
* @generated from protobuf field: string sessionId = 1
|
|
493
|
+
*/
|
|
494
|
+
sessionId: string;
|
|
495
|
+
/**
|
|
496
|
+
* @generated from protobuf field: dht.RecursiveOperation operation = 2
|
|
497
|
+
*/
|
|
498
|
+
operation: RecursiveOperation;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* @generated MessageType for protobuf message dht.RecursiveOperationRequest
|
|
502
|
+
*/
|
|
503
|
+
declare const RecursiveOperationRequest: RecursiveOperationRequest$Type;
|
|
504
|
+
declare class PeerDescriptor$Type extends MessageType<PeerDescriptor> {
|
|
505
|
+
constructor();
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* @generated from protobuf message dht.PeerDescriptor
|
|
509
|
+
*/
|
|
510
|
+
interface PeerDescriptor {
|
|
511
|
+
/**
|
|
512
|
+
* @generated from protobuf field: bytes nodeId = 1
|
|
513
|
+
*/
|
|
514
|
+
nodeId: Uint8Array;
|
|
515
|
+
/**
|
|
516
|
+
* @generated from protobuf field: dht.NodeType type = 2
|
|
517
|
+
*/
|
|
518
|
+
type: NodeType;
|
|
519
|
+
/**
|
|
520
|
+
* @generated from protobuf field: dht.ConnectivityMethod udp = 3
|
|
521
|
+
*/
|
|
522
|
+
udp?: ConnectivityMethod;
|
|
523
|
+
/**
|
|
524
|
+
* @generated from protobuf field: dht.ConnectivityMethod tcp = 4
|
|
525
|
+
*/
|
|
526
|
+
tcp?: ConnectivityMethod;
|
|
527
|
+
/**
|
|
528
|
+
* @generated from protobuf field: dht.ConnectivityMethod websocket = 5
|
|
529
|
+
*/
|
|
530
|
+
websocket?: ConnectivityMethod;
|
|
531
|
+
/**
|
|
532
|
+
* @generated from protobuf field: optional uint32 region = 6
|
|
533
|
+
*/
|
|
534
|
+
region?: number;
|
|
535
|
+
/**
|
|
536
|
+
* @generated from protobuf field: optional uint32 ipAddress = 7
|
|
537
|
+
*/
|
|
538
|
+
ipAddress?: number;
|
|
539
|
+
/**
|
|
540
|
+
* @generated from protobuf field: optional bytes publicKey = 8
|
|
541
|
+
*/
|
|
542
|
+
publicKey?: Uint8Array;
|
|
543
|
+
/**
|
|
544
|
+
* signature of fields 2-8
|
|
545
|
+
*
|
|
546
|
+
* @generated from protobuf field: optional bytes signature = 9
|
|
547
|
+
*/
|
|
548
|
+
signature?: Uint8Array;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* @generated MessageType for protobuf message dht.PeerDescriptor
|
|
552
|
+
*/
|
|
553
|
+
declare const PeerDescriptor: PeerDescriptor$Type;
|
|
554
|
+
declare class ConnectivityMethod$Type extends MessageType<ConnectivityMethod> {
|
|
555
|
+
constructor();
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* @generated from protobuf message dht.ConnectivityMethod
|
|
559
|
+
*/
|
|
560
|
+
interface ConnectivityMethod {
|
|
561
|
+
/**
|
|
562
|
+
* @generated from protobuf field: uint32 port = 1
|
|
563
|
+
*/
|
|
564
|
+
port: number;
|
|
565
|
+
/**
|
|
566
|
+
* @generated from protobuf field: string host = 2
|
|
567
|
+
*/
|
|
568
|
+
host: string;
|
|
569
|
+
/**
|
|
570
|
+
* @generated from protobuf field: bool tls = 3
|
|
571
|
+
*/
|
|
572
|
+
tls: boolean;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* @generated MessageType for protobuf message dht.ConnectivityMethod
|
|
576
|
+
*/
|
|
577
|
+
declare const ConnectivityMethod: ConnectivityMethod$Type;
|
|
578
|
+
declare class ConnectivityRequest$Type extends MessageType<ConnectivityRequest> {
|
|
579
|
+
constructor();
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* @generated from protobuf message dht.ConnectivityRequest
|
|
583
|
+
*/
|
|
584
|
+
interface ConnectivityRequest {
|
|
585
|
+
/**
|
|
586
|
+
* @generated from protobuf field: uint32 port = 1
|
|
587
|
+
*/
|
|
588
|
+
port: number;
|
|
589
|
+
/**
|
|
590
|
+
* @generated from protobuf field: bool tls = 2
|
|
591
|
+
*/
|
|
592
|
+
tls: boolean;
|
|
593
|
+
/**
|
|
594
|
+
* @generated from protobuf field: optional string host = 3
|
|
595
|
+
*/
|
|
596
|
+
host?: string;
|
|
597
|
+
/**
|
|
598
|
+
* @generated from protobuf field: bool allowSelfSignedCertificate = 4
|
|
599
|
+
*/
|
|
600
|
+
allowSelfSignedCertificate: boolean;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* @generated MessageType for protobuf message dht.ConnectivityRequest
|
|
604
|
+
*/
|
|
605
|
+
declare const ConnectivityRequest: ConnectivityRequest$Type;
|
|
606
|
+
declare class ConnectivityResponse$Type extends MessageType<ConnectivityResponse> {
|
|
607
|
+
constructor();
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* @generated from protobuf message dht.ConnectivityResponse
|
|
611
|
+
*/
|
|
612
|
+
interface ConnectivityResponse {
|
|
613
|
+
/**
|
|
614
|
+
* @generated from protobuf field: string host = 1
|
|
615
|
+
*/
|
|
616
|
+
host: string;
|
|
617
|
+
/**
|
|
618
|
+
* @generated from protobuf field: string natType = 2
|
|
619
|
+
*/
|
|
620
|
+
natType: string;
|
|
621
|
+
/**
|
|
622
|
+
* @generated from protobuf field: dht.ConnectivityMethod websocket = 3
|
|
623
|
+
*/
|
|
624
|
+
websocket?: ConnectivityMethod;
|
|
625
|
+
/**
|
|
626
|
+
* @generated from protobuf field: uint32 ipAddress = 4
|
|
627
|
+
*/
|
|
628
|
+
ipAddress: number;
|
|
629
|
+
/**
|
|
630
|
+
* @generated from protobuf field: string protocolVersion = 5
|
|
631
|
+
*/
|
|
632
|
+
protocolVersion: string;
|
|
633
|
+
/**
|
|
634
|
+
* @generated from protobuf field: optional double latitude = 6
|
|
635
|
+
*/
|
|
636
|
+
latitude?: number;
|
|
637
|
+
/**
|
|
638
|
+
* @generated from protobuf field: optional double longitude = 7
|
|
639
|
+
*/
|
|
640
|
+
longitude?: number;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* @generated MessageType for protobuf message dht.ConnectivityResponse
|
|
644
|
+
*/
|
|
645
|
+
declare const ConnectivityResponse: ConnectivityResponse$Type;
|
|
646
|
+
declare class HandshakeRequest$Type extends MessageType<HandshakeRequest> {
|
|
647
|
+
constructor();
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* @generated from protobuf message dht.HandshakeRequest
|
|
651
|
+
*/
|
|
652
|
+
interface HandshakeRequest {
|
|
653
|
+
/**
|
|
654
|
+
* @generated from protobuf field: dht.PeerDescriptor sourcePeerDescriptor = 1
|
|
655
|
+
*/
|
|
656
|
+
sourcePeerDescriptor?: PeerDescriptor;
|
|
657
|
+
/**
|
|
658
|
+
* @generated from protobuf field: optional dht.PeerDescriptor targetPeerDescriptor = 2
|
|
659
|
+
*/
|
|
660
|
+
targetPeerDescriptor?: PeerDescriptor;
|
|
661
|
+
/**
|
|
662
|
+
* @generated from protobuf field: string protocolVersion = 3
|
|
663
|
+
*/
|
|
664
|
+
protocolVersion: string;
|
|
665
|
+
/**
|
|
666
|
+
* @generated from protobuf field: string applicationVersion = 4
|
|
667
|
+
*/
|
|
668
|
+
applicationVersion: string;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* @generated MessageType for protobuf message dht.HandshakeRequest
|
|
672
|
+
*/
|
|
673
|
+
declare const HandshakeRequest: HandshakeRequest$Type;
|
|
674
|
+
declare class HandshakeResponse$Type extends MessageType<HandshakeResponse> {
|
|
675
|
+
constructor();
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* @generated from protobuf message dht.HandshakeResponse
|
|
679
|
+
*/
|
|
680
|
+
interface HandshakeResponse {
|
|
681
|
+
/**
|
|
682
|
+
* @generated from protobuf field: dht.PeerDescriptor sourcePeerDescriptor = 1
|
|
683
|
+
*/
|
|
684
|
+
sourcePeerDescriptor?: PeerDescriptor;
|
|
685
|
+
/**
|
|
686
|
+
* @generated from protobuf field: optional dht.HandshakeError error = 2
|
|
687
|
+
*/
|
|
688
|
+
error?: HandshakeError;
|
|
689
|
+
/**
|
|
690
|
+
* @generated from protobuf field: string protocolVersion = 3
|
|
691
|
+
*/
|
|
692
|
+
protocolVersion: string;
|
|
693
|
+
/**
|
|
694
|
+
* @generated from protobuf field: string applicationVersion = 4
|
|
695
|
+
*/
|
|
696
|
+
applicationVersion: string;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* @generated MessageType for protobuf message dht.HandshakeResponse
|
|
700
|
+
*/
|
|
701
|
+
declare const HandshakeResponse: HandshakeResponse$Type;
|
|
702
|
+
declare class Message$Type extends MessageType<Message> {
|
|
703
|
+
constructor();
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* @generated from protobuf message dht.Message
|
|
707
|
+
*/
|
|
708
|
+
interface Message {
|
|
709
|
+
/**
|
|
710
|
+
* @generated from protobuf field: string messageId = 1
|
|
711
|
+
*/
|
|
712
|
+
messageId: string;
|
|
713
|
+
/**
|
|
714
|
+
* @generated from protobuf field: dht.PeerDescriptor sourceDescriptor = 2
|
|
715
|
+
*/
|
|
716
|
+
sourceDescriptor?: PeerDescriptor;
|
|
717
|
+
/**
|
|
718
|
+
* @generated from protobuf field: dht.PeerDescriptor targetDescriptor = 3
|
|
719
|
+
*/
|
|
720
|
+
targetDescriptor?: PeerDescriptor;
|
|
721
|
+
/**
|
|
722
|
+
* @generated from protobuf field: string serviceId = 4
|
|
723
|
+
*/
|
|
724
|
+
serviceId: string;
|
|
725
|
+
/**
|
|
726
|
+
* @generated from protobuf oneof: body
|
|
727
|
+
*/
|
|
728
|
+
body: {
|
|
729
|
+
oneofKind: "rpcMessage";
|
|
730
|
+
/**
|
|
731
|
+
* @generated from protobuf field: protorpc.RpcMessage rpcMessage = 5
|
|
732
|
+
*/
|
|
733
|
+
rpcMessage: RpcMessage;
|
|
734
|
+
} | {
|
|
735
|
+
oneofKind: "connectivityRequest";
|
|
736
|
+
/**
|
|
737
|
+
* @generated from protobuf field: dht.ConnectivityRequest connectivityRequest = 6
|
|
738
|
+
*/
|
|
739
|
+
connectivityRequest: ConnectivityRequest;
|
|
740
|
+
} | {
|
|
741
|
+
oneofKind: "connectivityResponse";
|
|
742
|
+
/**
|
|
743
|
+
* @generated from protobuf field: dht.ConnectivityResponse connectivityResponse = 7
|
|
744
|
+
*/
|
|
745
|
+
connectivityResponse: ConnectivityResponse;
|
|
746
|
+
} | {
|
|
747
|
+
oneofKind: "handshakeRequest";
|
|
748
|
+
/**
|
|
749
|
+
* @generated from protobuf field: dht.HandshakeRequest handshakeRequest = 8
|
|
750
|
+
*/
|
|
751
|
+
handshakeRequest: HandshakeRequest;
|
|
752
|
+
} | {
|
|
753
|
+
oneofKind: "handshakeResponse";
|
|
754
|
+
/**
|
|
755
|
+
* @generated from protobuf field: dht.HandshakeResponse handshakeResponse = 9
|
|
756
|
+
*/
|
|
757
|
+
handshakeResponse: HandshakeResponse;
|
|
758
|
+
} | {
|
|
759
|
+
oneofKind: "recursiveOperationRequest";
|
|
760
|
+
/**
|
|
761
|
+
* @generated from protobuf field: dht.RecursiveOperationRequest recursiveOperationRequest = 10
|
|
762
|
+
*/
|
|
763
|
+
recursiveOperationRequest: RecursiveOperationRequest;
|
|
764
|
+
} | {
|
|
765
|
+
oneofKind: undefined;
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* @generated MessageType for protobuf message dht.Message
|
|
770
|
+
*/
|
|
771
|
+
declare const Message: Message$Type;
|
|
772
|
+
|
|
773
|
+
interface TransportEvents {
|
|
774
|
+
connected: (peerDescriptor: PeerDescriptor) => void;
|
|
775
|
+
disconnected: (peerDescriptor: PeerDescriptor, gracefulLeave: boolean) => void;
|
|
776
|
+
message: (message: Message) => void;
|
|
777
|
+
}
|
|
778
|
+
interface SendOptions {
|
|
779
|
+
connect: boolean;
|
|
780
|
+
sendIfStopped: boolean;
|
|
781
|
+
bufferWhileConnecting: boolean;
|
|
782
|
+
}
|
|
783
|
+
interface ITransport {
|
|
784
|
+
on<T extends keyof TransportEvents>(eventName: T, listener: (message: Message) => void): void;
|
|
785
|
+
on<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor) => void): void;
|
|
786
|
+
on<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor, gracefulLeave: boolean) => void): void;
|
|
787
|
+
once<T extends keyof TransportEvents>(eventName: T, listener: (message: Message) => void): void;
|
|
788
|
+
once<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor) => void): void;
|
|
789
|
+
once<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor, gracefulLeave: boolean) => void): void;
|
|
790
|
+
off<T extends keyof TransportEvents>(eventName: T, listener: (message: Message) => void): void;
|
|
791
|
+
off<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor) => void): void;
|
|
792
|
+
off<T extends keyof TransportEvents>(eventName: T, listener: (peerDescriptor: PeerDescriptor, gracefulLeave: boolean) => void): void;
|
|
793
|
+
send(msg: Message, opts?: SendOptions): Promise<void>;
|
|
794
|
+
getLocalPeerDescriptor(): PeerDescriptor;
|
|
795
|
+
stop(): void | Promise<void>;
|
|
796
|
+
getDiagnosticInfo(): Record<string, unknown>;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
type DhtAddress = BrandedString<'DhtAddress'>;
|
|
800
|
+
type DhtAddressRaw = Uint8Array;
|
|
801
|
+
declare const toDhtAddress: (raw: DhtAddressRaw) => DhtAddress;
|
|
802
|
+
declare const toDhtAddressRaw: (address: DhtAddress) => DhtAddressRaw;
|
|
803
|
+
declare const toNodeId: (peerDescriptor: PeerDescriptor) => DhtAddress;
|
|
804
|
+
declare const areEqualPeerDescriptors: (peerDescriptor1: PeerDescriptor, peerDescriptor2: PeerDescriptor) => boolean;
|
|
805
|
+
declare const randomDhtAddress: () => DhtAddress;
|
|
806
|
+
|
|
807
|
+
type LockID = string;
|
|
808
|
+
|
|
809
|
+
interface ConnectionEvents {
|
|
810
|
+
data: (bytes: Uint8Array) => void;
|
|
811
|
+
connected: () => void;
|
|
812
|
+
disconnected: (gracefulLeave: boolean, code?: number, reason?: string) => void;
|
|
813
|
+
error: (name: string) => void;
|
|
814
|
+
}
|
|
815
|
+
declare enum ConnectionType {
|
|
816
|
+
WEBSOCKET_SERVER = "websocket-server",
|
|
817
|
+
WEBSOCKET_CLIENT = "websocket-client",
|
|
818
|
+
WEBRTC = "webrtc",
|
|
819
|
+
SIMULATOR_SERVER = "simulator-server",
|
|
820
|
+
SIMULATOR_CLIENT = "simulator-client"
|
|
821
|
+
}
|
|
822
|
+
type ConnectionID = BrandedString<'ConnectionID'>;
|
|
823
|
+
interface IConnection {
|
|
824
|
+
on(event: 'data', listener: (bytes: Uint8Array) => void): this;
|
|
825
|
+
on(event: 'error', listener: (name: string) => void): this;
|
|
826
|
+
on(event: 'connected', listener: () => void): this;
|
|
827
|
+
on(event: 'disconnected', listener: (gracefulLeave: boolean, code?: number, reason?: string) => void): this;
|
|
828
|
+
once(event: 'data', listener: (bytes: Uint8Array) => void): this;
|
|
829
|
+
once(event: 'error', listener: (name: string) => void): this;
|
|
830
|
+
once(event: 'connected', listener: () => void): this;
|
|
831
|
+
once(event: 'disconnected', listener: (gracefulLeave: boolean, code?: number, reason?: string) => void): this;
|
|
832
|
+
off(event: 'data', listener: (bytes: Uint8Array) => void): void;
|
|
833
|
+
off(event: 'error', listener: (name: string) => void): void;
|
|
834
|
+
off(event: 'connected', listener: () => void): void;
|
|
835
|
+
off(event: 'disconnected', listener: (gracefulLeave: boolean, code?: number, reason?: string) => void): void;
|
|
836
|
+
send(data: Uint8Array): void;
|
|
837
|
+
close(gracefulLeave: boolean): Promise<void>;
|
|
838
|
+
destroy(): void;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
declare class Connection extends EventEmitter<ConnectionEvents> {
|
|
842
|
+
connectionId: ConnectionID;
|
|
843
|
+
connectionType: ConnectionType;
|
|
844
|
+
private peerDescriptor?;
|
|
845
|
+
constructor(connectionType: ConnectionType);
|
|
846
|
+
setPeerDescriptor(peerDescriptor: PeerDescriptor): void;
|
|
847
|
+
getPeerDescriptor(): PeerDescriptor | undefined;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
declare class SimulatorConnection extends Connection implements IConnection {
|
|
851
|
+
private stopped;
|
|
852
|
+
localPeerDescriptor: PeerDescriptor;
|
|
853
|
+
private targetPeerDescriptor;
|
|
854
|
+
private simulator;
|
|
855
|
+
constructor(localPeerDescriptor: PeerDescriptor, targetPeerDescriptor: PeerDescriptor, connectionType: ConnectionType, simulator: Simulator);
|
|
856
|
+
send(data: Uint8Array): void;
|
|
857
|
+
close(gracefulLeave: boolean): Promise<void>;
|
|
858
|
+
connect(): void;
|
|
859
|
+
handleIncomingData(data: Uint8Array): void;
|
|
860
|
+
handleIncomingDisconnection(): void;
|
|
861
|
+
destroy(): void;
|
|
862
|
+
private doDisconnect;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
interface PendingConnectionEvents {
|
|
866
|
+
connected: (peerDescriptor: PeerDescriptor, connection: IConnection) => void;
|
|
867
|
+
disconnected: (gracefulLeave: boolean) => void;
|
|
868
|
+
}
|
|
869
|
+
declare class PendingConnection extends EventEmitter<PendingConnectionEvents> {
|
|
870
|
+
private readonly connectingAbortController;
|
|
871
|
+
private remotePeerDescriptor;
|
|
872
|
+
private replacedAsDuplicate;
|
|
873
|
+
private stopped;
|
|
874
|
+
constructor(remotePeerDescriptor: PeerDescriptor, timeout?: number);
|
|
875
|
+
replaceAsDuplicate(): void;
|
|
876
|
+
onHandshakeCompleted(connection: IConnection): void;
|
|
877
|
+
close(graceful: boolean): void;
|
|
878
|
+
destroy(): void;
|
|
879
|
+
getPeerDescriptor(): PeerDescriptor;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
declare class SimulatorConnector {
|
|
883
|
+
private connectingConnections;
|
|
884
|
+
private stopped;
|
|
885
|
+
private localPeerDescriptor;
|
|
886
|
+
private simulator;
|
|
887
|
+
private onNewConnection;
|
|
888
|
+
constructor(localPeerDescriptor: PeerDescriptor, simulator: Simulator, onNewConnection: (connection: PendingConnection) => boolean);
|
|
889
|
+
connect(targetPeerDescriptor: PeerDescriptor): PendingConnection;
|
|
890
|
+
getPeerDescriptor(): PeerDescriptor;
|
|
891
|
+
handleIncomingConnection(sourceConnection: SimulatorConnection): void;
|
|
892
|
+
stop(): Promise<void>;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
declare enum LatencyType {
|
|
896
|
+
NONE = "NONE",
|
|
897
|
+
RANDOM = "RANDOM",
|
|
898
|
+
REAL = "REAL",
|
|
899
|
+
FIXED = "FIXED"
|
|
900
|
+
}
|
|
901
|
+
declare class Simulator {
|
|
902
|
+
private stopped;
|
|
903
|
+
private connectors;
|
|
904
|
+
private latencyTable?;
|
|
905
|
+
private associations;
|
|
906
|
+
private latencyType;
|
|
907
|
+
private fixedLatency?;
|
|
908
|
+
private loopCounter;
|
|
909
|
+
private MAX_LOOPS;
|
|
910
|
+
private operationQueue;
|
|
911
|
+
private simulatorTimeout?;
|
|
912
|
+
constructor(latencyType?: LatencyType, fixedLatency?: number);
|
|
913
|
+
private generateExecutionTime;
|
|
914
|
+
private getLatency;
|
|
915
|
+
accept(sourceConnection: SimulatorConnection, targetConnection: SimulatorConnection): void;
|
|
916
|
+
addConnector(connector: SimulatorConnector): void;
|
|
917
|
+
private executeConnectOperation;
|
|
918
|
+
private executeCloseOperation;
|
|
919
|
+
private executeSendOperation;
|
|
920
|
+
private executeQueuedOperations;
|
|
921
|
+
private scheduleNextTimeout;
|
|
922
|
+
private scheduleOperation;
|
|
923
|
+
connect(sourceConnection: SimulatorConnection, targetDescriptor: PeerDescriptor, connectedCallback: (error?: string) => void): void;
|
|
924
|
+
close(sourceConnection: SimulatorConnection): void;
|
|
925
|
+
send(sourceConnection: SimulatorConnection, data: Uint8Array): void;
|
|
926
|
+
stop(): void;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
interface IceServer {
|
|
930
|
+
url: string;
|
|
931
|
+
port: number;
|
|
932
|
+
username?: string;
|
|
933
|
+
password?: string;
|
|
934
|
+
tcp?: boolean;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
interface DhtRpcOptions extends ProtoRpcOptions {
|
|
938
|
+
targetDescriptor?: PeerDescriptor;
|
|
939
|
+
sourceDescriptor?: PeerDescriptor;
|
|
940
|
+
clientId?: number;
|
|
941
|
+
connect?: boolean;
|
|
942
|
+
sendIfStopped?: boolean;
|
|
943
|
+
bufferWhileConnecting?: boolean;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
declare class DhtCallContext extends ProtoCallContext implements DhtRpcOptions {
|
|
947
|
+
targetDescriptor?: PeerDescriptor;
|
|
948
|
+
sourceDescriptor?: PeerDescriptor;
|
|
949
|
+
clientId?: number;
|
|
950
|
+
connect?: boolean;
|
|
951
|
+
sendIfStopped?: boolean;
|
|
952
|
+
bufferWhileConnecting?: boolean;
|
|
953
|
+
incomingSourceDescriptor?: PeerDescriptor;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
type ServiceID = string;
|
|
957
|
+
|
|
958
|
+
declare class RoutingRpcCommunicator extends RpcCommunicator<DhtCallContext> {
|
|
959
|
+
private ownServiceId;
|
|
960
|
+
constructor(ownServiceId: ServiceID, sendFn: (msg: Message, opts: SendOptions) => Promise<void>, options?: RpcCommunicatorOptions);
|
|
961
|
+
handleMessageFromPeer(message: Message): void;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
declare class ListeningRpcCommunicator extends RoutingRpcCommunicator {
|
|
965
|
+
private readonly transport;
|
|
966
|
+
private readonly messageListener;
|
|
967
|
+
private readonly disconnectedListener;
|
|
968
|
+
constructor(ownServiceId: ServiceID, transport: ITransport, options?: RpcCommunicatorOptions);
|
|
969
|
+
destroy(): void;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
interface WebsocketServerConnectorOptions {
|
|
973
|
+
onNewConnection: (connection: PendingConnection) => boolean;
|
|
974
|
+
rpcCommunicator: ListeningRpcCommunicator;
|
|
975
|
+
hasConnection: (nodeId: DhtAddress) => boolean;
|
|
976
|
+
portRange?: PortRange;
|
|
977
|
+
maxMessageSize?: number;
|
|
978
|
+
host?: string;
|
|
979
|
+
entrypoints?: PeerDescriptor[];
|
|
980
|
+
tlsCertificate?: TlsCertificate;
|
|
981
|
+
autoCertifierTransport: ITransport;
|
|
982
|
+
autoCertifierUrl: string;
|
|
983
|
+
autoCertifierConfigFile: string;
|
|
984
|
+
serverEnableTls: boolean;
|
|
985
|
+
geoIpDatabaseFolder?: string;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
interface ConnectorFacade {
|
|
989
|
+
createConnection: (peerDescriptor: PeerDescriptor) => PendingConnection;
|
|
990
|
+
getLocalPeerDescriptor: () => PeerDescriptor | undefined;
|
|
991
|
+
start: (onNewConnection: (connection: PendingConnection) => boolean, hasConnection: (nodeId: DhtAddress) => boolean, autoCertifierTransport: ITransport) => Promise<void>;
|
|
992
|
+
stop: () => Promise<void>;
|
|
993
|
+
}
|
|
994
|
+
interface DefaultConnectorFacadeOptions {
|
|
995
|
+
transport: ITransport;
|
|
996
|
+
websocketHost?: string;
|
|
997
|
+
websocketPortRange?: PortRange;
|
|
998
|
+
entryPoints?: PeerDescriptor[];
|
|
999
|
+
iceServers?: IceServer[];
|
|
1000
|
+
webrtcAllowPrivateAddresses?: boolean;
|
|
1001
|
+
webrtcDatachannelBufferThresholdLow?: number;
|
|
1002
|
+
webrtcDatachannelBufferThresholdHigh?: number;
|
|
1003
|
+
externalIp?: string;
|
|
1004
|
+
webrtcPortRange?: PortRange;
|
|
1005
|
+
maxMessageSize?: number;
|
|
1006
|
+
tlsCertificate?: TlsCertificate;
|
|
1007
|
+
websocketServerEnableTls?: boolean;
|
|
1008
|
+
autoCertifierUrl?: string;
|
|
1009
|
+
autoCertifierConfigFile?: string;
|
|
1010
|
+
geoIpDatabaseFolder?: string;
|
|
1011
|
+
createLocalPeerDescriptor: (connectivityResponse: ConnectivityResponse) => Promise<PeerDescriptor>;
|
|
1012
|
+
}
|
|
1013
|
+
declare class DefaultConnectorFacade implements ConnectorFacade {
|
|
1014
|
+
private readonly options;
|
|
1015
|
+
private localPeerDescriptor?;
|
|
1016
|
+
private websocketConnectorRpcCommunicator?;
|
|
1017
|
+
private websocketClientConnector?;
|
|
1018
|
+
private websocketServerConnector?;
|
|
1019
|
+
private webrtcConnector?;
|
|
1020
|
+
constructor(options: DefaultConnectorFacadeOptions);
|
|
1021
|
+
start(onNewConnection: (connection: PendingConnection) => boolean, hasConnection: (nodeId: DhtAddress) => boolean, autoCertifierTransport: ITransport): Promise<void>;
|
|
1022
|
+
private setLocalPeerDescriptor;
|
|
1023
|
+
restartWebsocketServerConnector(options: WebsocketServerConnectorOptions): Promise<void>;
|
|
1024
|
+
createConnection(peerDescriptor: PeerDescriptor): PendingConnection;
|
|
1025
|
+
getLocalPeerDescriptor(): PeerDescriptor | undefined;
|
|
1026
|
+
stop(): Promise<void>;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
interface ConnectionsView {
|
|
1030
|
+
getConnections: () => PeerDescriptor[];
|
|
1031
|
+
getConnectionCount: () => number;
|
|
1032
|
+
hasConnection: (nodeId: DhtAddress) => boolean;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
interface ConnectionManagerOptions {
|
|
1036
|
+
maxConnections?: number;
|
|
1037
|
+
metricsContext: MetricsContext;
|
|
1038
|
+
allowIncomingPrivateConnections: boolean;
|
|
1039
|
+
createConnectorFacade: () => ConnectorFacade;
|
|
1040
|
+
}
|
|
1041
|
+
interface ConnectionLocker {
|
|
1042
|
+
lockConnection(targetDescriptor: PeerDescriptor, lockId: LockID): void;
|
|
1043
|
+
unlockConnection(targetDescriptor: PeerDescriptor, lockId: LockID): void;
|
|
1044
|
+
weakLockConnection(nodeId: DhtAddress, lockId: LockID): void;
|
|
1045
|
+
weakUnlockConnection(nodeId: DhtAddress, lockId: LockID): void;
|
|
1046
|
+
getLocalLockedConnectionCount(): number;
|
|
1047
|
+
getRemoteLockedConnectionCount(): number;
|
|
1048
|
+
getWeakLockedConnectionCount(): number;
|
|
1049
|
+
}
|
|
1050
|
+
interface PortRange {
|
|
1051
|
+
min: number;
|
|
1052
|
+
max: number;
|
|
1053
|
+
}
|
|
1054
|
+
interface TlsCertificate {
|
|
1055
|
+
privateKeyFileName: string;
|
|
1056
|
+
certFileName: string;
|
|
1057
|
+
}
|
|
1058
|
+
declare class ConnectionManager extends EventEmitter<TransportEvents> implements ITransport, ConnectionsView, ConnectionLocker {
|
|
1059
|
+
private options;
|
|
1060
|
+
private readonly metricsContext;
|
|
1061
|
+
private readonly duplicateMessageDetector;
|
|
1062
|
+
private readonly metrics;
|
|
1063
|
+
private locks;
|
|
1064
|
+
private endpoints;
|
|
1065
|
+
private readonly connectorFacade;
|
|
1066
|
+
private rpcCommunicator?;
|
|
1067
|
+
private disconnectorIntervalRef?;
|
|
1068
|
+
private state;
|
|
1069
|
+
private privateClientMode;
|
|
1070
|
+
constructor(options: ConnectionManagerOptions);
|
|
1071
|
+
private garbageCollectConnections;
|
|
1072
|
+
start(): Promise<void>;
|
|
1073
|
+
stop(): Promise<void>;
|
|
1074
|
+
getLocalLockedConnectionCount(): number;
|
|
1075
|
+
getRemoteLockedConnectionCount(): number;
|
|
1076
|
+
getWeakLockedConnectionCount(): number;
|
|
1077
|
+
send(message: Message, opts?: SendOptions): Promise<void>;
|
|
1078
|
+
private isConnectionToSelf;
|
|
1079
|
+
private isOwnWebsocketServer;
|
|
1080
|
+
getLocalPeerDescriptor(): PeerDescriptor;
|
|
1081
|
+
hasConnection(nodeId: DhtAddress): boolean;
|
|
1082
|
+
getConnectionCount(): number;
|
|
1083
|
+
hasLocalLockedConnection(nodeId: DhtAddress): boolean;
|
|
1084
|
+
hasRemoteLockedConnection(nodeId: DhtAddress): boolean;
|
|
1085
|
+
private handleMessage;
|
|
1086
|
+
private onData;
|
|
1087
|
+
private onConnected;
|
|
1088
|
+
private onDisconnected;
|
|
1089
|
+
private onNewConnection;
|
|
1090
|
+
private acceptNewConnection;
|
|
1091
|
+
private closeConnection;
|
|
1092
|
+
lockConnection(targetDescriptor: PeerDescriptor, lockId: LockID): void;
|
|
1093
|
+
unlockConnection(targetDescriptor: PeerDescriptor, lockId: LockID): void;
|
|
1094
|
+
weakLockConnection(nodeId: DhtAddress, lockId: LockID): void;
|
|
1095
|
+
weakUnlockConnection(nodeId: DhtAddress, lockId: LockID): void;
|
|
1096
|
+
enablePrivateClientMode(): Promise<void>;
|
|
1097
|
+
disablePrivateClientMode(): Promise<void>;
|
|
1098
|
+
private getConnectedEndpoints;
|
|
1099
|
+
isPrivateClientMode(): boolean;
|
|
1100
|
+
private setPrivateForConnection;
|
|
1101
|
+
private gracefullyDisconnectAsync;
|
|
1102
|
+
private doGracefullyDisconnectAsync;
|
|
1103
|
+
getConnections(): PeerDescriptor[];
|
|
1104
|
+
private onConnectionCountChange;
|
|
1105
|
+
getDiagnosticInfo(): Record<string, unknown>;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
type RingIdRaw = Uint8Array & {
|
|
1109
|
+
__ringIdRaw: never;
|
|
1110
|
+
};
|
|
1111
|
+
|
|
1112
|
+
interface RingContacts {
|
|
1113
|
+
left: PeerDescriptor[];
|
|
1114
|
+
right: PeerDescriptor[];
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
interface DhtNodeEvents extends TransportEvents {
|
|
1118
|
+
nearbyContactAdded: (peerDescriptor: PeerDescriptor) => void;
|
|
1119
|
+
nearbyContactRemoved: (peerDescriptor: PeerDescriptor) => void;
|
|
1120
|
+
randomContactAdded: (peerDescriptor: PeerDescriptor) => void;
|
|
1121
|
+
randomContactRemoved: (peerDescriptor: PeerDescriptor) => void;
|
|
1122
|
+
ringContactAdded: (peerDescriptor: PeerDescriptor) => void;
|
|
1123
|
+
ringContactRemoved: (peerDescriptor: PeerDescriptor) => void;
|
|
1124
|
+
manualRejoinRequired: () => void;
|
|
1125
|
+
}
|
|
1126
|
+
interface DhtNodeOptions {
|
|
1127
|
+
serviceId?: ServiceID;
|
|
1128
|
+
joinParallelism?: number;
|
|
1129
|
+
maxContactCount?: number;
|
|
1130
|
+
numberOfNodesPerKBucket?: number;
|
|
1131
|
+
joinNoProgressLimit?: number;
|
|
1132
|
+
peerDiscoveryQueryBatchSize?: number;
|
|
1133
|
+
dhtJoinTimeout?: number;
|
|
1134
|
+
metricsContext?: MetricsContext;
|
|
1135
|
+
storeHighestTtl?: number;
|
|
1136
|
+
storeMaxTtl?: number;
|
|
1137
|
+
networkConnectivityTimeout?: number;
|
|
1138
|
+
storageRedundancyFactor?: number;
|
|
1139
|
+
periodicallyPingNeighbors?: boolean;
|
|
1140
|
+
periodicallyPingRingContacts?: boolean;
|
|
1141
|
+
neighborPingLimit?: number;
|
|
1142
|
+
transport?: ITransport;
|
|
1143
|
+
connectionsView?: ConnectionsView;
|
|
1144
|
+
connectionLocker?: ConnectionLocker;
|
|
1145
|
+
peerDescriptor?: PeerDescriptor;
|
|
1146
|
+
entryPoints?: PeerDescriptor[];
|
|
1147
|
+
websocketHost?: string;
|
|
1148
|
+
websocketPortRange?: PortRange;
|
|
1149
|
+
websocketServerEnableTls?: boolean;
|
|
1150
|
+
nodeId?: DhtAddress;
|
|
1151
|
+
region?: number;
|
|
1152
|
+
rpcRequestTimeout?: number;
|
|
1153
|
+
iceServers?: IceServer[];
|
|
1154
|
+
webrtcAllowPrivateAddresses?: boolean;
|
|
1155
|
+
webrtcDatachannelBufferThresholdLow?: number;
|
|
1156
|
+
webrtcDatachannelBufferThresholdHigh?: number;
|
|
1157
|
+
webrtcPortRange?: PortRange;
|
|
1158
|
+
maxMessageSize?: number;
|
|
1159
|
+
maxConnections?: number;
|
|
1160
|
+
tlsCertificate?: TlsCertificate;
|
|
1161
|
+
externalIp?: string;
|
|
1162
|
+
autoCertifierUrl?: string;
|
|
1163
|
+
autoCertifierConfigFile?: string;
|
|
1164
|
+
geoIpDatabaseFolder?: string;
|
|
1165
|
+
allowIncomingPrivateConnections?: boolean;
|
|
1166
|
+
}
|
|
1167
|
+
declare class DhtNode extends EventEmitter<DhtNodeEvents> implements ITransport {
|
|
1168
|
+
private readonly options;
|
|
1169
|
+
private rpcCommunicator?;
|
|
1170
|
+
private transport?;
|
|
1171
|
+
private localPeerDescriptor?;
|
|
1172
|
+
private router?;
|
|
1173
|
+
private storeManager?;
|
|
1174
|
+
private localDataStore;
|
|
1175
|
+
private recursiveOperationManager?;
|
|
1176
|
+
private peerDiscovery?;
|
|
1177
|
+
private peerManager?;
|
|
1178
|
+
private connectionsView?;
|
|
1179
|
+
connectionLocker?: ConnectionLocker;
|
|
1180
|
+
private started;
|
|
1181
|
+
private abortController;
|
|
1182
|
+
constructor(conf: DhtNodeOptions);
|
|
1183
|
+
private validateOptions;
|
|
1184
|
+
start(): Promise<void>;
|
|
1185
|
+
private initPeerManager;
|
|
1186
|
+
private bindRpcLocalMethods;
|
|
1187
|
+
private handleMessageFromTransport;
|
|
1188
|
+
private handleMessageFromRouter;
|
|
1189
|
+
private generatePeerDescriptorCallBack;
|
|
1190
|
+
getClosestContacts(limit?: number): PeerDescriptor[];
|
|
1191
|
+
getRandomContacts(limit?: number): PeerDescriptor[];
|
|
1192
|
+
getRingContacts(): RingContacts;
|
|
1193
|
+
getClosestRingContactsTo(ringIdRaw: RingIdRaw, limit?: number): RingContacts;
|
|
1194
|
+
getNodeId(): DhtAddress;
|
|
1195
|
+
getNeighborCount(): number;
|
|
1196
|
+
removeContact(nodeId: DhtAddress): void;
|
|
1197
|
+
send(msg: Message): Promise<void>;
|
|
1198
|
+
private getConnectedEntryPoints;
|
|
1199
|
+
joinDht(entryPointDescriptors: PeerDescriptor[], doAdditionalDistantPeerDiscovery?: boolean, retry?: boolean): Promise<void>;
|
|
1200
|
+
joinRing(): Promise<void>;
|
|
1201
|
+
storeDataToDht(key: DhtAddress, data: Any, creator?: DhtAddress): Promise<PeerDescriptor[]>;
|
|
1202
|
+
storeDataToDhtViaPeer(key: DhtAddress, data: Any, peer: PeerDescriptor): Promise<PeerDescriptor[]>;
|
|
1203
|
+
fetchDataFromDht(key: DhtAddress): Promise<DataEntry[]>;
|
|
1204
|
+
fetchDataFromDhtViaPeer(key: DhtAddress, peer: PeerDescriptor): Promise<DataEntry[]>;
|
|
1205
|
+
private executeRecursiveOperation;
|
|
1206
|
+
deleteDataFromDht(key: DhtAddress, waitForCompletion: boolean): Promise<void>;
|
|
1207
|
+
findClosestNodesFromDht(key: DhtAddress): Promise<PeerDescriptor[]>;
|
|
1208
|
+
private findClosestNodesViaPeer;
|
|
1209
|
+
getTransport(): ITransport;
|
|
1210
|
+
getLocalPeerDescriptor(): PeerDescriptor;
|
|
1211
|
+
getNeighbors(): PeerDescriptor[];
|
|
1212
|
+
getConnectionsView(): ConnectionsView;
|
|
1213
|
+
getLocalLockedConnectionCount(): number;
|
|
1214
|
+
getRemoteLockedConnectionCount(): number;
|
|
1215
|
+
getWeakLockedConnectionCount(): number;
|
|
1216
|
+
waitForNetworkConnectivity(): Promise<void>;
|
|
1217
|
+
hasJoined(): boolean;
|
|
1218
|
+
getDiagnosticInfo(): Record<string, unknown>;
|
|
1219
|
+
stop(): Promise<void>;
|
|
1220
|
+
private createDhtNodeRpcRemote;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
declare class SimulatorTransport extends ConnectionManager {
|
|
1224
|
+
constructor(localPeerDescriptor: PeerDescriptor, simulator: Simulator);
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
declare function getRegionDelayMatrix(): number[][];
|
|
1228
|
+
declare function getRandomRegion(): number;
|
|
1229
|
+
|
|
1230
|
+
declare const EXISTING_CONNECTION_TIMEOUT = 5000;
|
|
1231
|
+
declare abstract class RpcRemote<T extends ServiceInfo & ClassType> {
|
|
1232
|
+
private readonly localPeerDescriptor;
|
|
1233
|
+
private readonly remotePeerDescriptor;
|
|
1234
|
+
private readonly client;
|
|
1235
|
+
private readonly timeout?;
|
|
1236
|
+
constructor(localPeerDescriptor: PeerDescriptor, remotePeerDescriptor: PeerDescriptor, rpcCommunicator: RpcCommunicator<DhtCallContext>, clientClass: {
|
|
1237
|
+
new (clientTransport: ClientTransport): T;
|
|
1238
|
+
}, timeout?: number);
|
|
1239
|
+
getPeerDescriptor(): PeerDescriptor;
|
|
1240
|
+
getLocalPeerDescriptor(): PeerDescriptor;
|
|
1241
|
+
getClient(): ProtoRpcClient<T>;
|
|
1242
|
+
formDhtRpcOptions(opts?: Omit<DhtRpcOptions, 'sourceDescriptor' | 'targetDescriptor'>): DhtRpcOptions;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
interface Socket {
|
|
1246
|
+
binaryType: string;
|
|
1247
|
+
readyState: number;
|
|
1248
|
+
close(code?: number, reason?: string): void;
|
|
1249
|
+
send(data: string | Buffer | ArrayBuffer | ArrayBufferView): void;
|
|
1250
|
+
}
|
|
1251
|
+
declare abstract class AbstractWebsocketClientConnection extends EventEmitter<ConnectionEvents> implements IConnection {
|
|
1252
|
+
readonly connectionId: ConnectionID;
|
|
1253
|
+
protected abstract socket?: Socket;
|
|
1254
|
+
connectionType: ConnectionType;
|
|
1255
|
+
protected destroyed: boolean;
|
|
1256
|
+
constructor();
|
|
1257
|
+
abstract connect(address: string, allowSelfSignedCertificate: boolean): void;
|
|
1258
|
+
protected abstract stopListening(): void;
|
|
1259
|
+
send(data: Uint8Array): void;
|
|
1260
|
+
close(gracefulLeave: boolean): Promise<void>;
|
|
1261
|
+
destroy(): void;
|
|
1262
|
+
protected onOpen(): void;
|
|
1263
|
+
protected onMessage(message: Uint8Array): void;
|
|
1264
|
+
protected onClose(code: number, reason: string): void;
|
|
1265
|
+
protected onError(error: Error): void;
|
|
1266
|
+
protected doDisconnect(code?: number, reason?: string): void;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
declare class WebsocketClientConnection extends AbstractWebsocketClientConnection {
|
|
1270
|
+
protected socket?: w3cwebsocket;
|
|
1271
|
+
connect(address: string, selfSigned?: boolean): void;
|
|
1272
|
+
protected stopListening(): void;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
interface ManagedConnectionEvents {
|
|
1276
|
+
managedData: (bytes: Uint8Array, remotePeerDescriptor: PeerDescriptor) => void;
|
|
1277
|
+
disconnected: (gracefulLeave: boolean) => void;
|
|
1278
|
+
}
|
|
1279
|
+
declare class ManagedConnection extends EventEmitter<ManagedConnectionEvents> {
|
|
1280
|
+
private connection;
|
|
1281
|
+
connectionId: ConnectionID;
|
|
1282
|
+
private remotePeerDescriptor;
|
|
1283
|
+
private lastUsedTimestamp;
|
|
1284
|
+
private replacedAsDuplicate;
|
|
1285
|
+
private stopped;
|
|
1286
|
+
private openedAt;
|
|
1287
|
+
private bytesSent;
|
|
1288
|
+
private bytesReceived;
|
|
1289
|
+
private messagesSent;
|
|
1290
|
+
private messagesReceived;
|
|
1291
|
+
constructor(peerDescriptor: PeerDescriptor, connection: IConnection);
|
|
1292
|
+
private onDisconnected;
|
|
1293
|
+
replaceAsDuplicate(): void;
|
|
1294
|
+
send(data: Uint8Array): void;
|
|
1295
|
+
close(gracefulLeave: boolean): Promise<void>;
|
|
1296
|
+
getNodeId(): DhtAddress;
|
|
1297
|
+
getLastUsedTimestamp(): number;
|
|
1298
|
+
getPeerDescriptor(): PeerDescriptor | undefined;
|
|
1299
|
+
getDiagnosticInfo(): Record<string, unknown>;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
interface HandshakerEvents {
|
|
1303
|
+
handshakeRequest: (source: PeerDescriptor, protocolVersion: string, target?: PeerDescriptor) => void;
|
|
1304
|
+
handshakeCompleted: (remote: PeerDescriptor) => void;
|
|
1305
|
+
handshakeFailed: (error?: HandshakeError) => void;
|
|
1306
|
+
}
|
|
1307
|
+
declare const createOutgoingHandshaker: (localPeerDescriptor: PeerDescriptor, pendingConnection: PendingConnection, connection: IConnection, targetPeerDescriptor?: PeerDescriptor) => Handshaker;
|
|
1308
|
+
declare class Handshaker extends EventEmitter<HandshakerEvents> {
|
|
1309
|
+
static readonly HANDSHAKER_SERVICE_ID = "system/handshaker";
|
|
1310
|
+
private localPeerDescriptor;
|
|
1311
|
+
private connection;
|
|
1312
|
+
private readonly onDataListener;
|
|
1313
|
+
constructor(localPeerDescriptor: PeerDescriptor, connection: IConnection);
|
|
1314
|
+
private onData;
|
|
1315
|
+
sendHandshakeRequest(remotePeerDescriptor?: PeerDescriptor): void;
|
|
1316
|
+
sendHandshakeResponse(error?: HandshakeError): void;
|
|
1317
|
+
stop(): void;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
export { ConnectionManager, ConnectionType, DataEntry, DefaultConnectorFacade, DhtCallContext, DhtNode, EXISTING_CONNECTION_TIMEOUT, LatencyType, ListeningRpcCommunicator, ManagedConnection, Message, NodeType, PeerDescriptor, PendingConnection, RoutingRpcCommunicator, RpcRemote, Simulator, SimulatorTransport, WebsocketClientConnection, areEqualPeerDescriptors, createOutgoingHandshaker, getRandomRegion, getRegionDelayMatrix, randomDhtAddress, toDhtAddress, toDhtAddressRaw, toNodeId };
|
|
1321
|
+
export type { ConnectionLocker, ConnectionsView, DhtAddress, DhtAddressRaw, DhtNodeEvents, DhtNodeOptions, DhtRpcOptions, IConnection, ITransport, IceServer, LockID, PortRange, RingContacts, ServiceID, TlsCertificate, TransportEvents };
|