diff --git a/packages/dht/generated/packages/dht/protos/DhtRpc.ts b/packages/dht/generated/packages/dht/protos/DhtRpc.ts index 2f181040a4..48fc3bc658 100644 --- a/packages/dht/generated/packages/dht/protos/DhtRpc.ts +++ b/packages/dht/generated/packages/dht/protos/DhtRpc.ts @@ -5,8 +5,6 @@ import { Empty } from "../../../google/protobuf/empty"; import { ServiceType } from "@protobuf-ts/runtime-rpc"; import { MessageType } from "@protobuf-ts/runtime"; import { RpcMessage } from "../../proto-rpc/protos/ProtoRpc"; -import { ConnectivityMethod } from "./PeerDescriptor"; -import { PeerDescriptor } from "./PeerDescriptor"; import { Timestamp } from "../../../google/protobuf/timestamp"; import { Any } from "../../../google/protobuf/any"; // Used inside RpcMessage @@ -59,7 +57,7 @@ export interface ExternalStoreDataRequest { */ export interface ExternalStoreDataResponse { /** - * @generated from protobuf field: repeated peerDescriptor.PeerDescriptor storers = 1; + * @generated from protobuf field: repeated dht.PeerDescriptor storers = 1; */ storers: PeerDescriptor[]; } @@ -131,7 +129,7 @@ export interface ClosestPeersRequest { */ export interface ClosestPeersResponse { /** - * @generated from protobuf field: repeated peerDescriptor.PeerDescriptor peers = 1; + * @generated from protobuf field: repeated dht.PeerDescriptor peers = 1; */ peers: PeerDescriptor[]; /** @@ -161,11 +159,11 @@ export interface ClosestRingPeersRequest { */ export interface ClosestRingPeersResponse { /** - * @generated from protobuf field: repeated peerDescriptor.PeerDescriptor leftPeers = 1; + * @generated from protobuf field: repeated dht.PeerDescriptor leftPeers = 1; */ leftPeers: PeerDescriptor[]; /** - * @generated from protobuf field: repeated peerDescriptor.PeerDescriptor rightPeers = 2; + * @generated from protobuf field: repeated dht.PeerDescriptor rightPeers = 2; */ rightPeers: PeerDescriptor[]; /** @@ -191,7 +189,7 @@ export interface RecursiveOperationRequest { */ export interface RecursiveOperationResponse { /** - * @generated from protobuf field: repeated peerDescriptor.PeerDescriptor closestConnectedNodes = 1; + * @generated from protobuf field: repeated dht.PeerDescriptor closestConnectedNodes = 1; */ closestConnectedNodes: PeerDescriptor[]; /** @@ -203,7 +201,7 @@ export interface RecursiveOperationResponse { */ noCloserNodesFound: boolean; /** - * @generated from protobuf field: repeated peerDescriptor.PeerDescriptor routingPath = 4; + * @generated from protobuf field: repeated dht.PeerDescriptor routingPath = 4; */ routingPath: PeerDescriptor[]; } @@ -230,6 +228,66 @@ export interface PingResponse { */ export interface LeaveNotice { } +/** + * @generated from protobuf message dht.PeerDescriptor + */ +export interface PeerDescriptor { + /** + * @generated from protobuf field: bytes nodeId = 1; + */ + nodeId: Uint8Array; + /** + * @generated from protobuf field: dht.NodeType type = 2; + */ + type: NodeType; + /** + * @generated from protobuf field: dht.ConnectivityMethod udp = 3; + */ + udp?: ConnectivityMethod; + /** + * @generated from protobuf field: dht.ConnectivityMethod tcp = 4; + */ + tcp?: ConnectivityMethod; + /** + * @generated from protobuf field: dht.ConnectivityMethod websocket = 5; + */ + websocket?: ConnectivityMethod; + /** + * @generated from protobuf field: optional uint32 region = 6; + */ + region?: number; + /** + * @generated from protobuf field: optional uint32 ipAddress = 7; + */ + ipAddress?: number; + /** + * @generated from protobuf field: optional bytes publicKey = 8; + */ + publicKey?: Uint8Array; + /** + * signature of fields 2-8 + * + * @generated from protobuf field: optional bytes signature = 9; + */ + signature?: Uint8Array; +} +/** + * @generated from protobuf message dht.ConnectivityMethod + */ +export interface ConnectivityMethod { + /** + * @generated from protobuf field: uint32 port = 1; + */ + port: number; + /** + * @generated from protobuf field: string host = 2; + */ + host: string; + /** + * @generated from protobuf field: bool tls = 3; + */ + tls: boolean; +} /** * @generated from protobuf message dht.RouteMessageWrapper */ @@ -239,7 +297,7 @@ export interface RouteMessageWrapper { */ requestId: string; /** - * @generated from protobuf field: peerDescriptor.PeerDescriptor sourcePeer = 2; + * @generated from protobuf field: dht.PeerDescriptor sourcePeer = 2; */ sourcePeer?: PeerDescriptor; /** @@ -251,11 +309,11 @@ export interface RouteMessageWrapper { */ message?: Message; /** - * @generated from protobuf field: repeated peerDescriptor.PeerDescriptor reachableThrough = 5; + * @generated from protobuf field: repeated dht.PeerDescriptor reachableThrough = 5; */ reachableThrough: PeerDescriptor[]; /** - * @generated from protobuf field: repeated peerDescriptor.PeerDescriptor routingPath = 6; + * @generated from protobuf field: repeated dht.PeerDescriptor routingPath = 6; */ routingPath: PeerDescriptor[]; /** @@ -310,7 +368,7 @@ export interface ConnectivityResponse { */ natType: string; /** - * @generated from protobuf field: peerDescriptor.ConnectivityMethod websocket = 3; + * @generated from protobuf field: dht.ConnectivityMethod websocket = 3; */ websocket?: ConnectivityMethod; /** @@ -335,11 +393,11 @@ export interface ConnectivityResponse { */ export interface HandshakeRequest { /** - * @generated from protobuf field: peerDescriptor.PeerDescriptor sourcePeerDescriptor = 1; + * @generated from protobuf field: dht.PeerDescriptor sourcePeerDescriptor = 1; */ sourcePeerDescriptor?: PeerDescriptor; /** - * @generated from protobuf field: optional peerDescriptor.PeerDescriptor targetPeerDescriptor = 2; + * @generated from protobuf field: optional dht.PeerDescriptor targetPeerDescriptor = 2; */ targetPeerDescriptor?: PeerDescriptor; /** @@ -352,7 +410,7 @@ export interface HandshakeRequest { */ export interface HandshakeResponse { /** - * @generated from protobuf field: peerDescriptor.PeerDescriptor sourcePeerDescriptor = 1; + * @generated from protobuf field: dht.PeerDescriptor sourcePeerDescriptor = 1; */ sourcePeerDescriptor?: PeerDescriptor; /** @@ -375,11 +433,11 @@ export interface Message { */ messageId: string; /** - * @generated from protobuf field: peerDescriptor.PeerDescriptor sourceDescriptor = 2; + * @generated from protobuf field: dht.PeerDescriptor sourceDescriptor = 2; */ sourceDescriptor?: PeerDescriptor; /** - * @generated from protobuf field: peerDescriptor.PeerDescriptor targetDescriptor = 3; + * @generated from protobuf field: dht.PeerDescriptor targetDescriptor = 3; */ targetDescriptor?: PeerDescriptor; /** @@ -568,6 +626,19 @@ export enum RecursiveOperation { */ DELETE_DATA = 2 } +/** + * @generated from protobuf enum dht.NodeType + */ +export enum NodeType { + /** + * @generated from protobuf enum value: NODEJS = 0; + */ + NODEJS = 0, + /** + * @generated from protobuf enum value: BROWSER = 1; + */ + BROWSER = 1 +} /** * @generated from protobuf enum dht.RpcResponseError */ @@ -837,6 +908,40 @@ class LeaveNotice$Type extends MessageType { */ export const LeaveNotice = new LeaveNotice$Type(); // @generated message type with reflection information, may provide speed optimized methods +class PeerDescriptor$Type extends MessageType { + constructor() { + super("dht.PeerDescriptor", [ + { no: 1, name: "nodeId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "type", kind: "enum", T: () => ["dht.NodeType", NodeType] }, + { no: 3, name: "udp", kind: "message", T: () => ConnectivityMethod }, + { no: 4, name: "tcp", kind: "message", T: () => ConnectivityMethod }, + { no: 5, name: "websocket", kind: "message", T: () => ConnectivityMethod }, + { no: 6, name: "region", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, + { no: 7, name: "ipAddress", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, + { no: 8, name: "publicKey", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ }, + { no: 9, name: "signature", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.PeerDescriptor + */ +export const PeerDescriptor = new PeerDescriptor$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ConnectivityMethod$Type extends MessageType { + constructor() { + super("dht.ConnectivityMethod", [ + { no: 1, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 2, name: "host", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 3, name: "tls", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ConnectivityMethod + */ +export const ConnectivityMethod = new ConnectivityMethod$Type(); +// @generated message type with reflection information, may provide speed optimized methods class RouteMessageWrapper$Type extends MessageType { constructor() { super("dht.RouteMessageWrapper", [ diff --git a/packages/dht/generated/packages/dht/protos/PeerDescriptor.ts b/packages/dht/generated/packages/dht/protos/PeerDescriptor.ts deleted file mode 100644 index 1f19652ec8..0000000000 --- a/packages/dht/generated/packages/dht/protos/PeerDescriptor.ts +++ /dev/null @@ -1,111 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/dht/protos/PeerDescriptor.proto" (package "peerDescriptor", syntax proto3) -// tslint:disable -import { MessageType } from "@protobuf-ts/runtime"; -/** - * @generated from protobuf message peerDescriptor.PeerDescriptor - */ -export interface PeerDescriptor { - /** - * @generated from protobuf field: bytes nodeId = 1; - */ - nodeId: Uint8Array; - /** - * @generated from protobuf field: peerDescriptor.NodeType type = 2; - */ - type: NodeType; - /** - * @generated from protobuf field: peerDescriptor.ConnectivityMethod udp = 3; - */ - udp?: ConnectivityMethod; - /** - * @generated from protobuf field: peerDescriptor.ConnectivityMethod tcp = 4; - */ - tcp?: ConnectivityMethod; - /** - * @generated from protobuf field: peerDescriptor.ConnectivityMethod websocket = 5; - */ - websocket?: ConnectivityMethod; - /** - * @generated from protobuf field: optional uint32 region = 6; - */ - region?: number; - /** - * @generated from protobuf field: optional uint32 ipAddress = 7; - */ - ipAddress?: number; - /** - * @generated from protobuf field: optional bytes publicKey = 8; - */ - publicKey?: Uint8Array; - /** - * signature of fields 2-8 - * - * @generated from protobuf field: optional bytes signature = 9; - */ - signature?: Uint8Array; -} -/** - * @generated from protobuf message peerDescriptor.ConnectivityMethod - */ -export interface ConnectivityMethod { - /** - * @generated from protobuf field: uint32 port = 1; - */ - port: number; - /** - * @generated from protobuf field: string host = 2; - */ - host: string; - /** - * @generated from protobuf field: bool tls = 3; - */ - tls: boolean; -} -/** - * @generated from protobuf enum peerDescriptor.NodeType - */ -export enum NodeType { - /** - * @generated from protobuf enum value: NODEJS = 0; - */ - NODEJS = 0, - /** - * @generated from protobuf enum value: BROWSER = 1; - */ - BROWSER = 1 -} -// @generated message type with reflection information, may provide speed optimized methods -class PeerDescriptor$Type extends MessageType { - constructor() { - super("peerDescriptor.PeerDescriptor", [ - { no: 1, name: "nodeId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 2, name: "type", kind: "enum", T: () => ["peerDescriptor.NodeType", NodeType] }, - { no: 3, name: "udp", kind: "message", T: () => ConnectivityMethod }, - { no: 4, name: "tcp", kind: "message", T: () => ConnectivityMethod }, - { no: 5, name: "websocket", kind: "message", T: () => ConnectivityMethod }, - { no: 6, name: "region", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, - { no: 7, name: "ipAddress", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, - { no: 8, name: "publicKey", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ }, - { no: 9, name: "signature", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message peerDescriptor.PeerDescriptor - */ -export const PeerDescriptor = new PeerDescriptor$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ConnectivityMethod$Type extends MessageType { - constructor() { - super("peerDescriptor.ConnectivityMethod", [ - { no: 1, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, - { no: 2, name: "host", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "tls", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message peerDescriptor.ConnectivityMethod - */ -export const ConnectivityMethod = new ConnectivityMethod$Type(); diff --git a/packages/dht/protos/DhtRpc.proto b/packages/dht/protos/DhtRpc.proto index b9a0c8ad29..51ab80c40c 100644 --- a/packages/dht/protos/DhtRpc.proto +++ b/packages/dht/protos/DhtRpc.proto @@ -7,7 +7,6 @@ import "google/protobuf/empty.proto"; import "google/protobuf/any.proto"; import "google/protobuf/timestamp.proto"; import "packages/proto-rpc/protos/ProtoRpc.proto"; -import "packages/dht/protos/PeerDescriptor.proto"; service DhtNodeRpc { // TODO rename to getClosestNeighbors (breaking change) @@ -78,7 +77,7 @@ message ExternalStoreDataRequest { } message ExternalStoreDataResponse { - repeated peerDescriptor.PeerDescriptor storers = 1; + repeated PeerDescriptor storers = 1; } message ReplicateDataRequest { @@ -104,7 +103,7 @@ message ClosestPeersRequest { // TODO rename to ClosestNeighborsResponse message ClosestPeersResponse { - repeated peerDescriptor.PeerDescriptor peers = 1; + repeated PeerDescriptor peers = 1; string requestId = 2; } @@ -116,8 +115,8 @@ message ClosestRingPeersRequest { // TODO rename to ClosestRingContactsResponse message ClosestRingPeersResponse { - repeated peerDescriptor.PeerDescriptor leftPeers = 1; - repeated peerDescriptor.PeerDescriptor rightPeers = 2; + repeated PeerDescriptor leftPeers = 1; + repeated PeerDescriptor rightPeers = 2; string requestId = 3; } @@ -133,10 +132,10 @@ enum RecursiveOperation { } message RecursiveOperationResponse { - repeated peerDescriptor.PeerDescriptor closestConnectedNodes = 1; + repeated PeerDescriptor closestConnectedNodes = 1; repeated DataEntry dataEntries = 2; bool noCloserNodesFound = 3; - repeated peerDescriptor.PeerDescriptor routingPath = 4; + repeated PeerDescriptor routingPath = 4; } message PingRequest { @@ -150,6 +149,30 @@ message PingResponse { message LeaveNotice { } +message PeerDescriptor { + bytes nodeId = 1; + NodeType type = 2; + ConnectivityMethod udp = 3; + ConnectivityMethod tcp = 4; + ConnectivityMethod websocket = 5; + optional uint32 region = 6; + optional uint32 ipAddress = 7; + optional bytes publicKey = 8; + // signature of fields 2-8 + optional bytes signature = 9; +} + +message ConnectivityMethod { + uint32 port = 1; + string host = 2; + bool tls = 3; +} + +enum NodeType { + NODEJS = 0; + BROWSER = 1; +} + enum RpcResponseError { SERVER_TIMOUT = 0; CLIENT_TIMEOUT = 1; @@ -159,11 +182,11 @@ enum RpcResponseError { message RouteMessageWrapper { string requestId = 1; - peerDescriptor.PeerDescriptor sourcePeer = 2; + PeerDescriptor sourcePeer = 2; bytes target = 3; Message message = 4; - repeated peerDescriptor.PeerDescriptor reachableThrough = 5; - repeated peerDescriptor.PeerDescriptor routingPath = 6; + repeated PeerDescriptor reachableThrough = 5; + repeated PeerDescriptor routingPath = 6; repeated string parallelRootNodeIds = 7; } @@ -190,7 +213,7 @@ message ConnectivityRequest { message ConnectivityResponse { string host = 1; string natType = 2; - peerDescriptor.ConnectivityMethod websocket = 3; + ConnectivityMethod websocket = 3; uint32 ipAddress = 4; string version = 5; optional double latitude = 6; @@ -198,13 +221,13 @@ message ConnectivityResponse { } message HandshakeRequest { - peerDescriptor.PeerDescriptor sourcePeerDescriptor = 1; - optional peerDescriptor.PeerDescriptor targetPeerDescriptor = 2; + PeerDescriptor sourcePeerDescriptor = 1; + optional PeerDescriptor targetPeerDescriptor = 2; string version = 3; } message HandshakeResponse { - peerDescriptor.PeerDescriptor sourcePeerDescriptor = 1; + PeerDescriptor sourcePeerDescriptor = 1; optional HandshakeError error = 2; string version = 3; } @@ -219,8 +242,8 @@ enum HandshakeError { message Message { string messageId = 1; - peerDescriptor.PeerDescriptor sourceDescriptor = 2; - peerDescriptor.PeerDescriptor targetDescriptor = 3; + PeerDescriptor sourceDescriptor = 2; + PeerDescriptor targetDescriptor = 3; string serviceId = 4; // id of the RPC service oneof body { protorpc.RpcMessage rpcMessage = 5; diff --git a/packages/dht/protos/PeerDescriptor.proto b/packages/dht/protos/PeerDescriptor.proto deleted file mode 100644 index 73553c452e..0000000000 --- a/packages/dht/protos/PeerDescriptor.proto +++ /dev/null @@ -1,28 +0,0 @@ -syntax = "proto3"; -option optimize_for = CODE_SIZE; - -package peerDescriptor; - -message PeerDescriptor { - bytes nodeId = 1; - NodeType type = 2; - ConnectivityMethod udp = 3; - ConnectivityMethod tcp = 4; - ConnectivityMethod websocket = 5; - optional uint32 region = 6; - optional uint32 ipAddress = 7; - optional bytes publicKey = 8; - // signature of fields 2-8 - optional bytes signature = 9; -} - -message ConnectivityMethod { - uint32 port = 1; - string host = 2; - bool tls = 3; -} - -enum NodeType { - NODEJS = 0; - BROWSER = 1; -} \ No newline at end of file diff --git a/packages/dht/src/connection/Connection.ts b/packages/dht/src/connection/Connection.ts index 547dae0156..a0bf8a052e 100644 --- a/packages/dht/src/connection/Connection.ts +++ b/packages/dht/src/connection/Connection.ts @@ -1,5 +1,5 @@ import EventEmitter from 'eventemitter3' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { ConnectionID, ConnectionType, ConnectionEvents } from './IConnection' import { v4 as uuid } from 'uuid' diff --git a/packages/dht/src/connection/ConnectionLockRpcLocal.ts b/packages/dht/src/connection/ConnectionLockRpcLocal.ts index 4cea169a70..7d593240a7 100644 --- a/packages/dht/src/connection/ConnectionLockRpcLocal.ts +++ b/packages/dht/src/connection/ConnectionLockRpcLocal.ts @@ -6,10 +6,10 @@ import { DisconnectNotice, LockRequest, LockResponse, + PeerDescriptor, UnlockRequest, SetPrivateRequest } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' import { IConnectionLockRpc } from '../../generated/packages/dht/protos/DhtRpc.server' import { DhtCallContext } from '../rpc-protocol/DhtCallContext' import { getNodeIdOrUnknownFromPeerDescriptor } from './ConnectionManager' diff --git a/packages/dht/src/connection/ConnectionManager.ts b/packages/dht/src/connection/ConnectionManager.ts index 275d3b1852..b2d91bd6e2 100644 --- a/packages/dht/src/connection/ConnectionManager.ts +++ b/packages/dht/src/connection/ConnectionManager.ts @@ -9,10 +9,10 @@ import { LockRequest, LockResponse, Message, + PeerDescriptor, UnlockRequest, SetPrivateRequest } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' import { ConnectionLockRpcClient } from '../../generated/packages/dht/protos/DhtRpc.client' import { DEFAULT_SEND_OPTIONS, ITransport, SendOptions, TransportEvents } from '../transport/ITransport' import { RoutingRpcCommunicator } from '../transport/RoutingRpcCommunicator' diff --git a/packages/dht/src/connection/ConnectionsView.ts b/packages/dht/src/connection/ConnectionsView.ts index 1f2f4c4423..346d1516cb 100644 --- a/packages/dht/src/connection/ConnectionsView.ts +++ b/packages/dht/src/connection/ConnectionsView.ts @@ -1,5 +1,5 @@ import { DhtAddress } from '../identifiers' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' export interface ConnectionsView { getConnections: () => PeerDescriptor[] diff --git a/packages/dht/src/connection/ConnectorFacade.ts b/packages/dht/src/connection/ConnectorFacade.ts index 6e02e53463..eb86844c22 100644 --- a/packages/dht/src/connection/ConnectorFacade.ts +++ b/packages/dht/src/connection/ConnectorFacade.ts @@ -1,6 +1,8 @@ import { Logger } from '@streamr/utils' -import { ConnectivityResponse } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { + ConnectivityResponse, + PeerDescriptor +} from '../../generated/packages/dht/protos/DhtRpc' import { ITransport } from '../transport/ITransport' import { PortRange, TlsCertificate } from './ConnectionManager' import { Simulator } from './simulator/Simulator' diff --git a/packages/dht/src/connection/Handshaker.ts b/packages/dht/src/connection/Handshaker.ts index 03fdca1d67..a0611762f7 100644 --- a/packages/dht/src/connection/Handshaker.ts +++ b/packages/dht/src/connection/Handshaker.ts @@ -1,8 +1,7 @@ import { Logger } from '@streamr/utils' import { EventEmitter } from 'eventemitter3' import { v4 } from 'uuid' -import { Message, HandshakeRequest, HandshakeResponse, HandshakeError } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { Message, HandshakeRequest, HandshakeResponse, PeerDescriptor, HandshakeError } from '../../generated/packages/dht/protos/DhtRpc' import { IConnection } from './IConnection' import { LOCAL_PROTOCOL_VERSION, isMaybeSupportedVersion } from '../helpers/version' import { toNodeId } from '../identifiers' diff --git a/packages/dht/src/connection/ManagedConnection.ts b/packages/dht/src/connection/ManagedConnection.ts index d9372507a3..34ce8b5fd3 100644 --- a/packages/dht/src/connection/ManagedConnection.ts +++ b/packages/dht/src/connection/ManagedConnection.ts @@ -1,6 +1,6 @@ import { ConnectionID, IConnection } from './IConnection' import * as Err from '../helpers/errors' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { Logger } from '@streamr/utils' import EventEmitter from 'eventemitter3' import { getNodeIdOrUnknownFromPeerDescriptor } from './ConnectionManager' diff --git a/packages/dht/src/connection/PendingConnection.ts b/packages/dht/src/connection/PendingConnection.ts index c6deb72f06..035b5cb430 100644 --- a/packages/dht/src/connection/PendingConnection.ts +++ b/packages/dht/src/connection/PendingConnection.ts @@ -1,5 +1,5 @@ import EventEmitter from 'eventemitter3' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { Logger, setAbortableTimeout } from '@streamr/utils' import { getNodeIdOrUnknownFromPeerDescriptor } from './ConnectionManager' import { IConnection } from './IConnection' diff --git a/packages/dht/src/connection/connectivityChecker.ts b/packages/dht/src/connection/connectivityChecker.ts index 17cd789242..031efe1003 100644 --- a/packages/dht/src/connection/connectivityChecker.ts +++ b/packages/dht/src/connection/connectivityChecker.ts @@ -1,8 +1,10 @@ import { Logger, RunAndRaceEventsReturnType, runAndRaceEvents3 } from '@streamr/utils' import { v4 } from 'uuid' import * as Err from '../helpers/errors' -import { ConnectivityRequest, ConnectivityResponse, Message } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { + ConnectivityRequest, ConnectivityResponse, + Message, PeerDescriptor +} from '../../generated/packages/dht/protos/DhtRpc' import { ConnectionEvents, IConnection } from './IConnection' import { WebsocketClientConnection } from './websocket/NodeWebsocketClientConnection' import { connectivityMethodToWebsocketUrl } from './websocket/WebsocketClientConnector' diff --git a/packages/dht/src/connection/simulator/Simulator.ts b/packages/dht/src/connection/simulator/Simulator.ts index d8d2c6eb31..1c8e9b04a2 100644 --- a/packages/dht/src/connection/simulator/Simulator.ts +++ b/packages/dht/src/connection/simulator/Simulator.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/parameter-properties */ -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' import { SimulatorConnector } from './SimulatorConnector' import { SimulatorConnection } from './SimulatorConnection' import { ConnectionID } from '../IConnection' diff --git a/packages/dht/src/connection/simulator/SimulatorConnection.ts b/packages/dht/src/connection/simulator/SimulatorConnection.ts index 6f64e15f08..ccff76c818 100644 --- a/packages/dht/src/connection/simulator/SimulatorConnection.ts +++ b/packages/dht/src/connection/simulator/SimulatorConnection.ts @@ -1,7 +1,6 @@ import { ConnectionType, IConnection } from '../IConnection' import { Simulator } from './Simulator' -import { Message } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { Message, PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' import { Connection } from '../Connection' import { Logger } from '@streamr/utils' import { protoToString } from '../../helpers/protoToString' diff --git a/packages/dht/src/connection/simulator/SimulatorConnector.ts b/packages/dht/src/connection/simulator/SimulatorConnector.ts index 544626b6f9..b456360703 100644 --- a/packages/dht/src/connection/simulator/SimulatorConnector.ts +++ b/packages/dht/src/connection/simulator/SimulatorConnector.ts @@ -1,6 +1,9 @@ import { ConnectionType } from '../IConnection' -import { HandshakeError } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' + +import { + HandshakeError, + PeerDescriptor, +} from '../../../generated/packages/dht/protos/DhtRpc' import { Logger } from '@streamr/utils' import { Simulator } from './Simulator' import { SimulatorConnection } from './SimulatorConnection' diff --git a/packages/dht/src/connection/simulator/SimulatorTransport.ts b/packages/dht/src/connection/simulator/SimulatorTransport.ts index f6431ff4f0..c1caeeb646 100644 --- a/packages/dht/src/connection/simulator/SimulatorTransport.ts +++ b/packages/dht/src/connection/simulator/SimulatorTransport.ts @@ -1,5 +1,5 @@ import { MetricsContext } from '@streamr/utils' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' import { ConnectionManager } from '../ConnectionManager' import { Simulator } from './Simulator' import { SimulatorConnectorFacade } from '../ConnectorFacade' diff --git a/packages/dht/src/connection/webrtc/NodeWebrtcConnection.ts b/packages/dht/src/connection/webrtc/NodeWebrtcConnection.ts index 0bb856e27a..f3258ef1a7 100644 --- a/packages/dht/src/connection/webrtc/NodeWebrtcConnection.ts +++ b/packages/dht/src/connection/webrtc/NodeWebrtcConnection.ts @@ -1,6 +1,6 @@ import { IWebrtcConnection, WebrtcConnectionEvents } from './IWebrtcConnection' import { ConnectionType, IConnection, ConnectionID, ConnectionEvents } from '../IConnection' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' import EventEmitter from 'eventemitter3' import { DataChannel, DescriptionType, PeerConnection, initLogger } from 'node-datachannel' import { Logger } from '@streamr/utils' diff --git a/packages/dht/src/connection/webrtc/WebrtcConnector.ts b/packages/dht/src/connection/webrtc/WebrtcConnector.ts index 637d157d97..e74ca79c59 100644 --- a/packages/dht/src/connection/webrtc/WebrtcConnector.ts +++ b/packages/dht/src/connection/webrtc/WebrtcConnector.ts @@ -1,10 +1,10 @@ import { HandshakeError, IceCandidate, + PeerDescriptor, RtcAnswer, RtcOffer, WebrtcConnectionRequest } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' import { ITransport } from '../../transport/ITransport' import { ListeningRpcCommunicator } from '../../transport/ListeningRpcCommunicator' import { NodeWebrtcConnection } from './NodeWebrtcConnection' diff --git a/packages/dht/src/connection/webrtc/WebrtcConnectorRpcLocal.ts b/packages/dht/src/connection/webrtc/WebrtcConnectorRpcLocal.ts index fcaaf443b8..ec914927d2 100644 --- a/packages/dht/src/connection/webrtc/WebrtcConnectorRpcLocal.ts +++ b/packages/dht/src/connection/webrtc/WebrtcConnectorRpcLocal.ts @@ -4,10 +4,10 @@ import { getAddressFromIceCandidate, isPrivateIPv4 } from '../../helpers/Address import { Empty } from '../../../generated/google/protobuf/empty' import { IceCandidate, + PeerDescriptor, RtcAnswer, RtcOffer } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' import { IWebrtcConnectorRpc } from '../../../generated/packages/dht/protos/DhtRpc.server' import { DhtCallContext } from '../../rpc-protocol/DhtCallContext' import { ListeningRpcCommunicator } from '../../transport/ListeningRpcCommunicator' diff --git a/packages/dht/src/connection/websocket/WebsocketClientConnector.ts b/packages/dht/src/connection/websocket/WebsocketClientConnector.ts index 57f1165c38..f46c553177 100644 --- a/packages/dht/src/connection/websocket/WebsocketClientConnector.ts +++ b/packages/dht/src/connection/websocket/WebsocketClientConnector.ts @@ -2,8 +2,11 @@ import { WebsocketClientConnection } from './NodeWebsocketClientConnection' import { ConnectionType } from '../IConnection' import { ListeningRpcCommunicator } from '../../transport/ListeningRpcCommunicator' import { WebsocketClientConnectorRpcLocal } from './WebsocketClientConnectorRpcLocal' -import { WebsocketConnectionRequest } from '../../../generated/packages/dht/protos/DhtRpc' -import { ConnectivityMethod, PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { + ConnectivityMethod, + PeerDescriptor, + WebsocketConnectionRequest +} from '../../../generated/packages/dht/protos/DhtRpc' import { WebsocketServer } from './WebsocketServer' import { createOutgoingHandshaker } from '../Handshaker' import { ServerCallContext } from '@protobuf-ts/runtime-rpc' diff --git a/packages/dht/src/connection/websocket/WebsocketClientConnectorRpcLocal.ts b/packages/dht/src/connection/websocket/WebsocketClientConnectorRpcLocal.ts index b7cefa3d05..935d82d73d 100644 --- a/packages/dht/src/connection/websocket/WebsocketClientConnectorRpcLocal.ts +++ b/packages/dht/src/connection/websocket/WebsocketClientConnectorRpcLocal.ts @@ -1,6 +1,8 @@ import { ServerCallContext } from '@protobuf-ts/runtime-rpc' -import { WebsocketConnectionRequest } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { + PeerDescriptor, + WebsocketConnectionRequest +} from '../../../generated/packages/dht/protos/DhtRpc' import { IWebsocketClientConnectorRpc } from '../../../generated/packages/dht/protos/DhtRpc.server' import { DhtCallContext } from '../../rpc-protocol/DhtCallContext' import { Empty } from '../../../generated/google/protobuf/empty' diff --git a/packages/dht/src/connection/websocket/WebsocketServerConnector.ts b/packages/dht/src/connection/websocket/WebsocketServerConnector.ts index 0bf9330048..d85fd49bee 100644 --- a/packages/dht/src/connection/websocket/WebsocketServerConnector.ts +++ b/packages/dht/src/connection/websocket/WebsocketServerConnector.ts @@ -4,8 +4,7 @@ import { Action, connectivityMethodToWebsocketUrl } from './WebsocketClientConne import { WebsocketServer } from './WebsocketServer' import { areEqualPeerDescriptors, DhtAddress, toNodeId } from '../../identifiers' import { AutoCertifierClientFacade } from './AutoCertifierClientFacade' -import { ConnectivityResponse, HandshakeError } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { ConnectivityResponse, HandshakeError, PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' import { NatType, PortRange, TlsCertificate } from '../ConnectionManager' import { ITransport } from '../../transport/ITransport' import { ipv4ToNumber, Logger, wait } from '@streamr/utils' diff --git a/packages/dht/src/dht/DhtNode.ts b/packages/dht/src/dht/DhtNode.ts index 658a3a658c..4819119447 100644 --- a/packages/dht/src/dht/DhtNode.ts +++ b/packages/dht/src/dht/DhtNode.ts @@ -30,11 +30,11 @@ import { ExternalStoreDataResponse, LeaveNotice, Message, + PeerDescriptor, PingRequest, PingResponse, RecursiveOperation } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' import { ExternalApiRpcClient, StoreRpcClient } from '../../generated/packages/dht/protos/DhtRpc.client' import { ITransport, TransportEvents } from '../transport/ITransport' import { RoutingRpcCommunicator } from '../transport/RoutingRpcCommunicator' diff --git a/packages/dht/src/dht/DhtNodeRpcLocal.ts b/packages/dht/src/dht/DhtNodeRpcLocal.ts index ed3196e62d..c2f5ab3974 100644 --- a/packages/dht/src/dht/DhtNodeRpcLocal.ts +++ b/packages/dht/src/dht/DhtNodeRpcLocal.ts @@ -7,10 +7,10 @@ import { ClosestPeersResponse, ClosestRingPeersRequest, ClosestRingPeersResponse, + PeerDescriptor, PingRequest, PingResponse } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' import { IDhtNodeRpc } from '../../generated/packages/dht/protos/DhtRpc.server' import { DhtCallContext } from '../rpc-protocol/DhtCallContext' import { RingContacts } from './contact/RingContactList' diff --git a/packages/dht/src/dht/DhtNodeRpcRemote.ts b/packages/dht/src/dht/DhtNodeRpcRemote.ts index f3ddb00d77..00d64d86b5 100644 --- a/packages/dht/src/dht/DhtNodeRpcRemote.ts +++ b/packages/dht/src/dht/DhtNodeRpcRemote.ts @@ -5,9 +5,9 @@ import { DhtAddress, DhtAddressRaw, toNodeId, toDhtAddressRaw } from '../identif import { ClosestPeersRequest, ClosestRingPeersRequest, + PeerDescriptor, PingRequest } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' import { DhtNodeRpcClient } from '../../generated/packages/dht/protos/DhtRpc.client' import { ServiceID } from '../types/ServiceID' import { RpcRemote } from './contact/RpcRemote' diff --git a/packages/dht/src/dht/ExternalApiRpcLocal.ts b/packages/dht/src/dht/ExternalApiRpcLocal.ts index af4264635d..3ff4706ef6 100644 --- a/packages/dht/src/dht/ExternalApiRpcLocal.ts +++ b/packages/dht/src/dht/ExternalApiRpcLocal.ts @@ -4,9 +4,9 @@ import { ExternalFetchDataResponse, ExternalStoreDataRequest, ExternalStoreDataResponse, - RecursiveOperation + RecursiveOperation, + PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' import { ServerCallContext } from '@protobuf-ts/runtime-rpc' import { DhtCallContext } from '../rpc-protocol/DhtCallContext' import { RecursiveOperationResult } from './recursive-operation/RecursiveOperationManager' diff --git a/packages/dht/src/dht/ExternalApiRpcRemote.ts b/packages/dht/src/dht/ExternalApiRpcRemote.ts index 42ff684057..ca40ce0aa1 100644 --- a/packages/dht/src/dht/ExternalApiRpcRemote.ts +++ b/packages/dht/src/dht/ExternalApiRpcRemote.ts @@ -1,7 +1,6 @@ import { DhtAddress, toDhtAddressRaw } from '../identifiers' import { Any } from '../../generated/google/protobuf/any' -import { DataEntry, ExternalFetchDataRequest, ExternalStoreDataRequest } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { DataEntry, ExternalFetchDataRequest, ExternalStoreDataRequest, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { ExternalApiRpcClient } from '../../generated/packages/dht/protos/DhtRpc.client' import { RpcRemote } from './contact/RpcRemote' diff --git a/packages/dht/src/dht/PeerManager.ts b/packages/dht/src/dht/PeerManager.ts index 9de161fb2c..039538cfb7 100644 --- a/packages/dht/src/dht/PeerManager.ts +++ b/packages/dht/src/dht/PeerManager.ts @@ -6,7 +6,9 @@ import KBucket from 'k-bucket' import { LockID } from '../connection/ConnectionLockStates' import { ConnectionLocker } from '../connection/ConnectionManager' import { DhtAddress, DhtAddressRaw, toNodeId, toDhtAddressRaw } from '../identifiers' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { + PeerDescriptor +} from '../../generated/packages/dht/protos/DhtRpc' import { DhtNodeRpcRemote } from './DhtNodeRpcRemote' import { RandomContactList } from './contact/RandomContactList' import { RingContactList } from './contact/RingContactList' diff --git a/packages/dht/src/dht/contact/Contact.ts b/packages/dht/src/dht/contact/Contact.ts index 80b2ad5172..3868a3c485 100644 --- a/packages/dht/src/dht/contact/Contact.ts +++ b/packages/dht/src/dht/contact/Contact.ts @@ -1,4 +1,4 @@ -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' import { DhtAddress, toNodeId } from '../../identifiers' export class Contact { diff --git a/packages/dht/src/dht/contact/RingContactList.ts b/packages/dht/src/dht/contact/RingContactList.ts index 512a2a9e02..fea502e8a8 100644 --- a/packages/dht/src/dht/contact/RingContactList.ts +++ b/packages/dht/src/dht/contact/RingContactList.ts @@ -1,4 +1,4 @@ -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' import { OrderedMap } from '@js-sdsl/ordered-map' import { RingDistance, RingId, RingIdRaw, getLeftDistance, getRightDistance, getRingIdFromPeerDescriptor, getRingIdFromRaw } from './ringIdentifiers' import { DhtAddress, toNodeId } from '../../identifiers' diff --git a/packages/dht/src/dht/contact/RpcRemote.ts b/packages/dht/src/dht/contact/RpcRemote.ts index 34e64c78cb..2e7abbc8c7 100644 --- a/packages/dht/src/dht/contact/RpcRemote.ts +++ b/packages/dht/src/dht/contact/RpcRemote.ts @@ -2,7 +2,7 @@ import type { ServiceInfo } from '@protobuf-ts/runtime-rpc' import { ClassType, ClientTransport, ProtoRpcClient, RpcCommunicator, toProtoRpcClient } from '@streamr/proto-rpc' import { ConnectionType } from '../../connection/IConnection' import { expectedConnectionType } from '../../helpers/Connectivity' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' import { DhtRpcOptions } from '../../rpc-protocol/DhtRpcOptions' import { DhtCallContext } from '../../rpc-protocol/DhtCallContext' diff --git a/packages/dht/src/dht/contact/getClosestNodes.ts b/packages/dht/src/dht/contact/getClosestNodes.ts index d9175b4f4c..864687b807 100644 --- a/packages/dht/src/dht/contact/getClosestNodes.ts +++ b/packages/dht/src/dht/contact/getClosestNodes.ts @@ -1,4 +1,4 @@ -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../exports' import { DhtAddress } from '../../identifiers' import { Contact } from './Contact' import { SortedContactList } from './SortedContactList' diff --git a/packages/dht/src/dht/contact/ringIdentifiers.ts b/packages/dht/src/dht/contact/ringIdentifiers.ts index b76cc625c1..e795147b4b 100644 --- a/packages/dht/src/dht/contact/ringIdentifiers.ts +++ b/packages/dht/src/dht/contact/ringIdentifiers.ts @@ -1,4 +1,4 @@ -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' // Notice: you cannot convert RingId to RingIdRaw, because // RingId is only an approximation of the actual value. diff --git a/packages/dht/src/dht/discovery/DiscoverySession.ts b/packages/dht/src/dht/discovery/DiscoverySession.ts index 24059530e1..47d9814469 100644 --- a/packages/dht/src/dht/discovery/DiscoverySession.ts +++ b/packages/dht/src/dht/discovery/DiscoverySession.ts @@ -1,7 +1,7 @@ import { Gate, Logger, withTimeout } from '@streamr/utils' import { v4 } from 'uuid' import { DhtAddress, toNodeId, toDhtAddressRaw } from '../../identifiers' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' import { DhtNodeRpcRemote } from '../DhtNodeRpcRemote' import { PeerManager, getDistance } from '../PeerManager' import { getClosestNodes } from '../contact/getClosestNodes' diff --git a/packages/dht/src/dht/discovery/PeerDiscovery.ts b/packages/dht/src/dht/discovery/PeerDiscovery.ts index 9249128418..46c0d1b0a7 100644 --- a/packages/dht/src/dht/discovery/PeerDiscovery.ts +++ b/packages/dht/src/dht/discovery/PeerDiscovery.ts @@ -8,7 +8,7 @@ import { toNodeId, toDhtAddressRaw } from '../../identifiers' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' import { ServiceID } from '../../types/ServiceID' import { DhtNodeRpcRemote } from '../DhtNodeRpcRemote' import { PeerManager } from '../PeerManager' diff --git a/packages/dht/src/dht/discovery/RingDiscoverySession.ts b/packages/dht/src/dht/discovery/RingDiscoverySession.ts index 8aaaea47be..21a2a6e94b 100644 --- a/packages/dht/src/dht/discovery/RingDiscoverySession.ts +++ b/packages/dht/src/dht/discovery/RingDiscoverySession.ts @@ -1,7 +1,7 @@ import { Gate, Logger, withTimeout } from '@streamr/utils' import { v4 } from 'uuid' import { DhtAddress, toNodeId } from '../../identifiers' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' import { DhtNodeRpcRemote } from '../DhtNodeRpcRemote' import { PeerManager } from '../PeerManager' import { RingContacts } from '../contact/RingContactList' diff --git a/packages/dht/src/dht/recursive-operation/RecursiveOperationManager.ts b/packages/dht/src/dht/recursive-operation/RecursiveOperationManager.ts index 6f190be89a..c0dd081de3 100644 --- a/packages/dht/src/dht/recursive-operation/RecursiveOperationManager.ts +++ b/packages/dht/src/dht/recursive-operation/RecursiveOperationManager.ts @@ -1,12 +1,12 @@ import { DataEntry, + PeerDescriptor, RecursiveOperation, RecursiveOperationRequest, RouteMessageAck, RouteMessageError, RouteMessageWrapper } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' import { Router } from '../routing/Router' import { RoutingMode } from '../routing/RoutingSession' import { Logger, areEqualBinaries, runAndWaitForEvents3, wait } from '@streamr/utils' diff --git a/packages/dht/src/dht/recursive-operation/RecursiveOperationRpcLocal.ts b/packages/dht/src/dht/recursive-operation/RecursiveOperationRpcLocal.ts index 57c307e5f7..3d2d1b11c8 100644 --- a/packages/dht/src/dht/recursive-operation/RecursiveOperationRpcLocal.ts +++ b/packages/dht/src/dht/recursive-operation/RecursiveOperationRpcLocal.ts @@ -1,6 +1,5 @@ import { Logger } from '@streamr/utils' -import { RouteMessageAck, RouteMessageError, RouteMessageWrapper } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor, RouteMessageAck, RouteMessageError, RouteMessageWrapper } from '../../../generated/packages/dht/protos/DhtRpc' import { IRecursiveOperationRpc } from '../../../generated/packages/dht/protos/DhtRpc.server' import { createRouteMessageAck } from '../routing/RouterRpcLocal' import { getPreviousPeer } from '../routing/getPreviousPeer' diff --git a/packages/dht/src/dht/recursive-operation/RecursiveOperationSession.ts b/packages/dht/src/dht/recursive-operation/RecursiveOperationSession.ts index 065f867531..18dfde8355 100644 --- a/packages/dht/src/dht/recursive-operation/RecursiveOperationSession.ts +++ b/packages/dht/src/dht/recursive-operation/RecursiveOperationSession.ts @@ -2,6 +2,7 @@ import EventEmitter from 'eventemitter3' import { v4 } from 'uuid' import { DataEntry, + PeerDescriptor, RecursiveOperationResponse, RecursiveOperation, RouteMessageWrapper, @@ -9,7 +10,6 @@ import { RecursiveOperationRequest, Message } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' import { ITransport } from '../../transport/ITransport' import { ListeningRpcCommunicator } from '../../transport/ListeningRpcCommunicator' import { Contact } from '../contact/Contact' diff --git a/packages/dht/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.ts b/packages/dht/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.ts index 3f75129d62..c8ed4ea325 100644 --- a/packages/dht/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.ts +++ b/packages/dht/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.ts @@ -1,7 +1,6 @@ import { IRecursiveOperationSessionRpc } from '../../../generated/packages/dht/protos/DhtRpc.server' import { Empty } from '../../../generated/google/protobuf/empty' -import { DataEntry, RecursiveOperationResponse } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { DataEntry, RecursiveOperationResponse, PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' import { Logger } from '@streamr/utils' import { ServerCallContext } from '@protobuf-ts/runtime-rpc' import { DhtCallContext } from '../../rpc-protocol/DhtCallContext' diff --git a/packages/dht/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.ts b/packages/dht/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.ts index 9c54f3d711..3119d49f35 100644 --- a/packages/dht/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.ts +++ b/packages/dht/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.ts @@ -1,6 +1,9 @@ import { Logger } from '@streamr/utils' -import { DataEntry, RecursiveOperationResponse } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { + DataEntry, + PeerDescriptor, + RecursiveOperationResponse +} from '../../../generated/packages/dht/protos/DhtRpc' import { RecursiveOperationSessionRpcClient } from '../../../generated/packages/dht/protos/DhtRpc.client' import { RpcRemote } from '../contact/RpcRemote' diff --git a/packages/dht/src/dht/routing/Router.ts b/packages/dht/src/dht/routing/Router.ts index 8e7096b1f9..05534e3059 100644 --- a/packages/dht/src/dht/routing/Router.ts +++ b/packages/dht/src/dht/routing/Router.ts @@ -1,5 +1,4 @@ -import { Message, RouteMessageAck, RouteMessageError, RouteMessageWrapper } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { Message, PeerDescriptor, RouteMessageAck, RouteMessageError, RouteMessageWrapper } from '../../../generated/packages/dht/protos/DhtRpc' import { RoutingMode, RoutingRemoteContact, RoutingSession, RoutingSessionEvents } from './RoutingSession' import { Logger, executeSafePromise, raceEvents3, withTimeout } from '@streamr/utils' import { RoutingRpcCommunicator } from '../../transport/RoutingRpcCommunicator' diff --git a/packages/dht/src/dht/routing/RouterRpcLocal.ts b/packages/dht/src/dht/routing/RouterRpcLocal.ts index 0232ba48fb..f423cb5461 100644 --- a/packages/dht/src/dht/routing/RouterRpcLocal.ts +++ b/packages/dht/src/dht/routing/RouterRpcLocal.ts @@ -1,6 +1,5 @@ import { Logger, areEqualBinaries } from '@streamr/utils' -import { Message, RouteMessageAck, RouteMessageError, RouteMessageWrapper } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { Message, PeerDescriptor, RouteMessageAck, RouteMessageError, RouteMessageWrapper } from '../../../generated/packages/dht/protos/DhtRpc' import { IRouterRpc } from '../../../generated/packages/dht/protos/DhtRpc.server' import { DuplicateDetector } from './DuplicateDetector' import { RoutingMode } from './RoutingSession' diff --git a/packages/dht/src/dht/routing/RoutingSession.ts b/packages/dht/src/dht/routing/RoutingSession.ts index bd0d2cf6ed..95516fbd05 100644 --- a/packages/dht/src/dht/routing/RoutingSession.ts +++ b/packages/dht/src/dht/routing/RoutingSession.ts @@ -2,8 +2,7 @@ import { SortedContactList } from '../contact/SortedContactList' import { Logger } from '@streamr/utils' import EventEmitter from 'eventemitter3' import { v4 } from 'uuid' -import { RouteMessageWrapper } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor, RouteMessageWrapper } from '../../../generated/packages/dht/protos/DhtRpc' import { RouterRpcRemote, ROUTING_TIMEOUT } from './RouterRpcRemote' import { RoutingRpcCommunicator } from '../../transport/RoutingRpcCommunicator' import { RecursiveOperationRpcClient, RouterRpcClient } from '../../../generated/packages/dht/protos/DhtRpc.client' diff --git a/packages/dht/src/dht/routing/getPreviousPeer.ts b/packages/dht/src/dht/routing/getPreviousPeer.ts index 9c48d3c186..23e7f6ef4d 100644 --- a/packages/dht/src/dht/routing/getPreviousPeer.ts +++ b/packages/dht/src/dht/routing/getPreviousPeer.ts @@ -1,6 +1,5 @@ import { last } from 'lodash' -import { RouteMessageWrapper } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor, RouteMessageWrapper } from '../../../generated/packages/dht/protos/DhtRpc' export const getPreviousPeer = (routeMessage: RouteMessageWrapper): PeerDescriptor | undefined => { return last(routeMessage.routingPath) diff --git a/packages/dht/src/dht/store/StoreManager.ts b/packages/dht/src/dht/store/StoreManager.ts index 4939a04b38..5b9696cd9b 100644 --- a/packages/dht/src/dht/store/StoreManager.ts +++ b/packages/dht/src/dht/store/StoreManager.ts @@ -11,12 +11,11 @@ import { Any } from '../../../generated/google/protobuf/any' import { Timestamp } from '../../../generated/google/protobuf/timestamp' import { DataEntry, + PeerDescriptor, RecursiveOperation, ReplicateDataRequest, - StoreDataRequest, - StoreDataResponse + StoreDataRequest, StoreDataResponse } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' import { RoutingRpcCommunicator } from '../../transport/RoutingRpcCommunicator' import { ServiceID } from '../../types/ServiceID' import { getClosestNodes } from '../contact/getClosestNodes' diff --git a/packages/dht/src/dht/store/StoreRpcLocal.ts b/packages/dht/src/dht/store/StoreRpcLocal.ts index ec3fee4f6a..f1416049e9 100644 --- a/packages/dht/src/dht/store/StoreRpcLocal.ts +++ b/packages/dht/src/dht/store/StoreRpcLocal.ts @@ -4,10 +4,10 @@ import { Empty } from '../../../generated/google/protobuf/empty' import { Timestamp } from '../../../generated/google/protobuf/timestamp' import { DataEntry, + PeerDescriptor, ReplicateDataRequest, StoreDataRequest, StoreDataResponse } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' import { IStoreRpc } from '../../../generated/packages/dht/protos/DhtRpc.server' import { DhtCallContext } from '../../rpc-protocol/DhtCallContext' import { LocalDataStore } from './LocalDataStore' diff --git a/packages/dht/src/exports.ts b/packages/dht/src/exports.ts index 64cccb5a39..6db007bccf 100644 --- a/packages/dht/src/exports.ts +++ b/packages/dht/src/exports.ts @@ -4,8 +4,7 @@ export { RoutingRpcCommunicator } from './transport/RoutingRpcCommunicator' export { Simulator, LatencyType } from './connection/simulator/Simulator' export { SimulatorTransport } from './connection/simulator/SimulatorTransport' export { getRandomRegion, getRegionDelayMatrix } from './connection/simulator/pings' -export { Message, DataEntry } from '../generated/packages/dht/protos/DhtRpc' -export { PeerDescriptor, NodeType } from '../generated/packages/dht/protos/PeerDescriptor' +export { PeerDescriptor, Message, NodeType, DataEntry } from '../generated/packages/dht/protos/DhtRpc' export { ITransport, TransportEvents } from './transport/ITransport' export { ConnectionManager, ConnectionLocker, PortRange, TlsCertificate } from './connection/ConnectionManager' export { ConnectionsView } from './connection/ConnectionsView' diff --git a/packages/dht/src/helpers/Connectivity.ts b/packages/dht/src/helpers/Connectivity.ts index b76d685553..c43c4c3c71 100644 --- a/packages/dht/src/helpers/Connectivity.ts +++ b/packages/dht/src/helpers/Connectivity.ts @@ -1,5 +1,5 @@ import { ConnectionType } from '../connection/IConnection' -import { PeerDescriptor, ConnectivityMethod, NodeType } from '../../generated/packages/dht/protos/PeerDescriptor' +import { ConnectivityMethod, NodeType, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { isPrivateIPv4 } from './AddressTools' export const canOpenConnectionFromBrowser = (websocketServer: ConnectivityMethod): boolean => { diff --git a/packages/dht/src/helpers/createPeerDescriptor.ts b/packages/dht/src/helpers/createPeerDescriptor.ts index d3b8f74570..890df6ed03 100644 --- a/packages/dht/src/helpers/createPeerDescriptor.ts +++ b/packages/dht/src/helpers/createPeerDescriptor.ts @@ -8,9 +8,9 @@ import { createPeerDescriptorSignaturePayload } from '../helpers/createPeerDescr import { DhtAddress, DhtAddressRaw, toDhtAddressRaw } from '../identifiers' import { ConnectivityResponse, - + NodeType, + PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor, NodeType } from '../../generated/packages/dht/protos/PeerDescriptor' const calculateNodeIdRaw = (ipAddress: number, privateKey: Uint8Array): DhtAddressRaw => { // nodeId is calculated as diff --git a/packages/dht/src/helpers/createPeerDescriptorSignaturePayload.ts b/packages/dht/src/helpers/createPeerDescriptorSignaturePayload.ts index 86b4c91135..3fb1a12a1f 100644 --- a/packages/dht/src/helpers/createPeerDescriptorSignaturePayload.ts +++ b/packages/dht/src/helpers/createPeerDescriptorSignaturePayload.ts @@ -1,4 +1,4 @@ -import { ConnectivityMethod, PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { ConnectivityMethod, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' function convertUnsignedIntegerToBuffer(number: number): Buffer { const buffer = Buffer.alloc(4) diff --git a/packages/dht/src/helpers/protoClasses.ts b/packages/dht/src/helpers/protoClasses.ts index 25f961c817..1af21d297e 100644 --- a/packages/dht/src/helpers/protoClasses.ts +++ b/packages/dht/src/helpers/protoClasses.ts @@ -2,6 +2,7 @@ import { IMessageType } from '@protobuf-ts/runtime' import { ClosestPeersRequest, ClosestPeersResponse, + ConnectivityMethod, ConnectivityRequest, ConnectivityResponse, DisconnectNotice, @@ -9,6 +10,7 @@ import { HandshakeResponse, LeaveNotice, Message, + PeerDescriptor, PingRequest, PingResponse, RecursiveOperationResponse, @@ -23,8 +25,8 @@ import { LockRequest, UnlockRequest, LockResponse + } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor, ConnectivityMethod } from '../../generated/packages/dht/protos/PeerDescriptor' export const protoClasses: IMessageType[] = [ ClosestPeersRequest, diff --git a/packages/dht/src/identifiers.ts b/packages/dht/src/identifiers.ts index 845fc1a227..1be870bb7d 100644 --- a/packages/dht/src/identifiers.ts +++ b/packages/dht/src/identifiers.ts @@ -1,6 +1,6 @@ import { BrandedString, areEqualBinaries, binaryToHex, hexToBinary } from '@streamr/utils' import crypto from 'crypto' -import { PeerDescriptor } from '../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../generated/packages/dht/protos/DhtRpc' // https://www.scs.stanford.edu/~dm/home/papers/kpos.pdf export const KADEMLIA_ID_LENGTH_IN_BYTES = 20 diff --git a/packages/dht/src/rpc-protocol/DhtCallContext.ts b/packages/dht/src/rpc-protocol/DhtCallContext.ts index ce9c035122..96754007ce 100644 --- a/packages/dht/src/rpc-protocol/DhtCallContext.ts +++ b/packages/dht/src/rpc-protocol/DhtCallContext.ts @@ -1,5 +1,5 @@ import { ProtoCallContext } from '@streamr/proto-rpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { DhtRpcOptions } from './DhtRpcOptions' export class DhtCallContext extends ProtoCallContext implements DhtRpcOptions { diff --git a/packages/dht/src/rpc-protocol/DhtRpcOptions.ts b/packages/dht/src/rpc-protocol/DhtRpcOptions.ts index 5bf382e532..9a62f6cb11 100644 --- a/packages/dht/src/rpc-protocol/DhtRpcOptions.ts +++ b/packages/dht/src/rpc-protocol/DhtRpcOptions.ts @@ -1,5 +1,5 @@ import { ProtoRpcOptions } from '@streamr/proto-rpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' export interface DhtRpcOptions extends ProtoRpcOptions { targetDescriptor?: PeerDescriptor diff --git a/packages/dht/src/transport/ITransport.ts b/packages/dht/src/transport/ITransport.ts index 74a78281e0..641a323669 100644 --- a/packages/dht/src/transport/ITransport.ts +++ b/packages/dht/src/transport/ITransport.ts @@ -1,5 +1,4 @@ -import { Message } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { Message, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' export interface TransportEvents { disconnected: (peerDescriptor: PeerDescriptor, gracefulLeave: boolean) => void diff --git a/packages/dht/src/transport/ListeningRpcCommunicator.ts b/packages/dht/src/transport/ListeningRpcCommunicator.ts index e0b97f4933..3da1f6e608 100644 --- a/packages/dht/src/transport/ListeningRpcCommunicator.ts +++ b/packages/dht/src/transport/ListeningRpcCommunicator.ts @@ -1,8 +1,7 @@ import { ITransport } from './ITransport' import { RoutingRpcCommunicator } from './RoutingRpcCommunicator' import { RpcCommunicatorOptions, RpcError } from '@streamr/proto-rpc' -import { Message } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { Message, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { ServiceID } from '../types/ServiceID' import { areEqualPeerDescriptors } from '../identifiers' diff --git a/packages/dht/src/transport/RoutingRpcCommunicator.ts b/packages/dht/src/transport/RoutingRpcCommunicator.ts index 362f6d9d87..b99f6de554 100644 --- a/packages/dht/src/transport/RoutingRpcCommunicator.ts +++ b/packages/dht/src/transport/RoutingRpcCommunicator.ts @@ -1,5 +1,4 @@ -import { Message } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { Message, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { v4 } from 'uuid' import { RpcCommunicator, RpcCommunicatorOptions } from '@streamr/proto-rpc' import { DhtCallContext } from '../rpc-protocol/DhtCallContext' diff --git a/packages/dht/test/benchmark/hybrid-network-simulation/RingContactList.test.ts b/packages/dht/test/benchmark/hybrid-network-simulation/RingContactList.test.ts index ca932b2c58..4d6994508a 100644 --- a/packages/dht/test/benchmark/hybrid-network-simulation/RingContactList.test.ts +++ b/packages/dht/test/benchmark/hybrid-network-simulation/RingContactList.test.ts @@ -1,5 +1,4 @@ -import { ConnectivityResponse } from '../../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { ConnectivityResponse, PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' import { createPeerDescriptor } from '../../../src/helpers/createPeerDescriptor' import { NatType } from '../../../src/connection/ConnectionManager' import { ipv4ToNumber, Logger } from '@streamr/utils' diff --git a/packages/dht/test/end-to-end/Layer0Webrtc.test.ts b/packages/dht/test/end-to-end/Layer0Webrtc.test.ts index 21da0a09f0..c9f9f780ce 100644 --- a/packages/dht/test/end-to-end/Layer0Webrtc.test.ts +++ b/packages/dht/test/end-to-end/Layer0Webrtc.test.ts @@ -1,7 +1,7 @@ import { areEqualBinaries, waitForEvent3 } from '@streamr/utils' import { ConnectionManager } from '../../src/connection/ConnectionManager' import { DhtNode } from '../../src/dht/DhtNode' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { createMockPeerDescriptor } from '../utils/utils' import { toNodeId } from '../../src/exports' diff --git a/packages/dht/test/end-to-end/RecoveryFromFailedAutoCertification.test.ts b/packages/dht/test/end-to-end/RecoveryFromFailedAutoCertification.test.ts index 8352e3cb6d..5aa0c9c7b1 100644 --- a/packages/dht/test/end-to-end/RecoveryFromFailedAutoCertification.test.ts +++ b/packages/dht/test/end-to-end/RecoveryFromFailedAutoCertification.test.ts @@ -1,5 +1,5 @@ import { DhtNode } from '../../src/dht/DhtNode' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import os from 'os' describe('Failed autocertification', () => { diff --git a/packages/dht/test/end-to-end/WebsocketConnectionRequest.test.ts b/packages/dht/test/end-to-end/WebsocketConnectionRequest.test.ts index d5501f261c..bb405a2ae5 100644 --- a/packages/dht/test/end-to-end/WebsocketConnectionRequest.test.ts +++ b/packages/dht/test/end-to-end/WebsocketConnectionRequest.test.ts @@ -1,4 +1,4 @@ -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { DhtNode } from '../../src/dht/DhtNode' import { ConnectionManager } from '../../src/connection/ConnectionManager' import { until } from '@streamr/utils' diff --git a/packages/dht/test/integration/ConnectionLocking.test.ts b/packages/dht/test/integration/ConnectionLocking.test.ts index 018c8db075..21c0c6aedc 100644 --- a/packages/dht/test/integration/ConnectionLocking.test.ts +++ b/packages/dht/test/integration/ConnectionLocking.test.ts @@ -4,7 +4,7 @@ import { DefaultConnectorFacade } from '../../src/connection/ConnectorFacade' import { LatencyType, Simulator } from '../../src/connection/simulator/Simulator' import { SimulatorTransport } from '../../src/connection/simulator/SimulatorTransport' import { ITransport } from '../../src/transport/ITransport' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { getRandomRegion } from '../../dist/src/connection/simulator/pings' import { createMockPeerDescriptor } from '../utils/utils' import { toNodeId } from '../../src/identifiers' diff --git a/packages/dht/test/integration/ConnectionManager.test.ts b/packages/dht/test/integration/ConnectionManager.test.ts index a3fa28171d..b9677b1c66 100644 --- a/packages/dht/test/integration/ConnectionManager.test.ts +++ b/packages/dht/test/integration/ConnectionManager.test.ts @@ -6,8 +6,7 @@ import { Simulator } from '../../src/connection/simulator/Simulator' import { SimulatorTransport } from '../../src/connection/simulator/SimulatorTransport' import { createPeerDescriptor } from '../../src/helpers/createPeerDescriptor' import { randomDhtAddress, toDhtAddressRaw } from '../../src/identifiers' -import { ConnectivityResponse, Message } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor, NodeType } from '../../generated/packages/dht/protos/PeerDescriptor' +import { ConnectivityResponse, Message, NodeType, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { RpcMessage } from '../../generated/packages/proto-rpc/protos/ProtoRpc' import { TransportEvents } from '../../src/transport/ITransport' import { createMockPeerDescriptor } from '../utils/utils' diff --git a/packages/dht/test/integration/DhtNode.test.ts b/packages/dht/test/integration/DhtNode.test.ts index 87f6624600..e09423ed5b 100644 --- a/packages/dht/test/integration/DhtNode.test.ts +++ b/packages/dht/test/integration/DhtNode.test.ts @@ -2,8 +2,7 @@ import { until } from '@streamr/utils' import { range, without } from 'lodash' import { DhtNodeRpcLocal } from '../../src/dht/DhtNodeRpcLocal' import { DhtNode, ListeningRpcCommunicator, toNodeId } from '../../src/exports' -import { ClosestPeersRequest, ClosestPeersResponse, PingRequest, PingResponse } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { ClosestPeersRequest, ClosestPeersResponse, PeerDescriptor, PingRequest, PingResponse } from '../../generated/packages/dht/protos/DhtRpc' import { FakeEnvironment } from '../utils/FakeTransport' import { createMockPeerDescriptor } from '../utils/utils' diff --git a/packages/dht/test/integration/Find.test.ts b/packages/dht/test/integration/Find.test.ts index b5db151092..060d6a0b10 100644 --- a/packages/dht/test/integration/Find.test.ts +++ b/packages/dht/test/integration/Find.test.ts @@ -1,6 +1,6 @@ import { LatencyType, Simulator } from '../../src/connection/simulator/Simulator' import { DhtNode } from '../../src/dht/DhtNode' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { createMockConnectionDhtNode, waitForStableTopology } from '../utils/utils' import { toDhtAddress, toNodeId, toDhtAddressRaw } from '../../src/identifiers' diff --git a/packages/dht/test/integration/MultipleEntryPointJoining.test.ts b/packages/dht/test/integration/MultipleEntryPointJoining.test.ts index 00a75b194b..d373aaf886 100644 --- a/packages/dht/test/integration/MultipleEntryPointJoining.test.ts +++ b/packages/dht/test/integration/MultipleEntryPointJoining.test.ts @@ -1,6 +1,6 @@ import { LatencyType, Simulator } from '../../src/connection/simulator/Simulator' import { DhtNode } from '../../src/dht/DhtNode' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { createMockConnectionDhtNode } from '../utils/utils' describe('multiple entry point joining', () => { diff --git a/packages/dht/test/integration/ReplicateData.test.ts b/packages/dht/test/integration/ReplicateData.test.ts index ca818d4951..230d454e59 100644 --- a/packages/dht/test/integration/ReplicateData.test.ts +++ b/packages/dht/test/integration/ReplicateData.test.ts @@ -5,8 +5,7 @@ import { SortedContactList } from '../../src/dht/contact/SortedContactList' import { createMockDataEntry, expectEqualData } from '../utils/mock/mockDataEntry' import { DhtAddress, randomDhtAddress, toDhtAddress, toNodeId } from '../../src/identifiers' import { sample } from 'lodash' -import { DataEntry } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { DataEntry, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' const DATA = createMockDataEntry() const NUM_NODES = 100 diff --git a/packages/dht/test/integration/RouteMessage.test.ts b/packages/dht/test/integration/RouteMessage.test.ts index 235085d726..612dba08a0 100644 --- a/packages/dht/test/integration/RouteMessage.test.ts +++ b/packages/dht/test/integration/RouteMessage.test.ts @@ -1,6 +1,5 @@ import { DhtNode, Events as DhtNodeEvents } from '../../src/dht/DhtNode' -import { Message, RouteMessageWrapper } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor, NodeType } from '../../generated/packages/dht/protos/PeerDescriptor' +import { Message, NodeType, PeerDescriptor, RouteMessageWrapper } from '../../generated/packages/dht/protos/DhtRpc' import { RpcMessage } from '../../generated/packages/proto-rpc/protos/ProtoRpc' import { Logger, runAndWaitForEvents3, until } from '@streamr/utils' import { createMockConnectionDhtNode, createWrappedClosestPeersRequest } from '../utils/utils' diff --git a/packages/dht/test/integration/SimultaneousConnections.test.ts b/packages/dht/test/integration/SimultaneousConnections.test.ts index 928f2263c0..57a7e2c98f 100644 --- a/packages/dht/test/integration/SimultaneousConnections.test.ts +++ b/packages/dht/test/integration/SimultaneousConnections.test.ts @@ -3,8 +3,7 @@ import { ConnectionManager } from '../../src/connection/ConnectionManager' import { DefaultConnectorFacade, DefaultConnectorFacadeOptions } from '../../src/connection/ConnectorFacade' import { LatencyType, Simulator } from '../../src/connection/simulator/Simulator' import { SimulatorTransport } from '../../src/connection/simulator/SimulatorTransport' -import { Message } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { Message, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { RpcMessage } from '../../generated/packages/proto-rpc/protos/ProtoRpc' import { createMockPeerDescriptor } from '../utils/utils' import { getRandomRegion } from '../../src/connection/simulator/pings' diff --git a/packages/dht/test/integration/Store.test.ts b/packages/dht/test/integration/Store.test.ts index 5d90dede08..e8eb212a0d 100644 --- a/packages/dht/test/integration/Store.test.ts +++ b/packages/dht/test/integration/Store.test.ts @@ -1,7 +1,7 @@ import { LatencyType, Simulator } from '../../src/connection/simulator/Simulator' import { DhtNode } from '../../src/dht/DhtNode' import { toDhtAddress, toNodeId } from '../../src/identifiers' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { createMockDataEntry, expectEqualData } from '../utils/mock/mockDataEntry' import { createMockConnectionDhtNode, createMockPeerDescriptor, waitForStableTopology } from '../utils/utils' diff --git a/packages/dht/test/integration/WebrtcConnectionManagement.test.ts b/packages/dht/test/integration/WebrtcConnectionManagement.test.ts index d9058cf169..82e95f4fe5 100644 --- a/packages/dht/test/integration/WebrtcConnectionManagement.test.ts +++ b/packages/dht/test/integration/WebrtcConnectionManagement.test.ts @@ -1,7 +1,6 @@ import { ConnectionManager } from '../../src/connection/ConnectionManager' import { LatencyType, Simulator } from '../../src/connection/simulator/Simulator' -import { Message } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor, NodeType } from '../../generated/packages/dht/protos/PeerDescriptor' +import { Message, NodeType, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { RpcMessage } from '../../generated/packages/proto-rpc/protos/ProtoRpc' import { ITransport } from '../../src/transport/ITransport' import * as Err from '../../src/helpers/errors' diff --git a/packages/dht/test/integration/WebsocketConnectionManagement.test.ts b/packages/dht/test/integration/WebsocketConnectionManagement.test.ts index 7d20f0174c..6d2f9046a1 100644 --- a/packages/dht/test/integration/WebsocketConnectionManagement.test.ts +++ b/packages/dht/test/integration/WebsocketConnectionManagement.test.ts @@ -4,8 +4,7 @@ import { DefaultConnectorFacade, DefaultConnectorFacadeOptions } from '../../src import { Simulator } from '../../src/connection/simulator/Simulator' import { SimulatorTransport } from '../../src/connection/simulator/SimulatorTransport' import * as Err from '../../src/helpers/errors' -import { Message } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor, NodeType } from '../../generated/packages/dht/protos/PeerDescriptor' +import { Message, NodeType, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { RpcMessage } from '../../generated/packages/proto-rpc/protos/ProtoRpc' import { TransportEvents } from '../../src/transport/ITransport' import { toNodeId } from '../../src/identifiers' diff --git a/packages/dht/test/integration/rpc-connections-over-webrtc.test.ts b/packages/dht/test/integration/rpc-connections-over-webrtc.test.ts index ea2bad00d0..dcb8b9e244 100644 --- a/packages/dht/test/integration/rpc-connections-over-webrtc.test.ts +++ b/packages/dht/test/integration/rpc-connections-over-webrtc.test.ts @@ -7,8 +7,7 @@ import { DhtRpcOptions } from '../../src/rpc-protocol/DhtRpcOptions' import { ListeningRpcCommunicator } from '../../src/transport/ListeningRpcCommunicator' import { ProtoRpcClient, toProtoRpcClient } from '@streamr/proto-rpc' import { DhtNodeRpcClient } from '../../generated/packages/dht/protos/DhtRpc.client' -import { PingRequest, PingResponse } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor, PingRequest, PingResponse } from '../../generated/packages/dht/protos/DhtRpc' import { DefaultConnectorFacade } from '../../src/connection/ConnectorFacade' import { MetricsContext } from '@streamr/utils' import { createMockPeerDescriptor } from '../utils/utils' diff --git a/packages/dht/test/unit/ConnectivityHelpers.test.ts b/packages/dht/test/unit/ConnectivityHelpers.test.ts index 1d21885bdd..2c8dee2c9b 100644 --- a/packages/dht/test/unit/ConnectivityHelpers.test.ts +++ b/packages/dht/test/unit/ConnectivityHelpers.test.ts @@ -1,4 +1,4 @@ -import { NodeType } from '../../generated/packages/dht/protos/PeerDescriptor' +import { NodeType } from '../../generated/packages/dht/protos/DhtRpc' import { expectedConnectionType } from '../../src/helpers/Connectivity' import { ConnectionType } from '../../src/connection/IConnection' import { createMockPeerDescriptor } from '../utils/utils' diff --git a/packages/dht/test/unit/DiscoverySession.test.ts b/packages/dht/test/unit/DiscoverySession.test.ts index d13eae65cd..61a5c05e10 100644 --- a/packages/dht/test/unit/DiscoverySession.test.ts +++ b/packages/dht/test/unit/DiscoverySession.test.ts @@ -4,7 +4,7 @@ import { DhtNodeRpcRemote } from '../../src/dht/DhtNodeRpcRemote' import { PeerManager, getDistance } from '../../src/dht/PeerManager' import { DiscoverySession } from '../../src/dht/discovery/DiscoverySession' import { DhtAddress, toNodeId, toDhtAddressRaw } from '../../src/identifiers' -import { NodeType, PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { NodeType, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { createTestTopology } from '../utils/topology' import { getClosestNodes } from '../../src/dht/contact/getClosestNodes' diff --git a/packages/dht/test/unit/PeerManager.test.ts b/packages/dht/test/unit/PeerManager.test.ts index 2ada176807..e28699bf1b 100644 --- a/packages/dht/test/unit/PeerManager.test.ts +++ b/packages/dht/test/unit/PeerManager.test.ts @@ -4,7 +4,7 @@ import { DhtNodeRpcRemote } from '../../src/dht/DhtNodeRpcRemote' import { PeerManager } from '../../src/dht/PeerManager' import { getClosestNodes } from '../../src/dht/contact/getClosestNodes' import { DhtAddress, randomDhtAddress, toNodeId, toDhtAddressRaw } from '../../src/identifiers' -import { NodeType, PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { NodeType, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { MockRpcCommunicator } from '../utils/mock/MockRpcCommunicator' import { createMockPeerDescriptor } from '../utils/utils' diff --git a/packages/dht/test/unit/RecursiveOperationSession.test.ts b/packages/dht/test/unit/RecursiveOperationSession.test.ts index 358bb62f04..9fafeab393 100644 --- a/packages/dht/test/unit/RecursiveOperationSession.test.ts +++ b/packages/dht/test/unit/RecursiveOperationSession.test.ts @@ -4,8 +4,7 @@ import { RecursiveOperationSession } from '../../src/dht/recursive-operation/Rec import { RecursiveOperationSessionRpcRemote } from '../../src/dht/recursive-operation/RecursiveOperationSessionRpcRemote' import { ServiceID } from '../../src/types/ServiceID' import { randomDhtAddress } from '../../src/identifiers' -import { Message, RecursiveOperation } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { Message, PeerDescriptor, RecursiveOperation } from '../../generated/packages/dht/protos/DhtRpc' import { RecursiveOperationSessionRpcClient } from '../../generated/packages/dht/protos/DhtRpc.client' import { RoutingRpcCommunicator } from '../../src/transport/RoutingRpcCommunicator' import { FakeEnvironment } from '../utils/FakeTransport' diff --git a/packages/dht/test/unit/Router.test.ts b/packages/dht/test/unit/Router.test.ts index 8ec9e9b528..f22ec8d5bc 100644 --- a/packages/dht/test/unit/Router.test.ts +++ b/packages/dht/test/unit/Router.test.ts @@ -3,11 +3,11 @@ import { DhtNodeRpcRemote } from '../../src/dht/DhtNodeRpcRemote' import { Router } from '../../src/dht/routing/Router' import { Message, + PeerDescriptor, RouteMessageAck, RouteMessageError, RouteMessageWrapper } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' import { createMockPeerDescriptor, createWrappedClosestPeersRequest } from '../utils/utils' import { FakeRpcCommunicator } from '../utils/FakeRpcCommunicator' import { DhtAddress, toNodeId, randomDhtAddress } from '../../src/identifiers' diff --git a/packages/dht/test/unit/RoutingSession.test.ts b/packages/dht/test/unit/RoutingSession.test.ts index 7eefc63a1e..7311be3828 100644 --- a/packages/dht/test/unit/RoutingSession.test.ts +++ b/packages/dht/test/unit/RoutingSession.test.ts @@ -1,7 +1,6 @@ import { v4 } from 'uuid' import { RoutingMode, RoutingSession } from '../../src/dht/routing/RoutingSession' -import { Message, RouteMessageWrapper } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { Message, PeerDescriptor, RouteMessageWrapper } from '../../generated/packages/dht/protos/DhtRpc' import { createMockPeerDescriptor, createWrappedClosestPeersRequest } from '../utils/utils' import { DhtNodeRpcRemote } from '../../src/dht/DhtNodeRpcRemote' import { RoutingRpcCommunicator } from '../../src/transport/RoutingRpcCommunicator' diff --git a/packages/dht/test/unit/StoreManager.test.ts b/packages/dht/test/unit/StoreManager.test.ts index da758fc9ba..b9d899cec9 100644 --- a/packages/dht/test/unit/StoreManager.test.ts +++ b/packages/dht/test/unit/StoreManager.test.ts @@ -8,8 +8,7 @@ import { toDhtAddress, toDhtAddressRaw } from '../../src/identifiers' -import { ReplicateDataRequest } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor, ReplicateDataRequest } from '../../generated/packages/dht/protos/DhtRpc' import { createMockPeerDescriptor } from '../utils/utils' const NODE_COUNT = 10 diff --git a/packages/dht/test/unit/StoreRpcLocal.test.ts b/packages/dht/test/unit/StoreRpcLocal.test.ts index d28760cd44..d9cc2feae5 100644 --- a/packages/dht/test/unit/StoreRpcLocal.test.ts +++ b/packages/dht/test/unit/StoreRpcLocal.test.ts @@ -1,8 +1,7 @@ import { range } from 'lodash' import { StoreRpcLocal } from '../../src/dht/store/StoreRpcLocal' import { areEqualPeerDescriptors, randomDhtAddress, DhtAddress, toDhtAddress, toDhtAddressRaw } from '../../src/identifiers' -import { DataEntry, StoreDataRequest } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { DataEntry, PeerDescriptor, StoreDataRequest } from '../../generated/packages/dht/protos/DhtRpc' import { createMockPeerDescriptor } from '../utils/utils' import { getClosestNodes } from '../../src/dht/contact/getClosestNodes' import { wait } from '@streamr/utils' diff --git a/packages/dht/test/unit/WebsocketClientConnector.test.ts b/packages/dht/test/unit/WebsocketClientConnector.test.ts index f5c79cae99..dff953cc50 100644 --- a/packages/dht/test/unit/WebsocketClientConnector.test.ts +++ b/packages/dht/test/unit/WebsocketClientConnector.test.ts @@ -1,6 +1,6 @@ /* eslint-disable max-len */ import { WebsocketClientConnector } from '../../src/connection/websocket/WebsocketClientConnector' -import { NodeType } from '../../generated/packages/dht/protos/PeerDescriptor' +import { NodeType } from '../../generated/packages/dht/protos/DhtRpc' import { MockConnection } from '../utils/mock/MockConnection' import { MockRpcCommunicator } from '../utils/mock/MockRpcCommunicator' import { createMockPeerDescriptor } from '../utils/utils' diff --git a/packages/dht/test/unit/WebsocketServerConnector.test.ts b/packages/dht/test/unit/WebsocketServerConnector.test.ts index 2cab432921..cb70d1525c 100644 --- a/packages/dht/test/unit/WebsocketServerConnector.test.ts +++ b/packages/dht/test/unit/WebsocketServerConnector.test.ts @@ -1,6 +1,6 @@ /* eslint-disable max-len */ import { WebsocketServerConnector } from '../../src/connection/websocket/WebsocketServerConnector' -import { NodeType } from '../../generated/packages/dht/protos/PeerDescriptor' +import { NodeType } from '../../generated/packages/dht/protos/DhtRpc' import { MockConnection } from '../utils/mock/MockConnection' import { MockRpcCommunicator } from '../utils/mock/MockRpcCommunicator' import { createMockPeerDescriptor } from '../utils/utils' diff --git a/packages/dht/test/unit/createPeerDescriptor.test.ts b/packages/dht/test/unit/createPeerDescriptor.test.ts index c1772af414..787c37f120 100644 --- a/packages/dht/test/unit/createPeerDescriptor.test.ts +++ b/packages/dht/test/unit/createPeerDescriptor.test.ts @@ -1,7 +1,7 @@ import { ipv4ToNumber } from '@streamr/utils' import { createPeerDescriptor } from '../../src/helpers/createPeerDescriptor' import { isBrowserEnvironment } from '../../src/helpers/browser/isBrowserEnvironment' -import { NodeType } from '../../generated/packages/dht/protos/PeerDescriptor' +import { NodeType } from '../../generated/packages/dht/protos/DhtRpc' import { randomDhtAddress, toDhtAddressRaw } from '../../src/identifiers' import { getRandomRegion } from '../../dist/src/connection/simulator/pings' diff --git a/packages/dht/test/utils/FakeConnectorFacade.ts b/packages/dht/test/utils/FakeConnectorFacade.ts index 5c3cdc6185..8dc8af4341 100644 --- a/packages/dht/test/utils/FakeConnectorFacade.ts +++ b/packages/dht/test/utils/FakeConnectorFacade.ts @@ -1,6 +1,6 @@ import { PendingConnection } from '../../src/connection/PendingConnection' import { DhtAddress } from '../../src/identifiers' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { ITransport } from '../../src/transport/ITransport' export class FakeConnectorFacade { diff --git a/packages/dht/test/utils/FakeTransport.ts b/packages/dht/test/utils/FakeTransport.ts index 6328e3978b..c5796c153e 100644 --- a/packages/dht/test/utils/FakeTransport.ts +++ b/packages/dht/test/utils/FakeTransport.ts @@ -1,7 +1,6 @@ import { EventEmitter } from 'eventemitter3' import { DhtAddress, toDhtAddress, toNodeId } from '../../src/identifiers' -import { Message } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { Message, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { DEFAULT_SEND_OPTIONS, ITransport, SendOptions, TransportEvents } from '../../src/transport/ITransport' import { ConnectionsView } from '../../src/exports' diff --git a/packages/dht/test/utils/customMatchers.ts b/packages/dht/test/utils/customMatchers.ts index 702d10506b..805bd27a0b 100644 --- a/packages/dht/test/utils/customMatchers.ts +++ b/packages/dht/test/utils/customMatchers.ts @@ -1,7 +1,7 @@ import { areEqualBinaries } from '@streamr/utils' import { printExpected, printReceived } from 'jest-matcher-utils' import { isEqual } from 'lodash' -import { ConnectivityMethod, NodeType, PeerDescriptor } from '../../generated/packages/dht/protos/PeerDescriptor' +import { ConnectivityMethod, NodeType, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc' import { toDhtAddress } from '../../src/identifiers' // we could ES2015 module syntax (https://jestjs.io/docs/expect#expectextendmatchers), diff --git a/packages/dht/test/utils/mock/MockConnectionsView.ts b/packages/dht/test/utils/mock/MockConnectionsView.ts index 28637778f8..bbc1f4efa6 100644 --- a/packages/dht/test/utils/mock/MockConnectionsView.ts +++ b/packages/dht/test/utils/mock/MockConnectionsView.ts @@ -1,4 +1,4 @@ -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' export class MockConnectionsView { // eslint-disable-next-line class-methods-use-this diff --git a/packages/dht/test/utils/mock/MockTransport.ts b/packages/dht/test/utils/mock/MockTransport.ts index ab24961a6d..6aa37702a8 100644 --- a/packages/dht/test/utils/mock/MockTransport.ts +++ b/packages/dht/test/utils/mock/MockTransport.ts @@ -1,6 +1,6 @@ import { ITransport, TransportEvents } from '../../../src/transport/ITransport' import { EventEmitter } from 'eventemitter3' -import { PeerDescriptor } from '../../../generated/packages/dht/protos/PeerDescriptor' +import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' export class MockTransport extends EventEmitter implements ITransport { diff --git a/packages/dht/test/utils/utils.ts b/packages/dht/test/utils/utils.ts index 1005ed7974..8d57ec86ac 100644 --- a/packages/dht/test/utils/utils.ts +++ b/packages/dht/test/utils/utils.ts @@ -2,6 +2,8 @@ import { DhtNode } from '../../src/dht/DhtNode' import { ClosestPeersRequest, ClosestPeersResponse, + NodeType, + PeerDescriptor, PingRequest, PingResponse, RouteMessageAck, @@ -10,7 +12,6 @@ import { StoreDataResponse, ClosestRingPeersResponse } from '../../generated/packages/dht/protos/DhtRpc' -import { PeerDescriptor, NodeType } from '../../generated/packages/dht/protos/PeerDescriptor' import { RpcMessage } from '../../generated/packages/proto-rpc/protos/ProtoRpc' import { IDhtNodeRpc, diff --git a/packages/sdk/protos/SdkRpc.proto b/packages/sdk/protos/SdkRpc.proto index 1714b72353..c9912435a8 100644 --- a/packages/sdk/protos/SdkRpc.proto +++ b/packages/sdk/protos/SdkRpc.proto @@ -2,7 +2,7 @@ syntax = "proto3"; option optimize_for = CODE_SIZE; -import "packages/dht/protos/PeerDescriptor.proto"; +import "packages/dht/protos/DhtRpc.proto"; service OperatorDiscovery { rpc discoverOperators (OperatorDiscoveryRequest) returns (OperatorDiscoveryResponse); @@ -13,5 +13,5 @@ message OperatorDiscoveryRequest { } message OperatorDiscoveryResponse { - repeated peerDescriptor.PeerDescriptor operators = 1; + repeated dht.PeerDescriptor operators = 1; } diff --git a/packages/sdk/src/generated/google/protobuf/any.ts b/packages/sdk/src/generated/google/protobuf/any.ts new file mode 100644 index 0000000000..f9d001e5ae --- /dev/null +++ b/packages/sdk/src/generated/google/protobuf/any.ts @@ -0,0 +1,319 @@ +// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number +// @generated from protobuf file "google/protobuf/any.proto" (package "google.protobuf", syntax proto3) +// tslint:disable +// +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; +import type { IBinaryWriter } from "@protobuf-ts/runtime"; +import { WireType } from "@protobuf-ts/runtime"; +import type { IBinaryReader } from "@protobuf-ts/runtime"; +import { UnknownFieldHandler } from "@protobuf-ts/runtime"; +import type { PartialMessage } from "@protobuf-ts/runtime"; +import { reflectionMergePartial } from "@protobuf-ts/runtime"; +import { isJsonObject } from "@protobuf-ts/runtime"; +import { typeofJsonValue } from "@protobuf-ts/runtime"; +import type { JsonValue } from "@protobuf-ts/runtime"; +import { jsonWriteOptions } from "@protobuf-ts/runtime"; +import type { JsonReadOptions } from "@protobuf-ts/runtime"; +import type { JsonWriteOptions } from "@protobuf-ts/runtime"; +import type { BinaryReadOptions } from "@protobuf-ts/runtime"; +import type { IMessageType } from "@protobuf-ts/runtime"; +import { MessageType } from "@protobuf-ts/runtime"; +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := ptypes.MarshalAny(foo) + * ... + * foo := &pb.Foo{} + * if err := ptypes.UnmarshalAny(any, foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * + * JSON + * ==== + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + * + * + * @generated from protobuf message google.protobuf.Any + */ +export interface Any { + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + * + * + * @generated from protobuf field: string type_url = 1; + */ + typeUrl: string; + /** + * Must be a valid serialized protocol buffer of the above specified type. + * + * @generated from protobuf field: bytes value = 2; + */ + value: Uint8Array; +} +// @generated message type with reflection information, may provide speed optimized methods +class Any$Type extends MessageType { + constructor() { + super("google.protobuf.Any", [ + { no: 1, name: "type_url", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "value", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } + /** + * Pack the message into a new `Any`. + * + * Uses 'type.googleapis.com/full.type.name' as the type URL. + */ + pack(message: T, type: IMessageType): Any { + return { + typeUrl: this.typeNameToUrl(type.typeName), value: type.toBinary(message), + }; + } + /** + * Unpack the message from the `Any`. + */ + unpack(any: Any, type: IMessageType, options?: Partial): T { + if (!this.contains(any, type)) + throw new Error("Cannot unpack google.protobuf.Any with typeUrl '" + any.typeUrl + "' as " + type.typeName + "."); + return type.fromBinary(any.value, options); + } + /** + * Does the given `Any` contain a packed message of the given type? + */ + contains(any: Any, type: IMessageType | string): boolean { + if (!any.typeUrl.length) + return false; + let wants = typeof type == "string" ? type : type.typeName; + let has = this.typeUrlToName(any.typeUrl); + return wants === has; + } + /** + * Convert the message to canonical JSON value. + * + * You have to provide the `typeRegistry` option so that the + * packed message can be converted to JSON. + * + * The `typeRegistry` option is also required to read + * `google.protobuf.Any` from JSON format. + */ + internalJsonWrite(any: Any, options: JsonWriteOptions): JsonValue { + if (any.typeUrl === "") + return {}; + let typeName = this.typeUrlToName(any.typeUrl); + let opt = jsonWriteOptions(options); + let type = opt.typeRegistry?.find(t => t.typeName === typeName); + if (!type) + throw new globalThis.Error("Unable to convert google.protobuf.Any with typeUrl '" + any.typeUrl + "' to JSON. The specified type " + typeName + " is not available in the type registry."); + let value = type.fromBinary(any.value, { readUnknownField: false }); + let json = type.internalJsonWrite(value, opt); + if (typeName.startsWith("google.protobuf.") || !isJsonObject(json)) + json = { value: json }; + json["@type"] = any.typeUrl; + return json; + } + internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Any): Any { + if (!isJsonObject(json)) + throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON " + typeofJsonValue(json) + "."); + if (typeof json["@type"] != "string" || json["@type"] == "") + return this.create(); + let typeName = this.typeUrlToName(json["@type"]); + let type = options?.typeRegistry?.find(t => t.typeName == typeName); + if (!type) + throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON. The specified type " + typeName + " is not available in the type registry."); + let value; + if (typeName.startsWith("google.protobuf.") && json.hasOwnProperty("value")) + value = type.fromJson(json["value"], options); + else { + let copy = Object.assign({}, json); + delete copy["@type"]; + value = type.fromJson(copy, options); + } + if (target === undefined) + target = this.create(); + target.typeUrl = json["@type"]; + target.value = type.toBinary(value); + return target; + } + typeNameToUrl(name: string): string { + if (!name.length) + throw new Error("invalid type name: " + name); + return "type.googleapis.com/" + name; + } + typeUrlToName(url: string): string { + if (!url.length) + throw new Error("invalid type url: " + url); + let slash = url.lastIndexOf("/"); + let name = slash > 0 ? url.substring(slash + 1) : url; + if (!name.length) + throw new Error("invalid type url: " + url); + return name; + } + create(value?: PartialMessage): Any { + const message = globalThis.Object.create((this.messagePrototype!)); + message.typeUrl = ""; + message.value = new Uint8Array(0); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Any): Any { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* string type_url */ 1: + message.typeUrl = reader.string(); + break; + case /* bytes value */ 2: + message.value = reader.bytes(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: Any, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* string type_url = 1; */ + if (message.typeUrl !== "") + writer.tag(1, WireType.LengthDelimited).string(message.typeUrl); + /* bytes value = 2; */ + if (message.value.length) + writer.tag(2, WireType.LengthDelimited).bytes(message.value); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message google.protobuf.Any + */ +export const Any = new Any$Type(); diff --git a/packages/sdk/src/generated/google/protobuf/empty.ts b/packages/sdk/src/generated/google/protobuf/empty.ts new file mode 100644 index 0000000000..306ec9ccba --- /dev/null +++ b/packages/sdk/src/generated/google/protobuf/empty.ts @@ -0,0 +1,82 @@ +// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number +// @generated from protobuf file "google/protobuf/empty.proto" (package "google.protobuf", syntax proto3) +// tslint:disable +// +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; +import type { IBinaryWriter } from "@protobuf-ts/runtime"; +import { UnknownFieldHandler } from "@protobuf-ts/runtime"; +import type { BinaryReadOptions } from "@protobuf-ts/runtime"; +import type { IBinaryReader } from "@protobuf-ts/runtime"; +import type { PartialMessage } from "@protobuf-ts/runtime"; +import { reflectionMergePartial } from "@protobuf-ts/runtime"; +import { MessageType } from "@protobuf-ts/runtime"; +/** + * A generic empty message that you can re-use to avoid defining duplicated + * empty messages in your APIs. A typical example is to use it as the request + * or the response type of an API method. For instance: + * + * service Foo { + * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + * } + * + * The JSON representation for `Empty` is empty JSON object `{}`. + * + * @generated from protobuf message google.protobuf.Empty + */ +export interface Empty { +} +// @generated message type with reflection information, may provide speed optimized methods +class Empty$Type extends MessageType { + constructor() { + super("google.protobuf.Empty", []); + } + create(value?: PartialMessage): Empty { + const message = globalThis.Object.create((this.messagePrototype!)); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Empty): Empty { + return target ?? this.create(); + } + internalBinaryWrite(message: Empty, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message google.protobuf.Empty + */ +export const Empty = new Empty$Type(); diff --git a/packages/sdk/src/generated/google/protobuf/timestamp.ts b/packages/sdk/src/generated/google/protobuf/timestamp.ts new file mode 100644 index 0000000000..c465566b94 --- /dev/null +++ b/packages/sdk/src/generated/google/protobuf/timestamp.ts @@ -0,0 +1,281 @@ +// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number +// @generated from protobuf file "google/protobuf/timestamp.proto" (package "google.protobuf", syntax proto3) +// tslint:disable +// +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; +import type { IBinaryWriter } from "@protobuf-ts/runtime"; +import { WireType } from "@protobuf-ts/runtime"; +import type { BinaryReadOptions } from "@protobuf-ts/runtime"; +import type { IBinaryReader } from "@protobuf-ts/runtime"; +import { UnknownFieldHandler } from "@protobuf-ts/runtime"; +import type { PartialMessage } from "@protobuf-ts/runtime"; +import { reflectionMergePartial } from "@protobuf-ts/runtime"; +import { typeofJsonValue } from "@protobuf-ts/runtime"; +import type { JsonValue } from "@protobuf-ts/runtime"; +import type { JsonReadOptions } from "@protobuf-ts/runtime"; +import type { JsonWriteOptions } from "@protobuf-ts/runtime"; +import { PbLong } from "@protobuf-ts/runtime"; +import { MessageType } from "@protobuf-ts/runtime"; +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * + * Example 5: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * ) to obtain a formatter capable of generating timestamps in this format. + * + * + * + * @generated from protobuf message google.protobuf.Timestamp + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + * + * @generated from protobuf field: int64 seconds = 1; + */ + seconds: number; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + * + * @generated from protobuf field: int32 nanos = 2; + */ + nanos: number; +} +// @generated message type with reflection information, may provide speed optimized methods +class Timestamp$Type extends MessageType { + constructor() { + super("google.protobuf.Timestamp", [ + { no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ }, + { no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ } + ]); + } + /** + * Creates a new `Timestamp` for the current time. + */ + now(): Timestamp { + const msg = this.create(); + const ms = Date.now(); + msg.seconds = PbLong.from(Math.floor(ms / 1000)).toNumber(); + msg.nanos = (ms % 1000) * 1000000; + return msg; + } + /** + * Converts a `Timestamp` to a JavaScript Date. + */ + toDate(message: Timestamp): Date { + return new Date(PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000)); + } + /** + * Converts a JavaScript Date to a `Timestamp`. + */ + fromDate(date: Date): Timestamp { + const msg = this.create(); + const ms = date.getTime(); + msg.seconds = PbLong.from(Math.floor(ms / 1000)).toNumber(); + msg.nanos = (ms % 1000) * 1000000; + return msg; + } + /** + * In JSON format, the `Timestamp` type is encoded as a string + * in the RFC 3339 format. + */ + internalJsonWrite(message: Timestamp, options: JsonWriteOptions): JsonValue { + let ms = PbLong.from(message.seconds).toNumber() * 1000; + if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) + throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive."); + if (message.nanos < 0) + throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative."); + let z = "Z"; + if (message.nanos > 0) { + let nanosStr = (message.nanos + 1000000000).toString().substring(1); + if (nanosStr.substring(3) === "000000") + z = "." + nanosStr.substring(0, 3) + "Z"; + else if (nanosStr.substring(6) === "000") + z = "." + nanosStr.substring(0, 6) + "Z"; + else + z = "." + nanosStr + "Z"; + } + return new Date(ms).toISOString().replace(".000Z", z); + } + /** + * In JSON format, the `Timestamp` type is encoded as a string + * in the RFC 3339 format. + */ + internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Timestamp): Timestamp { + if (typeof json !== "string") + throw new Error("Unable to parse Timestamp from JSON " + typeofJsonValue(json) + "."); + let matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/); + if (!matches) + throw new Error("Unable to parse Timestamp from JSON. Invalid format."); + let ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z")); + if (Number.isNaN(ms)) + throw new Error("Unable to parse Timestamp from JSON. Invalid value."); + if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) + throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive."); + if (!target) + target = this.create(); + target.seconds = PbLong.from(ms / 1000).toNumber(); + target.nanos = 0; + if (matches[7]) + target.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000); + return target; + } + create(value?: PartialMessage): Timestamp { + const message = globalThis.Object.create((this.messagePrototype!)); + message.seconds = 0; + message.nanos = 0; + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Timestamp): Timestamp { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* int64 seconds */ 1: + message.seconds = reader.int64().toNumber(); + break; + case /* int32 nanos */ 2: + message.nanos = reader.int32(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: Timestamp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* int64 seconds = 1; */ + if (message.seconds !== 0) + writer.tag(1, WireType.Varint).int64(message.seconds); + /* int32 nanos = 2; */ + if (message.nanos !== 0) + writer.tag(2, WireType.Varint).int32(message.nanos); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message google.protobuf.Timestamp + */ +export const Timestamp = new Timestamp$Type(); diff --git a/packages/sdk/src/generated/packages/dht/protos/DhtRpc.client.ts b/packages/sdk/src/generated/packages/dht/protos/DhtRpc.client.ts new file mode 100644 index 0000000000..dc75017c56 --- /dev/null +++ b/packages/sdk/src/generated/packages/dht/protos/DhtRpc.client.ts @@ -0,0 +1,407 @@ +// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number +// @generated from protobuf file "packages/dht/protos/DhtRpc.proto" (package "dht", syntax proto3) +// tslint:disable +import { ExternalApiRpc } from "./DhtRpc"; +import type { ExternalStoreDataResponse } from "./DhtRpc"; +import type { ExternalStoreDataRequest } from "./DhtRpc"; +import type { ExternalFetchDataResponse } from "./DhtRpc"; +import type { ExternalFetchDataRequest } from "./DhtRpc"; +import { ConnectionLockRpc } from "./DhtRpc"; +import type { DisconnectNotice } from "./DhtRpc"; +import type { UnlockRequest } from "./DhtRpc"; +import type { LockResponse } from "./DhtRpc"; +import type { LockRequest } from "./DhtRpc"; +import { WebrtcConnectorRpc } from "./DhtRpc"; +import type { IceCandidate } from "./DhtRpc"; +import type { RtcAnswer } from "./DhtRpc"; +import type { RtcOffer } from "./DhtRpc"; +import type { WebrtcConnectionRequest } from "./DhtRpc"; +import { WebsocketClientConnectorRpc } from "./DhtRpc"; +import type { WebsocketConnectionRequest } from "./DhtRpc"; +import { RecursiveOperationSessionRpc } from "./DhtRpc"; +import type { RecursiveOperationResponse } from "./DhtRpc"; +import { StoreRpc } from "./DhtRpc"; +import type { ReplicateDataRequest } from "./DhtRpc"; +import type { StoreDataResponse } from "./DhtRpc"; +import type { StoreDataRequest } from "./DhtRpc"; +import { RecursiveOperationRpc } from "./DhtRpc"; +import { RouterRpc } from "./DhtRpc"; +import type { RouteMessageAck } from "./DhtRpc"; +import type { RouteMessageWrapper } from "./DhtRpc"; +import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; +import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; +import { DhtNodeRpc } from "./DhtRpc"; +import type { Empty } from "../../../google/protobuf/empty"; +import type { LeaveNotice } from "./DhtRpc"; +import type { PingResponse } from "./DhtRpc"; +import type { PingRequest } from "./DhtRpc"; +import type { ClosestRingPeersResponse } from "./DhtRpc"; +import type { ClosestRingPeersRequest } from "./DhtRpc"; +import { stackIntercept } from "@protobuf-ts/runtime-rpc"; +import type { ClosestPeersResponse } from "./DhtRpc"; +import type { ClosestPeersRequest } from "./DhtRpc"; +import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; +import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; +/** + * @generated from protobuf service dht.DhtNodeRpc + */ +export interface IDhtNodeRpcClient { + /** + * TODO rename to getClosestNeighbors (breaking change) + * + * @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse); + */ + getClosestPeers(input: ClosestPeersRequest, options?: RpcOptions): UnaryCall; + /** + * TODO rename to getClosestRingContacts (breaking change) + * + * @generated from protobuf rpc: getClosestRingPeers(dht.ClosestRingPeersRequest) returns (dht.ClosestRingPeersResponse); + */ + getClosestRingPeers(input: ClosestRingPeersRequest, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse); + */ + ping(input: PingRequest, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: leaveNotice(dht.LeaveNotice) returns (google.protobuf.Empty); + */ + leaveNotice(input: LeaveNotice, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.DhtNodeRpc + */ +export class DhtNodeRpcClient implements IDhtNodeRpcClient, ServiceInfo { + typeName = DhtNodeRpc.typeName; + methods = DhtNodeRpc.methods; + options = DhtNodeRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * TODO rename to getClosestNeighbors (breaking change) + * + * @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse); + */ + getClosestPeers(input: ClosestPeersRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * TODO rename to getClosestRingContacts (breaking change) + * + * @generated from protobuf rpc: getClosestRingPeers(dht.ClosestRingPeersRequest) returns (dht.ClosestRingPeersResponse); + */ + getClosestRingPeers(input: ClosestRingPeersRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[1], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse); + */ + ping(input: PingRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[2], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: leaveNotice(dht.LeaveNotice) returns (google.protobuf.Empty); + */ + leaveNotice(input: LeaveNotice, options?: RpcOptions): UnaryCall { + const method = this.methods[3], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.RouterRpc + */ +export interface IRouterRpcClient { + /** + * @generated from protobuf rpc: routeMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + routeMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: forwardMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + forwardMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.RouterRpc + */ +export class RouterRpcClient implements IRouterRpcClient, ServiceInfo { + typeName = RouterRpc.typeName; + methods = RouterRpc.methods; + options = RouterRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: routeMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + routeMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: forwardMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + forwardMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall { + const method = this.methods[1], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.RecursiveOperationRpc + */ +export interface IRecursiveOperationRpcClient { + /** + * @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + routeRequest(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.RecursiveOperationRpc + */ +export class RecursiveOperationRpcClient implements IRecursiveOperationRpcClient, ServiceInfo { + typeName = RecursiveOperationRpc.typeName; + methods = RecursiveOperationRpc.methods; + options = RecursiveOperationRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + routeRequest(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.StoreRpc + */ +export interface IStoreRpcClient { + /** + * @generated from protobuf rpc: storeData(dht.StoreDataRequest) returns (dht.StoreDataResponse); + */ + storeData(input: StoreDataRequest, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: replicateData(dht.ReplicateDataRequest) returns (google.protobuf.Empty); + */ + replicateData(input: ReplicateDataRequest, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.StoreRpc + */ +export class StoreRpcClient implements IStoreRpcClient, ServiceInfo { + typeName = StoreRpc.typeName; + methods = StoreRpc.methods; + options = StoreRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: storeData(dht.StoreDataRequest) returns (dht.StoreDataResponse); + */ + storeData(input: StoreDataRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: replicateData(dht.ReplicateDataRequest) returns (google.protobuf.Empty); + */ + replicateData(input: ReplicateDataRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[1], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.RecursiveOperationSessionRpc + */ +export interface IRecursiveOperationSessionRpcClient { + /** + * @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty); + */ + sendResponse(input: RecursiveOperationResponse, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.RecursiveOperationSessionRpc + */ +export class RecursiveOperationSessionRpcClient implements IRecursiveOperationSessionRpcClient, ServiceInfo { + typeName = RecursiveOperationSessionRpc.typeName; + methods = RecursiveOperationSessionRpc.methods; + options = RecursiveOperationSessionRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty); + */ + sendResponse(input: RecursiveOperationResponse, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.WebsocketClientConnectorRpc + */ +export interface IWebsocketClientConnectorRpcClient { + /** + * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty); + */ + requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.WebsocketClientConnectorRpc + */ +export class WebsocketClientConnectorRpcClient implements IWebsocketClientConnectorRpcClient, ServiceInfo { + typeName = WebsocketClientConnectorRpc.typeName; + methods = WebsocketClientConnectorRpc.methods; + options = WebsocketClientConnectorRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty); + */ + requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.WebrtcConnectorRpc + */ +export interface IWebrtcConnectorRpcClient { + /** + * @generated from protobuf rpc: requestConnection(dht.WebrtcConnectionRequest) returns (google.protobuf.Empty); + */ + requestConnection(input: WebrtcConnectionRequest, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: rtcOffer(dht.RtcOffer) returns (google.protobuf.Empty); + */ + rtcOffer(input: RtcOffer, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: rtcAnswer(dht.RtcAnswer) returns (google.protobuf.Empty); + */ + rtcAnswer(input: RtcAnswer, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: iceCandidate(dht.IceCandidate) returns (google.protobuf.Empty); + */ + iceCandidate(input: IceCandidate, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.WebrtcConnectorRpc + */ +export class WebrtcConnectorRpcClient implements IWebrtcConnectorRpcClient, ServiceInfo { + typeName = WebrtcConnectorRpc.typeName; + methods = WebrtcConnectorRpc.methods; + options = WebrtcConnectorRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: requestConnection(dht.WebrtcConnectionRequest) returns (google.protobuf.Empty); + */ + requestConnection(input: WebrtcConnectionRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: rtcOffer(dht.RtcOffer) returns (google.protobuf.Empty); + */ + rtcOffer(input: RtcOffer, options?: RpcOptions): UnaryCall { + const method = this.methods[1], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: rtcAnswer(dht.RtcAnswer) returns (google.protobuf.Empty); + */ + rtcAnswer(input: RtcAnswer, options?: RpcOptions): UnaryCall { + const method = this.methods[2], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: iceCandidate(dht.IceCandidate) returns (google.protobuf.Empty); + */ + iceCandidate(input: IceCandidate, options?: RpcOptions): UnaryCall { + const method = this.methods[3], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.ConnectionLockRpc + */ +export interface IConnectionLockRpcClient { + /** + * @generated from protobuf rpc: lockRequest(dht.LockRequest) returns (dht.LockResponse); + */ + lockRequest(input: LockRequest, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: unlockRequest(dht.UnlockRequest) returns (google.protobuf.Empty); + */ + unlockRequest(input: UnlockRequest, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (google.protobuf.Empty); + */ + gracefulDisconnect(input: DisconnectNotice, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.ConnectionLockRpc + */ +export class ConnectionLockRpcClient implements IConnectionLockRpcClient, ServiceInfo { + typeName = ConnectionLockRpc.typeName; + methods = ConnectionLockRpc.methods; + options = ConnectionLockRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: lockRequest(dht.LockRequest) returns (dht.LockResponse); + */ + lockRequest(input: LockRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: unlockRequest(dht.UnlockRequest) returns (google.protobuf.Empty); + */ + unlockRequest(input: UnlockRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[1], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (google.protobuf.Empty); + */ + gracefulDisconnect(input: DisconnectNotice, options?: RpcOptions): UnaryCall { + const method = this.methods[2], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.ExternalApiRpc + */ +export interface IExternalApiRpcClient { + /** + * @generated from protobuf rpc: externalFetchData(dht.ExternalFetchDataRequest) returns (dht.ExternalFetchDataResponse); + */ + externalFetchData(input: ExternalFetchDataRequest, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: externalStoreData(dht.ExternalStoreDataRequest) returns (dht.ExternalStoreDataResponse); + */ + externalStoreData(input: ExternalStoreDataRequest, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.ExternalApiRpc + */ +export class ExternalApiRpcClient implements IExternalApiRpcClient, ServiceInfo { + typeName = ExternalApiRpc.typeName; + methods = ExternalApiRpc.methods; + options = ExternalApiRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: externalFetchData(dht.ExternalFetchDataRequest) returns (dht.ExternalFetchDataResponse); + */ + externalFetchData(input: ExternalFetchDataRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: externalStoreData(dht.ExternalStoreDataRequest) returns (dht.ExternalStoreDataResponse); + */ + externalStoreData(input: ExternalStoreDataRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[1], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} diff --git a/packages/sdk/src/generated/packages/dht/protos/DhtRpc.server.ts b/packages/sdk/src/generated/packages/dht/protos/DhtRpc.server.ts new file mode 100644 index 0000000000..a2e210f8d2 --- /dev/null +++ b/packages/sdk/src/generated/packages/dht/protos/DhtRpc.server.ts @@ -0,0 +1,160 @@ +// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number +// @generated from protobuf file "packages/dht/protos/DhtRpc.proto" (package "dht", syntax proto3) +// tslint:disable +import { ExternalStoreDataResponse } from "./DhtRpc"; +import { ExternalStoreDataRequest } from "./DhtRpc"; +import { ExternalFetchDataResponse } from "./DhtRpc"; +import { ExternalFetchDataRequest } from "./DhtRpc"; +import { DisconnectNotice } from "./DhtRpc"; +import { UnlockRequest } from "./DhtRpc"; +import { LockResponse } from "./DhtRpc"; +import { LockRequest } from "./DhtRpc"; +import { IceCandidate } from "./DhtRpc"; +import { RtcAnswer } from "./DhtRpc"; +import { RtcOffer } from "./DhtRpc"; +import { WebrtcConnectionRequest } from "./DhtRpc"; +import { WebsocketConnectionRequest } from "./DhtRpc"; +import { RecursiveOperationResponse } from "./DhtRpc"; +import { ReplicateDataRequest } from "./DhtRpc"; +import { StoreDataResponse } from "./DhtRpc"; +import { StoreDataRequest } from "./DhtRpc"; +import { RouteMessageAck } from "./DhtRpc"; +import { RouteMessageWrapper } from "./DhtRpc"; +import { Empty } from "../../../google/protobuf/empty"; +import { LeaveNotice } from "./DhtRpc"; +import { PingResponse } from "./DhtRpc"; +import { PingRequest } from "./DhtRpc"; +import { ClosestRingPeersResponse } from "./DhtRpc"; +import { ClosestRingPeersRequest } from "./DhtRpc"; +import { ClosestPeersResponse } from "./DhtRpc"; +import { ClosestPeersRequest } from "./DhtRpc"; +import { ServerCallContext } from "@protobuf-ts/runtime-rpc"; +/** + * @generated from protobuf service dht.DhtNodeRpc + */ +export interface IDhtNodeRpc { + /** + * TODO rename to getClosestNeighbors (breaking change) + * + * @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse); + */ + getClosestPeers(request: ClosestPeersRequest, context: T): Promise; + /** + * TODO rename to getClosestRingContacts (breaking change) + * + * @generated from protobuf rpc: getClosestRingPeers(dht.ClosestRingPeersRequest) returns (dht.ClosestRingPeersResponse); + */ + getClosestRingPeers(request: ClosestRingPeersRequest, context: T): Promise; + /** + * @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse); + */ + ping(request: PingRequest, context: T): Promise; + /** + * @generated from protobuf rpc: leaveNotice(dht.LeaveNotice) returns (google.protobuf.Empty); + */ + leaveNotice(request: LeaveNotice, context: T): Promise; +} +/** + * @generated from protobuf service dht.RouterRpc + */ +export interface IRouterRpc { + /** + * @generated from protobuf rpc: routeMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + routeMessage(request: RouteMessageWrapper, context: T): Promise; + /** + * @generated from protobuf rpc: forwardMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + forwardMessage(request: RouteMessageWrapper, context: T): Promise; +} +/** + * @generated from protobuf service dht.RecursiveOperationRpc + */ +export interface IRecursiveOperationRpc { + /** + * @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + routeRequest(request: RouteMessageWrapper, context: T): Promise; +} +/** + * @generated from protobuf service dht.StoreRpc + */ +export interface IStoreRpc { + /** + * @generated from protobuf rpc: storeData(dht.StoreDataRequest) returns (dht.StoreDataResponse); + */ + storeData(request: StoreDataRequest, context: T): Promise; + /** + * @generated from protobuf rpc: replicateData(dht.ReplicateDataRequest) returns (google.protobuf.Empty); + */ + replicateData(request: ReplicateDataRequest, context: T): Promise; +} +/** + * @generated from protobuf service dht.RecursiveOperationSessionRpc + */ +export interface IRecursiveOperationSessionRpc { + /** + * @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty); + */ + sendResponse(request: RecursiveOperationResponse, context: T): Promise; +} +/** + * @generated from protobuf service dht.WebsocketClientConnectorRpc + */ +export interface IWebsocketClientConnectorRpc { + /** + * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty); + */ + requestConnection(request: WebsocketConnectionRequest, context: T): Promise; +} +/** + * @generated from protobuf service dht.WebrtcConnectorRpc + */ +export interface IWebrtcConnectorRpc { + /** + * @generated from protobuf rpc: requestConnection(dht.WebrtcConnectionRequest) returns (google.protobuf.Empty); + */ + requestConnection(request: WebrtcConnectionRequest, context: T): Promise; + /** + * @generated from protobuf rpc: rtcOffer(dht.RtcOffer) returns (google.protobuf.Empty); + */ + rtcOffer(request: RtcOffer, context: T): Promise; + /** + * @generated from protobuf rpc: rtcAnswer(dht.RtcAnswer) returns (google.protobuf.Empty); + */ + rtcAnswer(request: RtcAnswer, context: T): Promise; + /** + * @generated from protobuf rpc: iceCandidate(dht.IceCandidate) returns (google.protobuf.Empty); + */ + iceCandidate(request: IceCandidate, context: T): Promise; +} +/** + * @generated from protobuf service dht.ConnectionLockRpc + */ +export interface IConnectionLockRpc { + /** + * @generated from protobuf rpc: lockRequest(dht.LockRequest) returns (dht.LockResponse); + */ + lockRequest(request: LockRequest, context: T): Promise; + /** + * @generated from protobuf rpc: unlockRequest(dht.UnlockRequest) returns (google.protobuf.Empty); + */ + unlockRequest(request: UnlockRequest, context: T): Promise; + /** + * @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (google.protobuf.Empty); + */ + gracefulDisconnect(request: DisconnectNotice, context: T): Promise; +} +/** + * @generated from protobuf service dht.ExternalApiRpc + */ +export interface IExternalApiRpc { + /** + * @generated from protobuf rpc: externalFetchData(dht.ExternalFetchDataRequest) returns (dht.ExternalFetchDataResponse); + */ + externalFetchData(request: ExternalFetchDataRequest, context: T): Promise; + /** + * @generated from protobuf rpc: externalStoreData(dht.ExternalStoreDataRequest) returns (dht.ExternalStoreDataResponse); + */ + externalStoreData(request: ExternalStoreDataRequest, context: T): Promise; +} diff --git a/packages/sdk/src/generated/packages/dht/protos/DhtRpc.ts b/packages/sdk/src/generated/packages/dht/protos/DhtRpc.ts new file mode 100644 index 0000000000..73ac705f7a --- /dev/null +++ b/packages/sdk/src/generated/packages/dht/protos/DhtRpc.ts @@ -0,0 +1,1244 @@ +// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number +// @generated from protobuf file "packages/dht/protos/DhtRpc.proto" (package "dht", syntax proto3) +// tslint:disable +import { Empty } from "../../../google/protobuf/empty"; +import { ServiceType } from "@protobuf-ts/runtime-rpc"; +import { MessageType } from "@protobuf-ts/runtime"; +import { RpcMessage } from "../../proto-rpc/protos/ProtoRpc"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Any } from "../../../google/protobuf/any"; +// Used inside RpcMessage + +/** + * @generated from protobuf message dht.StoreDataRequest + */ +export interface StoreDataRequest { + /** + * @generated from protobuf field: bytes key = 1; + */ + key: Uint8Array; + /** + * @generated from protobuf field: google.protobuf.Any data = 2; + */ + data?: Any; + /** + * @generated from protobuf field: bytes creator = 3; + */ + creator: Uint8Array; + /** + * @generated from protobuf field: google.protobuf.Timestamp createdAt = 4; + */ + createdAt?: Timestamp; + /** + * @generated from protobuf field: uint32 ttl = 5; + */ + ttl: number; +} +/** + * @generated from protobuf message dht.StoreDataResponse + */ +export interface StoreDataResponse { +} +/** + * @generated from protobuf message dht.ExternalStoreDataRequest + */ +export interface ExternalStoreDataRequest { + /** + * @generated from protobuf field: bytes key = 1; + */ + key: Uint8Array; + /** + * @generated from protobuf field: google.protobuf.Any data = 2; + */ + data?: Any; +} +/** + * @generated from protobuf message dht.ExternalStoreDataResponse + */ +export interface ExternalStoreDataResponse { + /** + * @generated from protobuf field: repeated dht.PeerDescriptor storers = 1; + */ + storers: PeerDescriptor[]; +} +/** + * @generated from protobuf message dht.ReplicateDataRequest + */ +export interface ReplicateDataRequest { + /** + * @generated from protobuf field: dht.DataEntry entry = 1; + */ + entry?: DataEntry; +} +/** + * @generated from protobuf message dht.DataEntry + */ +export interface DataEntry { + /** + * @generated from protobuf field: bytes key = 1; + */ + key: Uint8Array; + /** + * @generated from protobuf field: google.protobuf.Any data = 2; + */ + data?: Any; + /** + * @generated from protobuf field: bytes creator = 3; + */ + creator: Uint8Array; + /** + * @generated from protobuf field: google.protobuf.Timestamp createdAt = 4; + */ + createdAt?: Timestamp; + /** + * @generated from protobuf field: google.protobuf.Timestamp storedAt = 5; + */ + storedAt?: Timestamp; + /** + * @generated from protobuf field: uint32 ttl = 6; + */ + ttl: number; // milliseconds + /** + * @generated from protobuf field: bool stale = 7; + */ + stale: boolean; + /** + * @generated from protobuf field: bool deleted = 8; + */ + deleted: boolean; +} +/** + * TODO rename to ClosestNeighborsRequest + * + * @generated from protobuf message dht.ClosestPeersRequest + */ +export interface ClosestPeersRequest { + /** + * @generated from protobuf field: bytes nodeId = 1; + */ + nodeId: Uint8Array; + /** + * @generated from protobuf field: string requestId = 2; + */ + requestId: string; +} +/** + * TODO rename to ClosestNeighborsResponse + * + * @generated from protobuf message dht.ClosestPeersResponse + */ +export interface ClosestPeersResponse { + /** + * @generated from protobuf field: repeated dht.PeerDescriptor peers = 1; + */ + peers: PeerDescriptor[]; + /** + * @generated from protobuf field: string requestId = 2; + */ + requestId: string; +} +/** + * TODO rename to ClosestRingContactsRequest + * + * @generated from protobuf message dht.ClosestRingPeersRequest + */ +export interface ClosestRingPeersRequest { + /** + * @generated from protobuf field: bytes ringId = 1; + */ + ringId: Uint8Array; + /** + * @generated from protobuf field: string requestId = 2; + */ + requestId: string; +} +/** + * TODO rename to ClosestRingContactsResponse + * + * @generated from protobuf message dht.ClosestRingPeersResponse + */ +export interface ClosestRingPeersResponse { + /** + * @generated from protobuf field: repeated dht.PeerDescriptor leftPeers = 1; + */ + leftPeers: PeerDescriptor[]; + /** + * @generated from protobuf field: repeated dht.PeerDescriptor rightPeers = 2; + */ + rightPeers: PeerDescriptor[]; + /** + * @generated from protobuf field: string requestId = 3; + */ + requestId: string; +} +/** + * @generated from protobuf message dht.RecursiveOperationRequest + */ +export interface RecursiveOperationRequest { + /** + * @generated from protobuf field: string sessionId = 1; + */ + sessionId: string; + /** + * @generated from protobuf field: dht.RecursiveOperation operation = 2; + */ + operation: RecursiveOperation; +} +/** + * @generated from protobuf message dht.RecursiveOperationResponse + */ +export interface RecursiveOperationResponse { + /** + * @generated from protobuf field: repeated dht.PeerDescriptor closestConnectedNodes = 1; + */ + closestConnectedNodes: PeerDescriptor[]; + /** + * @generated from protobuf field: repeated dht.DataEntry dataEntries = 2; + */ + dataEntries: DataEntry[]; + /** + * @generated from protobuf field: bool noCloserNodesFound = 3; + */ + noCloserNodesFound: boolean; + /** + * @generated from protobuf field: repeated dht.PeerDescriptor routingPath = 4; + */ + routingPath: PeerDescriptor[]; +} +/** + * @generated from protobuf message dht.PingRequest + */ +export interface PingRequest { + /** + * @generated from protobuf field: string requestId = 1; + */ + requestId: string; +} +/** + * @generated from protobuf message dht.PingResponse + */ +export interface PingResponse { + /** + * @generated from protobuf field: string requestId = 1; + */ + requestId: string; +} +/** + * @generated from protobuf message dht.LeaveNotice + */ +export interface LeaveNotice { +} +/** + * @generated from protobuf message dht.PeerDescriptor + */ +export interface PeerDescriptor { + /** + * @generated from protobuf field: bytes nodeId = 1; + */ + nodeId: Uint8Array; + /** + * @generated from protobuf field: dht.NodeType type = 2; + */ + type: NodeType; + /** + * @generated from protobuf field: dht.ConnectivityMethod udp = 3; + */ + udp?: ConnectivityMethod; + /** + * @generated from protobuf field: dht.ConnectivityMethod tcp = 4; + */ + tcp?: ConnectivityMethod; + /** + * @generated from protobuf field: dht.ConnectivityMethod websocket = 5; + */ + websocket?: ConnectivityMethod; + /** + * @generated from protobuf field: optional uint32 region = 6; + */ + region?: number; + /** + * @generated from protobuf field: optional uint32 ipAddress = 7; + */ + ipAddress?: number; + /** + * @generated from protobuf field: optional bytes publicKey = 8; + */ + publicKey?: Uint8Array; + /** + * signature of fields 2-8 + * + * @generated from protobuf field: optional bytes signature = 9; + */ + signature?: Uint8Array; +} +/** + * @generated from protobuf message dht.ConnectivityMethod + */ +export interface ConnectivityMethod { + /** + * @generated from protobuf field: uint32 port = 1; + */ + port: number; + /** + * @generated from protobuf field: string host = 2; + */ + host: string; + /** + * @generated from protobuf field: bool tls = 3; + */ + tls: boolean; +} +/** + * @generated from protobuf message dht.RouteMessageWrapper + */ +export interface RouteMessageWrapper { + /** + * @generated from protobuf field: string requestId = 1; + */ + requestId: string; + /** + * @generated from protobuf field: dht.PeerDescriptor sourcePeer = 2; + */ + sourcePeer?: PeerDescriptor; + /** + * @generated from protobuf field: bytes target = 3; + */ + target: Uint8Array; + /** + * @generated from protobuf field: dht.Message message = 4; + */ + message?: Message; + /** + * @generated from protobuf field: repeated dht.PeerDescriptor reachableThrough = 5; + */ + reachableThrough: PeerDescriptor[]; + /** + * @generated from protobuf field: repeated dht.PeerDescriptor routingPath = 6; + */ + routingPath: PeerDescriptor[]; + /** + * @generated from protobuf field: repeated string parallelRootNodeIds = 7; + */ + parallelRootNodeIds: string[]; +} +/** + * @generated from protobuf message dht.RouteMessageAck + */ +export interface RouteMessageAck { + /** + * @generated from protobuf field: string requestId = 1; + */ + requestId: string; + /** + * @generated from protobuf field: optional dht.RouteMessageError error = 2; + */ + error?: RouteMessageError; +} +/** + * @generated from protobuf message dht.ConnectivityRequest + */ +export interface ConnectivityRequest { + /** + * @generated from protobuf field: uint32 port = 1; + */ + port: number; + /** + * @generated from protobuf field: bool tls = 2; + */ + tls: boolean; + /** + * @generated from protobuf field: optional string host = 3; + */ + host?: string; + /** + * @generated from protobuf field: bool allowSelfSignedCertificate = 4; + */ + allowSelfSignedCertificate: boolean; +} +/** + * @generated from protobuf message dht.ConnectivityResponse + */ +export interface ConnectivityResponse { + /** + * @generated from protobuf field: string host = 1; + */ + host: string; + /** + * @generated from protobuf field: string natType = 2; + */ + natType: string; + /** + * @generated from protobuf field: dht.ConnectivityMethod websocket = 3; + */ + websocket?: ConnectivityMethod; + /** + * @generated from protobuf field: uint32 ipAddress = 4; + */ + ipAddress: number; + /** + * @generated from protobuf field: string version = 5; + */ + version: string; + /** + * @generated from protobuf field: optional double latitude = 6; + */ + latitude?: number; + /** + * @generated from protobuf field: optional double longitude = 7; + */ + longitude?: number; +} +/** + * @generated from protobuf message dht.HandshakeRequest + */ +export interface HandshakeRequest { + /** + * @generated from protobuf field: dht.PeerDescriptor sourcePeerDescriptor = 1; + */ + sourcePeerDescriptor?: PeerDescriptor; + /** + * @generated from protobuf field: optional dht.PeerDescriptor targetPeerDescriptor = 2; + */ + targetPeerDescriptor?: PeerDescriptor; + /** + * @generated from protobuf field: string version = 3; + */ + version: string; +} +/** + * @generated from protobuf message dht.HandshakeResponse + */ +export interface HandshakeResponse { + /** + * @generated from protobuf field: dht.PeerDescriptor sourcePeerDescriptor = 1; + */ + sourcePeerDescriptor?: PeerDescriptor; + /** + * @generated from protobuf field: optional dht.HandshakeError error = 2; + */ + error?: HandshakeError; + /** + * @generated from protobuf field: string version = 3; + */ + version: string; +} +// Wraps all messages + +/** + * @generated from protobuf message dht.Message + */ +export interface Message { + /** + * @generated from protobuf field: string messageId = 1; + */ + messageId: string; + /** + * @generated from protobuf field: dht.PeerDescriptor sourceDescriptor = 2; + */ + sourceDescriptor?: PeerDescriptor; + /** + * @generated from protobuf field: dht.PeerDescriptor targetDescriptor = 3; + */ + targetDescriptor?: PeerDescriptor; + /** + * @generated from protobuf field: string serviceId = 4; + */ + serviceId: string; // id of the RPC service + /** + * @generated from protobuf oneof: body + */ + body: { + oneofKind: "rpcMessage"; + /** + * @generated from protobuf field: protorpc.RpcMessage rpcMessage = 5; + */ + rpcMessage: RpcMessage; + } | { + oneofKind: "connectivityRequest"; + /** + * @generated from protobuf field: dht.ConnectivityRequest connectivityRequest = 6; + */ + connectivityRequest: ConnectivityRequest; + } | { + oneofKind: "connectivityResponse"; + /** + * @generated from protobuf field: dht.ConnectivityResponse connectivityResponse = 7; + */ + connectivityResponse: ConnectivityResponse; + } | { + oneofKind: "handshakeRequest"; + /** + * @generated from protobuf field: dht.HandshakeRequest handshakeRequest = 8; + */ + handshakeRequest: HandshakeRequest; + } | { + oneofKind: "handshakeResponse"; + /** + * @generated from protobuf field: dht.HandshakeResponse handshakeResponse = 9; + */ + handshakeResponse: HandshakeResponse; + } | { + oneofKind: "recursiveOperationRequest"; + /** + * @generated from protobuf field: dht.RecursiveOperationRequest recursiveOperationRequest = 10; + */ + recursiveOperationRequest: RecursiveOperationRequest; + } | { + oneofKind: undefined; + }; +} +// Connector Messages + +/** + * WebSocket + * + * @generated from protobuf message dht.WebsocketConnectionRequest + */ +export interface WebsocketConnectionRequest { +} +/** + * WebRTC + * + * @generated from protobuf message dht.WebrtcConnectionRequest + */ +export interface WebrtcConnectionRequest { +} +/** + * @generated from protobuf message dht.RtcOffer + */ +export interface RtcOffer { + /** + * @generated from protobuf field: string description = 1; + */ + description: string; + /** + * @generated from protobuf field: string connectionId = 2; + */ + connectionId: string; +} +/** + * @generated from protobuf message dht.RtcAnswer + */ +export interface RtcAnswer { + /** + * @generated from protobuf field: string description = 1; + */ + description: string; + /** + * @generated from protobuf field: string connectionId = 2; + */ + connectionId: string; +} +/** + * @generated from protobuf message dht.IceCandidate + */ +export interface IceCandidate { + /** + * @generated from protobuf field: string candidate = 1; + */ + candidate: string; + /** + * @generated from protobuf field: string mid = 2; + */ + mid: string; + /** + * @generated from protobuf field: string connectionId = 3; + */ + connectionId: string; +} +/** + * @generated from protobuf message dht.LockRequest + */ +export interface LockRequest { + /** + * @generated from protobuf field: string lockId = 1; + */ + lockId: string; +} +/** + * @generated from protobuf message dht.UnlockRequest + */ +export interface UnlockRequest { + /** + * @generated from protobuf field: string lockId = 1; + */ + lockId: string; +} +/** + * @generated from protobuf message dht.LockResponse + */ +export interface LockResponse { + /** + * @generated from protobuf field: bool accepted = 1; + */ + accepted: boolean; +} +/** + * @generated from protobuf message dht.DisconnectNotice + */ +export interface DisconnectNotice { + /** + * @generated from protobuf field: dht.DisconnectMode disconnectMode = 1; + */ + disconnectMode: DisconnectMode; +} +/** + * @generated from protobuf message dht.ExternalFetchDataRequest + */ +export interface ExternalFetchDataRequest { + /** + * @generated from protobuf field: bytes key = 1; + */ + key: Uint8Array; +} +/** + * @generated from protobuf message dht.ExternalFetchDataResponse + */ +export interface ExternalFetchDataResponse { + /** + * @generated from protobuf field: repeated dht.DataEntry entries = 1; + */ + entries: DataEntry[]; +} +/** + * @generated from protobuf enum dht.RecursiveOperation + */ +export enum RecursiveOperation { + /** + * @generated from protobuf enum value: FIND_CLOSEST_NODES = 0; + */ + FIND_CLOSEST_NODES = 0, + /** + * @generated from protobuf enum value: FETCH_DATA = 1; + */ + FETCH_DATA = 1, + /** + * @generated from protobuf enum value: DELETE_DATA = 2; + */ + DELETE_DATA = 2 +} +/** + * @generated from protobuf enum dht.NodeType + */ +export enum NodeType { + /** + * @generated from protobuf enum value: NODEJS = 0; + */ + NODEJS = 0, + /** + * @generated from protobuf enum value: BROWSER = 1; + */ + BROWSER = 1 +} +/** + * @generated from protobuf enum dht.RpcResponseError + */ +export enum RpcResponseError { + /** + * @generated from protobuf enum value: SERVER_TIMOUT = 0; + */ + SERVER_TIMOUT = 0, + /** + * @generated from protobuf enum value: CLIENT_TIMEOUT = 1; + */ + CLIENT_TIMEOUT = 1, + /** + * @generated from protobuf enum value: SERVER_ERROR = 2; + */ + SERVER_ERROR = 2, + /** + * @generated from protobuf enum value: UNKNOWN_RPC_METHOD = 3; + */ + UNKNOWN_RPC_METHOD = 3 +} +/** + * @generated from protobuf enum dht.RouteMessageError + */ +export enum RouteMessageError { + /** + * @generated from protobuf enum value: NO_TARGETS = 0; + */ + NO_TARGETS = 0, + /** + * @generated from protobuf enum value: DUPLICATE = 1; + */ + DUPLICATE = 1, + /** + * TODO: can this be removed? If DhtNode is already stopped the server side requests + * should not be processed + * + * @generated from protobuf enum value: STOPPED = 2; + */ + STOPPED = 2 +} +/** + * @generated from protobuf enum dht.HandshakeError + */ +export enum HandshakeError { + /** + * @generated from protobuf enum value: DUPLICATE_CONNECTION = 0; + */ + DUPLICATE_CONNECTION = 0, + /** + * @generated from protobuf enum value: INVALID_TARGET_PEER_DESCRIPTOR = 1; + */ + INVALID_TARGET_PEER_DESCRIPTOR = 1, + /** + * @generated from protobuf enum value: UNSUPPORTED_VERSION = 2; + */ + UNSUPPORTED_VERSION = 2 +} +/** + * @generated from protobuf enum dht.DisconnectMode + */ +export enum DisconnectMode { + /** + * @generated from protobuf enum value: NORMAL = 0; + */ + NORMAL = 0, + /** + * @generated from protobuf enum value: LEAVING = 1; + */ + LEAVING = 1 +} +// @generated message type with reflection information, may provide speed optimized methods +class StoreDataRequest$Type extends MessageType { + constructor() { + super("dht.StoreDataRequest", [ + { no: 1, name: "key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "data", kind: "message", T: () => Any }, + { no: 3, name: "creator", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 4, name: "createdAt", kind: "message", T: () => Timestamp }, + { no: 5, name: "ttl", kind: "scalar", T: 13 /*ScalarType.UINT32*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.StoreDataRequest + */ +export const StoreDataRequest = new StoreDataRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class StoreDataResponse$Type extends MessageType { + constructor() { + super("dht.StoreDataResponse", []); + } +} +/** + * @generated MessageType for protobuf message dht.StoreDataResponse + */ +export const StoreDataResponse = new StoreDataResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ExternalStoreDataRequest$Type extends MessageType { + constructor() { + super("dht.ExternalStoreDataRequest", [ + { no: 1, name: "key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "data", kind: "message", T: () => Any } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ExternalStoreDataRequest + */ +export const ExternalStoreDataRequest = new ExternalStoreDataRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ExternalStoreDataResponse$Type extends MessageType { + constructor() { + super("dht.ExternalStoreDataResponse", [ + { no: 1, name: "storers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ExternalStoreDataResponse + */ +export const ExternalStoreDataResponse = new ExternalStoreDataResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ReplicateDataRequest$Type extends MessageType { + constructor() { + super("dht.ReplicateDataRequest", [ + { no: 1, name: "entry", kind: "message", T: () => DataEntry } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ReplicateDataRequest + */ +export const ReplicateDataRequest = new ReplicateDataRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class DataEntry$Type extends MessageType { + constructor() { + super("dht.DataEntry", [ + { no: 1, name: "key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "data", kind: "message", T: () => Any }, + { no: 3, name: "creator", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 4, name: "createdAt", kind: "message", T: () => Timestamp }, + { no: 5, name: "storedAt", kind: "message", T: () => Timestamp }, + { no: 6, name: "ttl", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 7, name: "stale", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 8, name: "deleted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.DataEntry + */ +export const DataEntry = new DataEntry$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ClosestPeersRequest$Type extends MessageType { + constructor() { + super("dht.ClosestPeersRequest", [ + { no: 1, name: "nodeId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ClosestPeersRequest + */ +export const ClosestPeersRequest = new ClosestPeersRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ClosestPeersResponse$Type extends MessageType { + constructor() { + super("dht.ClosestPeersResponse", [ + { no: 1, name: "peers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, + { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ClosestPeersResponse + */ +export const ClosestPeersResponse = new ClosestPeersResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ClosestRingPeersRequest$Type extends MessageType { + constructor() { + super("dht.ClosestRingPeersRequest", [ + { no: 1, name: "ringId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ClosestRingPeersRequest + */ +export const ClosestRingPeersRequest = new ClosestRingPeersRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ClosestRingPeersResponse$Type extends MessageType { + constructor() { + super("dht.ClosestRingPeersResponse", [ + { no: 1, name: "leftPeers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, + { no: 2, name: "rightPeers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, + { no: 3, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ClosestRingPeersResponse + */ +export const ClosestRingPeersResponse = new ClosestRingPeersResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class RecursiveOperationRequest$Type extends MessageType { + constructor() { + super("dht.RecursiveOperationRequest", [ + { no: 1, name: "sessionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "operation", kind: "enum", T: () => ["dht.RecursiveOperation", RecursiveOperation] } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.RecursiveOperationRequest + */ +export const RecursiveOperationRequest = new RecursiveOperationRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class RecursiveOperationResponse$Type extends MessageType { + constructor() { + super("dht.RecursiveOperationResponse", [ + { no: 1, name: "closestConnectedNodes", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, + { no: 2, name: "dataEntries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => DataEntry }, + { no: 3, name: "noCloserNodesFound", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 4, name: "routingPath", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.RecursiveOperationResponse + */ +export const RecursiveOperationResponse = new RecursiveOperationResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class PingRequest$Type extends MessageType { + constructor() { + super("dht.PingRequest", [ + { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.PingRequest + */ +export const PingRequest = new PingRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class PingResponse$Type extends MessageType { + constructor() { + super("dht.PingResponse", [ + { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.PingResponse + */ +export const PingResponse = new PingResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class LeaveNotice$Type extends MessageType { + constructor() { + super("dht.LeaveNotice", []); + } +} +/** + * @generated MessageType for protobuf message dht.LeaveNotice + */ +export const LeaveNotice = new LeaveNotice$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class PeerDescriptor$Type extends MessageType { + constructor() { + super("dht.PeerDescriptor", [ + { no: 1, name: "nodeId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "type", kind: "enum", T: () => ["dht.NodeType", NodeType] }, + { no: 3, name: "udp", kind: "message", T: () => ConnectivityMethod }, + { no: 4, name: "tcp", kind: "message", T: () => ConnectivityMethod }, + { no: 5, name: "websocket", kind: "message", T: () => ConnectivityMethod }, + { no: 6, name: "region", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, + { no: 7, name: "ipAddress", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, + { no: 8, name: "publicKey", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ }, + { no: 9, name: "signature", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.PeerDescriptor + */ +export const PeerDescriptor = new PeerDescriptor$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ConnectivityMethod$Type extends MessageType { + constructor() { + super("dht.ConnectivityMethod", [ + { no: 1, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 2, name: "host", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 3, name: "tls", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ConnectivityMethod + */ +export const ConnectivityMethod = new ConnectivityMethod$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class RouteMessageWrapper$Type extends MessageType { + constructor() { + super("dht.RouteMessageWrapper", [ + { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "sourcePeer", kind: "message", T: () => PeerDescriptor }, + { no: 3, name: "target", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 4, name: "message", kind: "message", T: () => Message }, + { no: 5, name: "reachableThrough", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, + { no: 6, name: "routingPath", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, + { no: 7, name: "parallelRootNodeIds", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.RouteMessageWrapper + */ +export const RouteMessageWrapper = new RouteMessageWrapper$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class RouteMessageAck$Type extends MessageType { + constructor() { + super("dht.RouteMessageAck", [ + { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "error", kind: "enum", opt: true, T: () => ["dht.RouteMessageError", RouteMessageError] } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.RouteMessageAck + */ +export const RouteMessageAck = new RouteMessageAck$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ConnectivityRequest$Type extends MessageType { + constructor() { + super("dht.ConnectivityRequest", [ + { no: 1, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 2, name: "tls", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 3, name: "host", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, + { no: 4, name: "allowSelfSignedCertificate", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ConnectivityRequest + */ +export const ConnectivityRequest = new ConnectivityRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ConnectivityResponse$Type extends MessageType { + constructor() { + super("dht.ConnectivityResponse", [ + { no: 1, name: "host", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "natType", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 3, name: "websocket", kind: "message", T: () => ConnectivityMethod }, + { no: 4, name: "ipAddress", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 5, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 6, name: "latitude", kind: "scalar", opt: true, T: 1 /*ScalarType.DOUBLE*/ }, + { no: 7, name: "longitude", kind: "scalar", opt: true, T: 1 /*ScalarType.DOUBLE*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ConnectivityResponse + */ +export const ConnectivityResponse = new ConnectivityResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class HandshakeRequest$Type extends MessageType { + constructor() { + super("dht.HandshakeRequest", [ + { no: 1, name: "sourcePeerDescriptor", kind: "message", T: () => PeerDescriptor }, + { no: 2, name: "targetPeerDescriptor", kind: "message", T: () => PeerDescriptor }, + { no: 3, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.HandshakeRequest + */ +export const HandshakeRequest = new HandshakeRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class HandshakeResponse$Type extends MessageType { + constructor() { + super("dht.HandshakeResponse", [ + { no: 1, name: "sourcePeerDescriptor", kind: "message", T: () => PeerDescriptor }, + { no: 2, name: "error", kind: "enum", opt: true, T: () => ["dht.HandshakeError", HandshakeError] }, + { no: 3, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.HandshakeResponse + */ +export const HandshakeResponse = new HandshakeResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class Message$Type extends MessageType { + constructor() { + super("dht.Message", [ + { no: 1, name: "messageId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "sourceDescriptor", kind: "message", T: () => PeerDescriptor }, + { no: 3, name: "targetDescriptor", kind: "message", T: () => PeerDescriptor }, + { no: 4, name: "serviceId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 5, name: "rpcMessage", kind: "message", oneof: "body", T: () => RpcMessage }, + { no: 6, name: "connectivityRequest", kind: "message", oneof: "body", T: () => ConnectivityRequest }, + { no: 7, name: "connectivityResponse", kind: "message", oneof: "body", T: () => ConnectivityResponse }, + { no: 8, name: "handshakeRequest", kind: "message", oneof: "body", T: () => HandshakeRequest }, + { no: 9, name: "handshakeResponse", kind: "message", oneof: "body", T: () => HandshakeResponse }, + { no: 10, name: "recursiveOperationRequest", kind: "message", oneof: "body", T: () => RecursiveOperationRequest } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.Message + */ +export const Message = new Message$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class WebsocketConnectionRequest$Type extends MessageType { + constructor() { + super("dht.WebsocketConnectionRequest", []); + } +} +/** + * @generated MessageType for protobuf message dht.WebsocketConnectionRequest + */ +export const WebsocketConnectionRequest = new WebsocketConnectionRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class WebrtcConnectionRequest$Type extends MessageType { + constructor() { + super("dht.WebrtcConnectionRequest", []); + } +} +/** + * @generated MessageType for protobuf message dht.WebrtcConnectionRequest + */ +export const WebrtcConnectionRequest = new WebrtcConnectionRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class RtcOffer$Type extends MessageType { + constructor() { + super("dht.RtcOffer", [ + { no: 1, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.RtcOffer + */ +export const RtcOffer = new RtcOffer$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class RtcAnswer$Type extends MessageType { + constructor() { + super("dht.RtcAnswer", [ + { no: 1, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.RtcAnswer + */ +export const RtcAnswer = new RtcAnswer$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class IceCandidate$Type extends MessageType { + constructor() { + super("dht.IceCandidate", [ + { no: 1, name: "candidate", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "mid", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 3, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.IceCandidate + */ +export const IceCandidate = new IceCandidate$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class LockRequest$Type extends MessageType { + constructor() { + super("dht.LockRequest", [ + { no: 1, name: "lockId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.LockRequest + */ +export const LockRequest = new LockRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class UnlockRequest$Type extends MessageType { + constructor() { + super("dht.UnlockRequest", [ + { no: 1, name: "lockId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.UnlockRequest + */ +export const UnlockRequest = new UnlockRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class LockResponse$Type extends MessageType { + constructor() { + super("dht.LockResponse", [ + { no: 1, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.LockResponse + */ +export const LockResponse = new LockResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class DisconnectNotice$Type extends MessageType { + constructor() { + super("dht.DisconnectNotice", [ + { no: 1, name: "disconnectMode", kind: "enum", T: () => ["dht.DisconnectMode", DisconnectMode] } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.DisconnectNotice + */ +export const DisconnectNotice = new DisconnectNotice$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ExternalFetchDataRequest$Type extends MessageType { + constructor() { + super("dht.ExternalFetchDataRequest", [ + { no: 1, name: "key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ExternalFetchDataRequest + */ +export const ExternalFetchDataRequest = new ExternalFetchDataRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ExternalFetchDataResponse$Type extends MessageType { + constructor() { + super("dht.ExternalFetchDataResponse", [ + { no: 1, name: "entries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => DataEntry } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ExternalFetchDataResponse + */ +export const ExternalFetchDataResponse = new ExternalFetchDataResponse$Type(); +/** + * @generated ServiceType for protobuf service dht.DhtNodeRpc + */ +export const DhtNodeRpc = new ServiceType("dht.DhtNodeRpc", [ + { name: "getClosestPeers", options: {}, I: ClosestPeersRequest, O: ClosestPeersResponse }, + { name: "getClosestRingPeers", options: {}, I: ClosestRingPeersRequest, O: ClosestRingPeersResponse }, + { name: "ping", options: {}, I: PingRequest, O: PingResponse }, + { name: "leaveNotice", options: {}, I: LeaveNotice, O: Empty } +]); +/** + * @generated ServiceType for protobuf service dht.RouterRpc + */ +export const RouterRpc = new ServiceType("dht.RouterRpc", [ + { name: "routeMessage", options: {}, I: RouteMessageWrapper, O: RouteMessageAck }, + { name: "forwardMessage", options: {}, I: RouteMessageWrapper, O: RouteMessageAck } +]); +/** + * @generated ServiceType for protobuf service dht.RecursiveOperationRpc + */ +export const RecursiveOperationRpc = new ServiceType("dht.RecursiveOperationRpc", [ + { name: "routeRequest", options: {}, I: RouteMessageWrapper, O: RouteMessageAck } +]); +/** + * @generated ServiceType for protobuf service dht.StoreRpc + */ +export const StoreRpc = new ServiceType("dht.StoreRpc", [ + { name: "storeData", options: {}, I: StoreDataRequest, O: StoreDataResponse }, + { name: "replicateData", options: {}, I: ReplicateDataRequest, O: Empty } +]); +/** + * @generated ServiceType for protobuf service dht.RecursiveOperationSessionRpc + */ +export const RecursiveOperationSessionRpc = new ServiceType("dht.RecursiveOperationSessionRpc", [ + { name: "sendResponse", options: {}, I: RecursiveOperationResponse, O: Empty } +]); +/** + * @generated ServiceType for protobuf service dht.WebsocketClientConnectorRpc + */ +export const WebsocketClientConnectorRpc = new ServiceType("dht.WebsocketClientConnectorRpc", [ + { name: "requestConnection", options: {}, I: WebsocketConnectionRequest, O: Empty } +]); +/** + * @generated ServiceType for protobuf service dht.WebrtcConnectorRpc + */ +export const WebrtcConnectorRpc = new ServiceType("dht.WebrtcConnectorRpc", [ + { name: "requestConnection", options: {}, I: WebrtcConnectionRequest, O: Empty }, + { name: "rtcOffer", options: {}, I: RtcOffer, O: Empty }, + { name: "rtcAnswer", options: {}, I: RtcAnswer, O: Empty }, + { name: "iceCandidate", options: {}, I: IceCandidate, O: Empty } +]); +/** + * @generated ServiceType for protobuf service dht.ConnectionLockRpc + */ +export const ConnectionLockRpc = new ServiceType("dht.ConnectionLockRpc", [ + { name: "lockRequest", options: {}, I: LockRequest, O: LockResponse }, + { name: "unlockRequest", options: {}, I: UnlockRequest, O: Empty }, + { name: "gracefulDisconnect", options: {}, I: DisconnectNotice, O: Empty } +]); +/** + * @generated ServiceType for protobuf service dht.ExternalApiRpc + */ +export const ExternalApiRpc = new ServiceType("dht.ExternalApiRpc", [ + { name: "externalFetchData", options: {}, I: ExternalFetchDataRequest, O: ExternalFetchDataResponse }, + { name: "externalStoreData", options: {}, I: ExternalStoreDataRequest, O: ExternalStoreDataResponse } +]); diff --git a/packages/sdk/src/generated/packages/dht/protos/PeerDescriptor.ts b/packages/sdk/src/generated/packages/dht/protos/PeerDescriptor.ts deleted file mode 100644 index 1f19652ec8..0000000000 --- a/packages/sdk/src/generated/packages/dht/protos/PeerDescriptor.ts +++ /dev/null @@ -1,111 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/dht/protos/PeerDescriptor.proto" (package "peerDescriptor", syntax proto3) -// tslint:disable -import { MessageType } from "@protobuf-ts/runtime"; -/** - * @generated from protobuf message peerDescriptor.PeerDescriptor - */ -export interface PeerDescriptor { - /** - * @generated from protobuf field: bytes nodeId = 1; - */ - nodeId: Uint8Array; - /** - * @generated from protobuf field: peerDescriptor.NodeType type = 2; - */ - type: NodeType; - /** - * @generated from protobuf field: peerDescriptor.ConnectivityMethod udp = 3; - */ - udp?: ConnectivityMethod; - /** - * @generated from protobuf field: peerDescriptor.ConnectivityMethod tcp = 4; - */ - tcp?: ConnectivityMethod; - /** - * @generated from protobuf field: peerDescriptor.ConnectivityMethod websocket = 5; - */ - websocket?: ConnectivityMethod; - /** - * @generated from protobuf field: optional uint32 region = 6; - */ - region?: number; - /** - * @generated from protobuf field: optional uint32 ipAddress = 7; - */ - ipAddress?: number; - /** - * @generated from protobuf field: optional bytes publicKey = 8; - */ - publicKey?: Uint8Array; - /** - * signature of fields 2-8 - * - * @generated from protobuf field: optional bytes signature = 9; - */ - signature?: Uint8Array; -} -/** - * @generated from protobuf message peerDescriptor.ConnectivityMethod - */ -export interface ConnectivityMethod { - /** - * @generated from protobuf field: uint32 port = 1; - */ - port: number; - /** - * @generated from protobuf field: string host = 2; - */ - host: string; - /** - * @generated from protobuf field: bool tls = 3; - */ - tls: boolean; -} -/** - * @generated from protobuf enum peerDescriptor.NodeType - */ -export enum NodeType { - /** - * @generated from protobuf enum value: NODEJS = 0; - */ - NODEJS = 0, - /** - * @generated from protobuf enum value: BROWSER = 1; - */ - BROWSER = 1 -} -// @generated message type with reflection information, may provide speed optimized methods -class PeerDescriptor$Type extends MessageType { - constructor() { - super("peerDescriptor.PeerDescriptor", [ - { no: 1, name: "nodeId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 2, name: "type", kind: "enum", T: () => ["peerDescriptor.NodeType", NodeType] }, - { no: 3, name: "udp", kind: "message", T: () => ConnectivityMethod }, - { no: 4, name: "tcp", kind: "message", T: () => ConnectivityMethod }, - { no: 5, name: "websocket", kind: "message", T: () => ConnectivityMethod }, - { no: 6, name: "region", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, - { no: 7, name: "ipAddress", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, - { no: 8, name: "publicKey", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ }, - { no: 9, name: "signature", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message peerDescriptor.PeerDescriptor - */ -export const PeerDescriptor = new PeerDescriptor$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ConnectivityMethod$Type extends MessageType { - constructor() { - super("peerDescriptor.ConnectivityMethod", [ - { no: 1, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, - { no: 2, name: "host", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "tls", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message peerDescriptor.ConnectivityMethod - */ -export const ConnectivityMethod = new ConnectivityMethod$Type(); diff --git a/packages/sdk/src/generated/packages/proto-rpc/protos/ProtoRpc.ts b/packages/sdk/src/generated/packages/proto-rpc/protos/ProtoRpc.ts new file mode 100644 index 0000000000..7cfcf25ce6 --- /dev/null +++ b/packages/sdk/src/generated/packages/proto-rpc/protos/ProtoRpc.ts @@ -0,0 +1,108 @@ +// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number +// @generated from protobuf file "packages/proto-rpc/protos/ProtoRpc.proto" (package "protorpc", syntax proto3) +// tslint:disable +import { MessageType } from "@protobuf-ts/runtime"; +import { Empty } from "../../../google/protobuf/empty"; +import { Any } from "../../../google/protobuf/any"; +/** + * @generated from protobuf message protorpc.RpcMessage + */ +export interface RpcMessage { + /** + * @generated from protobuf field: map header = 1; + */ + header: { + [key: string]: string; + }; + /** + * @generated from protobuf field: google.protobuf.Any body = 2; + */ + body?: Any; + /** + * @generated from protobuf field: string requestId = 3; + */ + requestId: string; + /** + * @generated from protobuf field: optional protorpc.RpcErrorType errorType = 4; + */ + errorType?: RpcErrorType; + /** + * @generated from protobuf field: optional string errorClassName = 5; + */ + errorClassName?: string; + /** + * @generated from protobuf field: optional string errorCode = 6; + */ + errorCode?: string; + /** + * @generated from protobuf field: optional string errorMessage = 7; + */ + errorMessage?: string; +} +// Dummy message to force the generation of the typescript class "google.prototype.Empty" +// We need this generated class in RpcCommunicator + +/** + * @generated from protobuf message protorpc.Mnfo2uhnf92hvqi2nviouq2hv9puhq + */ +export interface Mnfo2uhnf92hvqi2nviouq2hv9puhq { + /** + * @generated from protobuf field: google.protobuf.Empty empty = 1; + */ + empty?: Empty; +} +/** + * @generated from protobuf enum protorpc.RpcErrorType + */ +export enum RpcErrorType { + /** + * @generated from protobuf enum value: SERVER_TIMEOUT = 0; + */ + SERVER_TIMEOUT = 0, + /** + * @generated from protobuf enum value: CLIENT_TIMEOUT = 1; + */ + CLIENT_TIMEOUT = 1, + /** + * @generated from protobuf enum value: UNKNOWN_RPC_METHOD = 2; + */ + UNKNOWN_RPC_METHOD = 2, + /** + * @generated from protobuf enum value: CLIENT_ERROR = 3; + */ + CLIENT_ERROR = 3, + /** + * @generated from protobuf enum value: SERVER_ERROR = 4; + */ + SERVER_ERROR = 4 +} +// @generated message type with reflection information, may provide speed optimized methods +class RpcMessage$Type extends MessageType { + constructor() { + super("protorpc.RpcMessage", [ + { no: 1, name: "header", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } }, + { no: 2, name: "body", kind: "message", T: () => Any }, + { no: 3, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 4, name: "errorType", kind: "enum", opt: true, T: () => ["protorpc.RpcErrorType", RpcErrorType] }, + { no: 5, name: "errorClassName", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, + { no: 6, name: "errorCode", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, + { no: 7, name: "errorMessage", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message protorpc.RpcMessage + */ +export const RpcMessage = new RpcMessage$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class Mnfo2uhnf92hvqi2nviouq2hv9puhq$Type extends MessageType { + constructor() { + super("protorpc.Mnfo2uhnf92hvqi2nviouq2hv9puhq", [ + { no: 1, name: "empty", kind: "message", T: () => Empty } + ]); + } +} +/** + * @generated MessageType for protobuf message protorpc.Mnfo2uhnf92hvqi2nviouq2hv9puhq + */ +export const Mnfo2uhnf92hvqi2nviouq2hv9puhq = new Mnfo2uhnf92hvqi2nviouq2hv9puhq$Type(); diff --git a/packages/sdk/src/generated/packages/sdk/protos/SdkRpc.ts b/packages/sdk/src/generated/packages/sdk/protos/SdkRpc.ts index 7ef8f01733..c1924147ff 100644 --- a/packages/sdk/src/generated/packages/sdk/protos/SdkRpc.ts +++ b/packages/sdk/src/generated/packages/sdk/protos/SdkRpc.ts @@ -3,7 +3,7 @@ // tslint:disable import { ServiceType } from "@protobuf-ts/runtime-rpc"; import { MessageType } from "@protobuf-ts/runtime"; -import { PeerDescriptor } from "../../dht/protos/PeerDescriptor"; +import { PeerDescriptor } from "../../dht/protos/DhtRpc"; /** * @generated from protobuf message OperatorDiscoveryRequest */ @@ -18,7 +18,7 @@ export interface OperatorDiscoveryRequest { */ export interface OperatorDiscoveryResponse { /** - * @generated from protobuf field: repeated peerDescriptor.PeerDescriptor operators = 1; + * @generated from protobuf field: repeated dht.PeerDescriptor operators = 1; */ operators: PeerDescriptor[]; } diff --git a/packages/trackerless-network/generated/packages/dht/protos/DhtRpc.client.ts b/packages/trackerless-network/generated/packages/dht/protos/DhtRpc.client.ts new file mode 100644 index 0000000000..f4c5b44977 --- /dev/null +++ b/packages/trackerless-network/generated/packages/dht/protos/DhtRpc.client.ts @@ -0,0 +1,419 @@ +// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number +// @generated from protobuf file "packages/dht/protos/DhtRpc.proto" (package "dht", syntax proto3) +// tslint:disable +import { ExternalApiRpc } from "./DhtRpc"; +import type { ExternalStoreDataResponse } from "./DhtRpc"; +import type { ExternalStoreDataRequest } from "./DhtRpc"; +import type { ExternalFetchDataResponse } from "./DhtRpc"; +import type { ExternalFetchDataRequest } from "./DhtRpc"; +import { ConnectionLockRpc } from "./DhtRpc"; +import type { SetPrivateRequest } from "./DhtRpc"; +import type { DisconnectNotice } from "./DhtRpc"; +import type { UnlockRequest } from "./DhtRpc"; +import type { LockResponse } from "./DhtRpc"; +import type { LockRequest } from "./DhtRpc"; +import { WebrtcConnectorRpc } from "./DhtRpc"; +import type { IceCandidate } from "./DhtRpc"; +import type { RtcAnswer } from "./DhtRpc"; +import type { RtcOffer } from "./DhtRpc"; +import type { WebrtcConnectionRequest } from "./DhtRpc"; +import { WebsocketClientConnectorRpc } from "./DhtRpc"; +import type { WebsocketConnectionRequest } from "./DhtRpc"; +import { RecursiveOperationSessionRpc } from "./DhtRpc"; +import type { RecursiveOperationResponse } from "./DhtRpc"; +import { StoreRpc } from "./DhtRpc"; +import type { ReplicateDataRequest } from "./DhtRpc"; +import type { StoreDataResponse } from "./DhtRpc"; +import type { StoreDataRequest } from "./DhtRpc"; +import { RecursiveOperationRpc } from "./DhtRpc"; +import { RouterRpc } from "./DhtRpc"; +import type { RouteMessageAck } from "./DhtRpc"; +import type { RouteMessageWrapper } from "./DhtRpc"; +import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; +import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; +import { DhtNodeRpc } from "./DhtRpc"; +import type { Empty } from "../../../google/protobuf/empty"; +import type { LeaveNotice } from "./DhtRpc"; +import type { PingResponse } from "./DhtRpc"; +import type { PingRequest } from "./DhtRpc"; +import type { ClosestRingPeersResponse } from "./DhtRpc"; +import type { ClosestRingPeersRequest } from "./DhtRpc"; +import { stackIntercept } from "@protobuf-ts/runtime-rpc"; +import type { ClosestPeersResponse } from "./DhtRpc"; +import type { ClosestPeersRequest } from "./DhtRpc"; +import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; +import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; +/** + * @generated from protobuf service dht.DhtNodeRpc + */ +export interface IDhtNodeRpcClient { + /** + * TODO rename to getClosestNeighbors (breaking change) + * + * @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse); + */ + getClosestPeers(input: ClosestPeersRequest, options?: RpcOptions): UnaryCall; + /** + * TODO rename to getClosestRingContacts (breaking change) + * + * @generated from protobuf rpc: getClosestRingPeers(dht.ClosestRingPeersRequest) returns (dht.ClosestRingPeersResponse); + */ + getClosestRingPeers(input: ClosestRingPeersRequest, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse); + */ + ping(input: PingRequest, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: leaveNotice(dht.LeaveNotice) returns (google.protobuf.Empty); + */ + leaveNotice(input: LeaveNotice, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.DhtNodeRpc + */ +export class DhtNodeRpcClient implements IDhtNodeRpcClient, ServiceInfo { + typeName = DhtNodeRpc.typeName; + methods = DhtNodeRpc.methods; + options = DhtNodeRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * TODO rename to getClosestNeighbors (breaking change) + * + * @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse); + */ + getClosestPeers(input: ClosestPeersRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * TODO rename to getClosestRingContacts (breaking change) + * + * @generated from protobuf rpc: getClosestRingPeers(dht.ClosestRingPeersRequest) returns (dht.ClosestRingPeersResponse); + */ + getClosestRingPeers(input: ClosestRingPeersRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[1], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse); + */ + ping(input: PingRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[2], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: leaveNotice(dht.LeaveNotice) returns (google.protobuf.Empty); + */ + leaveNotice(input: LeaveNotice, options?: RpcOptions): UnaryCall { + const method = this.methods[3], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.RouterRpc + */ +export interface IRouterRpcClient { + /** + * @generated from protobuf rpc: routeMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + routeMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: forwardMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + forwardMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.RouterRpc + */ +export class RouterRpcClient implements IRouterRpcClient, ServiceInfo { + typeName = RouterRpc.typeName; + methods = RouterRpc.methods; + options = RouterRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: routeMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + routeMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: forwardMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + forwardMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall { + const method = this.methods[1], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.RecursiveOperationRpc + */ +export interface IRecursiveOperationRpcClient { + /** + * @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + routeRequest(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.RecursiveOperationRpc + */ +export class RecursiveOperationRpcClient implements IRecursiveOperationRpcClient, ServiceInfo { + typeName = RecursiveOperationRpc.typeName; + methods = RecursiveOperationRpc.methods; + options = RecursiveOperationRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + routeRequest(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.StoreRpc + */ +export interface IStoreRpcClient { + /** + * @generated from protobuf rpc: storeData(dht.StoreDataRequest) returns (dht.StoreDataResponse); + */ + storeData(input: StoreDataRequest, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: replicateData(dht.ReplicateDataRequest) returns (google.protobuf.Empty); + */ + replicateData(input: ReplicateDataRequest, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.StoreRpc + */ +export class StoreRpcClient implements IStoreRpcClient, ServiceInfo { + typeName = StoreRpc.typeName; + methods = StoreRpc.methods; + options = StoreRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: storeData(dht.StoreDataRequest) returns (dht.StoreDataResponse); + */ + storeData(input: StoreDataRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: replicateData(dht.ReplicateDataRequest) returns (google.protobuf.Empty); + */ + replicateData(input: ReplicateDataRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[1], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.RecursiveOperationSessionRpc + */ +export interface IRecursiveOperationSessionRpcClient { + /** + * @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty); + */ + sendResponse(input: RecursiveOperationResponse, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.RecursiveOperationSessionRpc + */ +export class RecursiveOperationSessionRpcClient implements IRecursiveOperationSessionRpcClient, ServiceInfo { + typeName = RecursiveOperationSessionRpc.typeName; + methods = RecursiveOperationSessionRpc.methods; + options = RecursiveOperationSessionRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty); + */ + sendResponse(input: RecursiveOperationResponse, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.WebsocketClientConnectorRpc + */ +export interface IWebsocketClientConnectorRpcClient { + /** + * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty); + */ + requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.WebsocketClientConnectorRpc + */ +export class WebsocketClientConnectorRpcClient implements IWebsocketClientConnectorRpcClient, ServiceInfo { + typeName = WebsocketClientConnectorRpc.typeName; + methods = WebsocketClientConnectorRpc.methods; + options = WebsocketClientConnectorRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty); + */ + requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.WebrtcConnectorRpc + */ +export interface IWebrtcConnectorRpcClient { + /** + * @generated from protobuf rpc: requestConnection(dht.WebrtcConnectionRequest) returns (google.protobuf.Empty); + */ + requestConnection(input: WebrtcConnectionRequest, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: rtcOffer(dht.RtcOffer) returns (google.protobuf.Empty); + */ + rtcOffer(input: RtcOffer, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: rtcAnswer(dht.RtcAnswer) returns (google.protobuf.Empty); + */ + rtcAnswer(input: RtcAnswer, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: iceCandidate(dht.IceCandidate) returns (google.protobuf.Empty); + */ + iceCandidate(input: IceCandidate, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.WebrtcConnectorRpc + */ +export class WebrtcConnectorRpcClient implements IWebrtcConnectorRpcClient, ServiceInfo { + typeName = WebrtcConnectorRpc.typeName; + methods = WebrtcConnectorRpc.methods; + options = WebrtcConnectorRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: requestConnection(dht.WebrtcConnectionRequest) returns (google.protobuf.Empty); + */ + requestConnection(input: WebrtcConnectionRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: rtcOffer(dht.RtcOffer) returns (google.protobuf.Empty); + */ + rtcOffer(input: RtcOffer, options?: RpcOptions): UnaryCall { + const method = this.methods[1], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: rtcAnswer(dht.RtcAnswer) returns (google.protobuf.Empty); + */ + rtcAnswer(input: RtcAnswer, options?: RpcOptions): UnaryCall { + const method = this.methods[2], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: iceCandidate(dht.IceCandidate) returns (google.protobuf.Empty); + */ + iceCandidate(input: IceCandidate, options?: RpcOptions): UnaryCall { + const method = this.methods[3], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.ConnectionLockRpc + */ +export interface IConnectionLockRpcClient { + /** + * @generated from protobuf rpc: lockRequest(dht.LockRequest) returns (dht.LockResponse); + */ + lockRequest(input: LockRequest, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: unlockRequest(dht.UnlockRequest) returns (google.protobuf.Empty); + */ + unlockRequest(input: UnlockRequest, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (google.protobuf.Empty); + */ + gracefulDisconnect(input: DisconnectNotice, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: setPrivate(dht.SetPrivateRequest) returns (google.protobuf.Empty); + */ + setPrivate(input: SetPrivateRequest, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.ConnectionLockRpc + */ +export class ConnectionLockRpcClient implements IConnectionLockRpcClient, ServiceInfo { + typeName = ConnectionLockRpc.typeName; + methods = ConnectionLockRpc.methods; + options = ConnectionLockRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: lockRequest(dht.LockRequest) returns (dht.LockResponse); + */ + lockRequest(input: LockRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: unlockRequest(dht.UnlockRequest) returns (google.protobuf.Empty); + */ + unlockRequest(input: UnlockRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[1], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (google.protobuf.Empty); + */ + gracefulDisconnect(input: DisconnectNotice, options?: RpcOptions): UnaryCall { + const method = this.methods[2], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: setPrivate(dht.SetPrivateRequest) returns (google.protobuf.Empty); + */ + setPrivate(input: SetPrivateRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[3], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} +/** + * @generated from protobuf service dht.ExternalApiRpc + */ +export interface IExternalApiRpcClient { + /** + * @generated from protobuf rpc: externalFetchData(dht.ExternalFetchDataRequest) returns (dht.ExternalFetchDataResponse); + */ + externalFetchData(input: ExternalFetchDataRequest, options?: RpcOptions): UnaryCall; + /** + * @generated from protobuf rpc: externalStoreData(dht.ExternalStoreDataRequest) returns (dht.ExternalStoreDataResponse); + */ + externalStoreData(input: ExternalStoreDataRequest, options?: RpcOptions): UnaryCall; +} +/** + * @generated from protobuf service dht.ExternalApiRpc + */ +export class ExternalApiRpcClient implements IExternalApiRpcClient, ServiceInfo { + typeName = ExternalApiRpc.typeName; + methods = ExternalApiRpc.methods; + options = ExternalApiRpc.options; + constructor(private readonly _transport: RpcTransport) { + } + /** + * @generated from protobuf rpc: externalFetchData(dht.ExternalFetchDataRequest) returns (dht.ExternalFetchDataResponse); + */ + externalFetchData(input: ExternalFetchDataRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[0], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } + /** + * @generated from protobuf rpc: externalStoreData(dht.ExternalStoreDataRequest) returns (dht.ExternalStoreDataResponse); + */ + externalStoreData(input: ExternalStoreDataRequest, options?: RpcOptions): UnaryCall { + const method = this.methods[1], opt = this._transport.mergeOptions(options); + return stackIntercept("unary", this._transport, method, opt, input); + } +} diff --git a/packages/trackerless-network/generated/packages/dht/protos/DhtRpc.server.ts b/packages/trackerless-network/generated/packages/dht/protos/DhtRpc.server.ts new file mode 100644 index 0000000000..f82e1dad64 --- /dev/null +++ b/packages/trackerless-network/generated/packages/dht/protos/DhtRpc.server.ts @@ -0,0 +1,165 @@ +// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number +// @generated from protobuf file "packages/dht/protos/DhtRpc.proto" (package "dht", syntax proto3) +// tslint:disable +import { ExternalStoreDataResponse } from "./DhtRpc"; +import { ExternalStoreDataRequest } from "./DhtRpc"; +import { ExternalFetchDataResponse } from "./DhtRpc"; +import { ExternalFetchDataRequest } from "./DhtRpc"; +import { SetPrivateRequest } from "./DhtRpc"; +import { DisconnectNotice } from "./DhtRpc"; +import { UnlockRequest } from "./DhtRpc"; +import { LockResponse } from "./DhtRpc"; +import { LockRequest } from "./DhtRpc"; +import { IceCandidate } from "./DhtRpc"; +import { RtcAnswer } from "./DhtRpc"; +import { RtcOffer } from "./DhtRpc"; +import { WebrtcConnectionRequest } from "./DhtRpc"; +import { WebsocketConnectionRequest } from "./DhtRpc"; +import { RecursiveOperationResponse } from "./DhtRpc"; +import { ReplicateDataRequest } from "./DhtRpc"; +import { StoreDataResponse } from "./DhtRpc"; +import { StoreDataRequest } from "./DhtRpc"; +import { RouteMessageAck } from "./DhtRpc"; +import { RouteMessageWrapper } from "./DhtRpc"; +import { Empty } from "../../../google/protobuf/empty"; +import { LeaveNotice } from "./DhtRpc"; +import { PingResponse } from "./DhtRpc"; +import { PingRequest } from "./DhtRpc"; +import { ClosestRingPeersResponse } from "./DhtRpc"; +import { ClosestRingPeersRequest } from "./DhtRpc"; +import { ClosestPeersResponse } from "./DhtRpc"; +import { ClosestPeersRequest } from "./DhtRpc"; +import { ServerCallContext } from "@protobuf-ts/runtime-rpc"; +/** + * @generated from protobuf service dht.DhtNodeRpc + */ +export interface IDhtNodeRpc { + /** + * TODO rename to getClosestNeighbors (breaking change) + * + * @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse); + */ + getClosestPeers(request: ClosestPeersRequest, context: T): Promise; + /** + * TODO rename to getClosestRingContacts (breaking change) + * + * @generated from protobuf rpc: getClosestRingPeers(dht.ClosestRingPeersRequest) returns (dht.ClosestRingPeersResponse); + */ + getClosestRingPeers(request: ClosestRingPeersRequest, context: T): Promise; + /** + * @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse); + */ + ping(request: PingRequest, context: T): Promise; + /** + * @generated from protobuf rpc: leaveNotice(dht.LeaveNotice) returns (google.protobuf.Empty); + */ + leaveNotice(request: LeaveNotice, context: T): Promise; +} +/** + * @generated from protobuf service dht.RouterRpc + */ +export interface IRouterRpc { + /** + * @generated from protobuf rpc: routeMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + routeMessage(request: RouteMessageWrapper, context: T): Promise; + /** + * @generated from protobuf rpc: forwardMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + forwardMessage(request: RouteMessageWrapper, context: T): Promise; +} +/** + * @generated from protobuf service dht.RecursiveOperationRpc + */ +export interface IRecursiveOperationRpc { + /** + * @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); + */ + routeRequest(request: RouteMessageWrapper, context: T): Promise; +} +/** + * @generated from protobuf service dht.StoreRpc + */ +export interface IStoreRpc { + /** + * @generated from protobuf rpc: storeData(dht.StoreDataRequest) returns (dht.StoreDataResponse); + */ + storeData(request: StoreDataRequest, context: T): Promise; + /** + * @generated from protobuf rpc: replicateData(dht.ReplicateDataRequest) returns (google.protobuf.Empty); + */ + replicateData(request: ReplicateDataRequest, context: T): Promise; +} +/** + * @generated from protobuf service dht.RecursiveOperationSessionRpc + */ +export interface IRecursiveOperationSessionRpc { + /** + * @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty); + */ + sendResponse(request: RecursiveOperationResponse, context: T): Promise; +} +/** + * @generated from protobuf service dht.WebsocketClientConnectorRpc + */ +export interface IWebsocketClientConnectorRpc { + /** + * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty); + */ + requestConnection(request: WebsocketConnectionRequest, context: T): Promise; +} +/** + * @generated from protobuf service dht.WebrtcConnectorRpc + */ +export interface IWebrtcConnectorRpc { + /** + * @generated from protobuf rpc: requestConnection(dht.WebrtcConnectionRequest) returns (google.protobuf.Empty); + */ + requestConnection(request: WebrtcConnectionRequest, context: T): Promise; + /** + * @generated from protobuf rpc: rtcOffer(dht.RtcOffer) returns (google.protobuf.Empty); + */ + rtcOffer(request: RtcOffer, context: T): Promise; + /** + * @generated from protobuf rpc: rtcAnswer(dht.RtcAnswer) returns (google.protobuf.Empty); + */ + rtcAnswer(request: RtcAnswer, context: T): Promise; + /** + * @generated from protobuf rpc: iceCandidate(dht.IceCandidate) returns (google.protobuf.Empty); + */ + iceCandidate(request: IceCandidate, context: T): Promise; +} +/** + * @generated from protobuf service dht.ConnectionLockRpc + */ +export interface IConnectionLockRpc { + /** + * @generated from protobuf rpc: lockRequest(dht.LockRequest) returns (dht.LockResponse); + */ + lockRequest(request: LockRequest, context: T): Promise; + /** + * @generated from protobuf rpc: unlockRequest(dht.UnlockRequest) returns (google.protobuf.Empty); + */ + unlockRequest(request: UnlockRequest, context: T): Promise; + /** + * @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (google.protobuf.Empty); + */ + gracefulDisconnect(request: DisconnectNotice, context: T): Promise; + /** + * @generated from protobuf rpc: setPrivate(dht.SetPrivateRequest) returns (google.protobuf.Empty); + */ + setPrivate(request: SetPrivateRequest, context: T): Promise; +} +/** + * @generated from protobuf service dht.ExternalApiRpc + */ +export interface IExternalApiRpc { + /** + * @generated from protobuf rpc: externalFetchData(dht.ExternalFetchDataRequest) returns (dht.ExternalFetchDataResponse); + */ + externalFetchData(request: ExternalFetchDataRequest, context: T): Promise; + /** + * @generated from protobuf rpc: externalStoreData(dht.ExternalStoreDataRequest) returns (dht.ExternalStoreDataResponse); + */ + externalStoreData(request: ExternalStoreDataRequest, context: T): Promise; +} diff --git a/packages/trackerless-network/generated/packages/dht/protos/DhtRpc.ts b/packages/trackerless-network/generated/packages/dht/protos/DhtRpc.ts new file mode 100644 index 0000000000..48fc3bc658 --- /dev/null +++ b/packages/trackerless-network/generated/packages/dht/protos/DhtRpc.ts @@ -0,0 +1,1266 @@ +// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number +// @generated from protobuf file "packages/dht/protos/DhtRpc.proto" (package "dht", syntax proto3) +// tslint:disable +import { Empty } from "../../../google/protobuf/empty"; +import { ServiceType } from "@protobuf-ts/runtime-rpc"; +import { MessageType } from "@protobuf-ts/runtime"; +import { RpcMessage } from "../../proto-rpc/protos/ProtoRpc"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Any } from "../../../google/protobuf/any"; +// Used inside RpcMessage + +/** + * @generated from protobuf message dht.StoreDataRequest + */ +export interface StoreDataRequest { + /** + * @generated from protobuf field: bytes key = 1; + */ + key: Uint8Array; + /** + * @generated from protobuf field: google.protobuf.Any data = 2; + */ + data?: Any; + /** + * @generated from protobuf field: bytes creator = 3; + */ + creator: Uint8Array; + /** + * @generated from protobuf field: google.protobuf.Timestamp createdAt = 4; + */ + createdAt?: Timestamp; + /** + * @generated from protobuf field: uint32 ttl = 5; + */ + ttl: number; +} +/** + * @generated from protobuf message dht.StoreDataResponse + */ +export interface StoreDataResponse { +} +/** + * @generated from protobuf message dht.ExternalStoreDataRequest + */ +export interface ExternalStoreDataRequest { + /** + * @generated from protobuf field: bytes key = 1; + */ + key: Uint8Array; + /** + * @generated from protobuf field: google.protobuf.Any data = 2; + */ + data?: Any; +} +/** + * @generated from protobuf message dht.ExternalStoreDataResponse + */ +export interface ExternalStoreDataResponse { + /** + * @generated from protobuf field: repeated dht.PeerDescriptor storers = 1; + */ + storers: PeerDescriptor[]; +} +/** + * @generated from protobuf message dht.ReplicateDataRequest + */ +export interface ReplicateDataRequest { + /** + * @generated from protobuf field: dht.DataEntry entry = 1; + */ + entry?: DataEntry; +} +/** + * @generated from protobuf message dht.DataEntry + */ +export interface DataEntry { + /** + * @generated from protobuf field: bytes key = 1; + */ + key: Uint8Array; + /** + * @generated from protobuf field: google.protobuf.Any data = 2; + */ + data?: Any; + /** + * @generated from protobuf field: bytes creator = 3; + */ + creator: Uint8Array; + /** + * @generated from protobuf field: google.protobuf.Timestamp createdAt = 4; + */ + createdAt?: Timestamp; + /** + * @generated from protobuf field: google.protobuf.Timestamp storedAt = 5; + */ + storedAt?: Timestamp; + /** + * @generated from protobuf field: uint32 ttl = 6; + */ + ttl: number; // milliseconds + /** + * @generated from protobuf field: bool stale = 7; + */ + stale: boolean; + /** + * @generated from protobuf field: bool deleted = 8; + */ + deleted: boolean; +} +/** + * TODO rename to ClosestNeighborsRequest + * + * @generated from protobuf message dht.ClosestPeersRequest + */ +export interface ClosestPeersRequest { + /** + * @generated from protobuf field: bytes nodeId = 1; + */ + nodeId: Uint8Array; + /** + * @generated from protobuf field: string requestId = 2; + */ + requestId: string; +} +/** + * TODO rename to ClosestNeighborsResponse + * + * @generated from protobuf message dht.ClosestPeersResponse + */ +export interface ClosestPeersResponse { + /** + * @generated from protobuf field: repeated dht.PeerDescriptor peers = 1; + */ + peers: PeerDescriptor[]; + /** + * @generated from protobuf field: string requestId = 2; + */ + requestId: string; +} +/** + * TODO rename to ClosestRingContactsRequest + * + * @generated from protobuf message dht.ClosestRingPeersRequest + */ +export interface ClosestRingPeersRequest { + /** + * @generated from protobuf field: bytes ringId = 1; + */ + ringId: Uint8Array; + /** + * @generated from protobuf field: string requestId = 2; + */ + requestId: string; +} +/** + * TODO rename to ClosestRingContactsResponse + * + * @generated from protobuf message dht.ClosestRingPeersResponse + */ +export interface ClosestRingPeersResponse { + /** + * @generated from protobuf field: repeated dht.PeerDescriptor leftPeers = 1; + */ + leftPeers: PeerDescriptor[]; + /** + * @generated from protobuf field: repeated dht.PeerDescriptor rightPeers = 2; + */ + rightPeers: PeerDescriptor[]; + /** + * @generated from protobuf field: string requestId = 3; + */ + requestId: string; +} +/** + * @generated from protobuf message dht.RecursiveOperationRequest + */ +export interface RecursiveOperationRequest { + /** + * @generated from protobuf field: string sessionId = 1; + */ + sessionId: string; + /** + * @generated from protobuf field: dht.RecursiveOperation operation = 2; + */ + operation: RecursiveOperation; +} +/** + * @generated from protobuf message dht.RecursiveOperationResponse + */ +export interface RecursiveOperationResponse { + /** + * @generated from protobuf field: repeated dht.PeerDescriptor closestConnectedNodes = 1; + */ + closestConnectedNodes: PeerDescriptor[]; + /** + * @generated from protobuf field: repeated dht.DataEntry dataEntries = 2; + */ + dataEntries: DataEntry[]; + /** + * @generated from protobuf field: bool noCloserNodesFound = 3; + */ + noCloserNodesFound: boolean; + /** + * @generated from protobuf field: repeated dht.PeerDescriptor routingPath = 4; + */ + routingPath: PeerDescriptor[]; +} +/** + * @generated from protobuf message dht.PingRequest + */ +export interface PingRequest { + /** + * @generated from protobuf field: string requestId = 1; + */ + requestId: string; +} +/** + * @generated from protobuf message dht.PingResponse + */ +export interface PingResponse { + /** + * @generated from protobuf field: string requestId = 1; + */ + requestId: string; +} +/** + * @generated from protobuf message dht.LeaveNotice + */ +export interface LeaveNotice { +} +/** + * @generated from protobuf message dht.PeerDescriptor + */ +export interface PeerDescriptor { + /** + * @generated from protobuf field: bytes nodeId = 1; + */ + nodeId: Uint8Array; + /** + * @generated from protobuf field: dht.NodeType type = 2; + */ + type: NodeType; + /** + * @generated from protobuf field: dht.ConnectivityMethod udp = 3; + */ + udp?: ConnectivityMethod; + /** + * @generated from protobuf field: dht.ConnectivityMethod tcp = 4; + */ + tcp?: ConnectivityMethod; + /** + * @generated from protobuf field: dht.ConnectivityMethod websocket = 5; + */ + websocket?: ConnectivityMethod; + /** + * @generated from protobuf field: optional uint32 region = 6; + */ + region?: number; + /** + * @generated from protobuf field: optional uint32 ipAddress = 7; + */ + ipAddress?: number; + /** + * @generated from protobuf field: optional bytes publicKey = 8; + */ + publicKey?: Uint8Array; + /** + * signature of fields 2-8 + * + * @generated from protobuf field: optional bytes signature = 9; + */ + signature?: Uint8Array; +} +/** + * @generated from protobuf message dht.ConnectivityMethod + */ +export interface ConnectivityMethod { + /** + * @generated from protobuf field: uint32 port = 1; + */ + port: number; + /** + * @generated from protobuf field: string host = 2; + */ + host: string; + /** + * @generated from protobuf field: bool tls = 3; + */ + tls: boolean; +} +/** + * @generated from protobuf message dht.RouteMessageWrapper + */ +export interface RouteMessageWrapper { + /** + * @generated from protobuf field: string requestId = 1; + */ + requestId: string; + /** + * @generated from protobuf field: dht.PeerDescriptor sourcePeer = 2; + */ + sourcePeer?: PeerDescriptor; + /** + * @generated from protobuf field: bytes target = 3; + */ + target: Uint8Array; + /** + * @generated from protobuf field: dht.Message message = 4; + */ + message?: Message; + /** + * @generated from protobuf field: repeated dht.PeerDescriptor reachableThrough = 5; + */ + reachableThrough: PeerDescriptor[]; + /** + * @generated from protobuf field: repeated dht.PeerDescriptor routingPath = 6; + */ + routingPath: PeerDescriptor[]; + /** + * @generated from protobuf field: repeated string parallelRootNodeIds = 7; + */ + parallelRootNodeIds: string[]; +} +/** + * @generated from protobuf message dht.RouteMessageAck + */ +export interface RouteMessageAck { + /** + * @generated from protobuf field: string requestId = 1; + */ + requestId: string; + /** + * @generated from protobuf field: optional dht.RouteMessageError error = 2; + */ + error?: RouteMessageError; +} +/** + * @generated from protobuf message dht.ConnectivityRequest + */ +export interface ConnectivityRequest { + /** + * @generated from protobuf field: uint32 port = 1; + */ + port: number; + /** + * @generated from protobuf field: bool tls = 2; + */ + tls: boolean; + /** + * @generated from protobuf field: optional string host = 3; + */ + host?: string; + /** + * @generated from protobuf field: bool allowSelfSignedCertificate = 4; + */ + allowSelfSignedCertificate: boolean; +} +/** + * @generated from protobuf message dht.ConnectivityResponse + */ +export interface ConnectivityResponse { + /** + * @generated from protobuf field: string host = 1; + */ + host: string; + /** + * @generated from protobuf field: string natType = 2; + */ + natType: string; + /** + * @generated from protobuf field: dht.ConnectivityMethod websocket = 3; + */ + websocket?: ConnectivityMethod; + /** + * @generated from protobuf field: uint32 ipAddress = 4; + */ + ipAddress: number; + /** + * @generated from protobuf field: string version = 5; + */ + version: string; + /** + * @generated from protobuf field: optional double latitude = 6; + */ + latitude?: number; + /** + * @generated from protobuf field: optional double longitude = 7; + */ + longitude?: number; +} +/** + * @generated from protobuf message dht.HandshakeRequest + */ +export interface HandshakeRequest { + /** + * @generated from protobuf field: dht.PeerDescriptor sourcePeerDescriptor = 1; + */ + sourcePeerDescriptor?: PeerDescriptor; + /** + * @generated from protobuf field: optional dht.PeerDescriptor targetPeerDescriptor = 2; + */ + targetPeerDescriptor?: PeerDescriptor; + /** + * @generated from protobuf field: string version = 3; + */ + version: string; +} +/** + * @generated from protobuf message dht.HandshakeResponse + */ +export interface HandshakeResponse { + /** + * @generated from protobuf field: dht.PeerDescriptor sourcePeerDescriptor = 1; + */ + sourcePeerDescriptor?: PeerDescriptor; + /** + * @generated from protobuf field: optional dht.HandshakeError error = 2; + */ + error?: HandshakeError; + /** + * @generated from protobuf field: string version = 3; + */ + version: string; +} +// Wraps all messages + +/** + * @generated from protobuf message dht.Message + */ +export interface Message { + /** + * @generated from protobuf field: string messageId = 1; + */ + messageId: string; + /** + * @generated from protobuf field: dht.PeerDescriptor sourceDescriptor = 2; + */ + sourceDescriptor?: PeerDescriptor; + /** + * @generated from protobuf field: dht.PeerDescriptor targetDescriptor = 3; + */ + targetDescriptor?: PeerDescriptor; + /** + * @generated from protobuf field: string serviceId = 4; + */ + serviceId: string; // id of the RPC service + /** + * @generated from protobuf oneof: body + */ + body: { + oneofKind: "rpcMessage"; + /** + * @generated from protobuf field: protorpc.RpcMessage rpcMessage = 5; + */ + rpcMessage: RpcMessage; + } | { + oneofKind: "connectivityRequest"; + /** + * @generated from protobuf field: dht.ConnectivityRequest connectivityRequest = 6; + */ + connectivityRequest: ConnectivityRequest; + } | { + oneofKind: "connectivityResponse"; + /** + * @generated from protobuf field: dht.ConnectivityResponse connectivityResponse = 7; + */ + connectivityResponse: ConnectivityResponse; + } | { + oneofKind: "handshakeRequest"; + /** + * @generated from protobuf field: dht.HandshakeRequest handshakeRequest = 8; + */ + handshakeRequest: HandshakeRequest; + } | { + oneofKind: "handshakeResponse"; + /** + * @generated from protobuf field: dht.HandshakeResponse handshakeResponse = 9; + */ + handshakeResponse: HandshakeResponse; + } | { + oneofKind: "recursiveOperationRequest"; + /** + * @generated from protobuf field: dht.RecursiveOperationRequest recursiveOperationRequest = 10; + */ + recursiveOperationRequest: RecursiveOperationRequest; + } | { + oneofKind: undefined; + }; +} +// Connector Messages + +/** + * WebSocket + * + * @generated from protobuf message dht.WebsocketConnectionRequest + */ +export interface WebsocketConnectionRequest { +} +/** + * WebRTC + * + * @generated from protobuf message dht.WebrtcConnectionRequest + */ +export interface WebrtcConnectionRequest { +} +/** + * @generated from protobuf message dht.RtcOffer + */ +export interface RtcOffer { + /** + * @generated from protobuf field: string description = 1; + */ + description: string; + /** + * @generated from protobuf field: string connectionId = 2; + */ + connectionId: string; +} +/** + * @generated from protobuf message dht.RtcAnswer + */ +export interface RtcAnswer { + /** + * @generated from protobuf field: string description = 1; + */ + description: string; + /** + * @generated from protobuf field: string connectionId = 2; + */ + connectionId: string; +} +/** + * @generated from protobuf message dht.IceCandidate + */ +export interface IceCandidate { + /** + * @generated from protobuf field: string candidate = 1; + */ + candidate: string; + /** + * @generated from protobuf field: string mid = 2; + */ + mid: string; + /** + * @generated from protobuf field: string connectionId = 3; + */ + connectionId: string; +} +/** + * @generated from protobuf message dht.LockRequest + */ +export interface LockRequest { + /** + * @generated from protobuf field: string lockId = 1; + */ + lockId: string; +} +/** + * @generated from protobuf message dht.UnlockRequest + */ +export interface UnlockRequest { + /** + * @generated from protobuf field: string lockId = 1; + */ + lockId: string; +} +/** + * @generated from protobuf message dht.LockResponse + */ +export interface LockResponse { + /** + * @generated from protobuf field: bool accepted = 1; + */ + accepted: boolean; +} +/** + * @generated from protobuf message dht.DisconnectNotice + */ +export interface DisconnectNotice { + /** + * @generated from protobuf field: dht.DisconnectMode disconnectMode = 1; + */ + disconnectMode: DisconnectMode; +} +/** + * @generated from protobuf message dht.SetPrivateRequest + */ +export interface SetPrivateRequest { + /** + * @generated from protobuf field: bool isPrivate = 1; + */ + isPrivate: boolean; +} +/** + * @generated from protobuf message dht.ExternalFetchDataRequest + */ +export interface ExternalFetchDataRequest { + /** + * @generated from protobuf field: bytes key = 1; + */ + key: Uint8Array; +} +/** + * @generated from protobuf message dht.ExternalFetchDataResponse + */ +export interface ExternalFetchDataResponse { + /** + * @generated from protobuf field: repeated dht.DataEntry entries = 1; + */ + entries: DataEntry[]; +} +/** + * @generated from protobuf enum dht.RecursiveOperation + */ +export enum RecursiveOperation { + /** + * @generated from protobuf enum value: FIND_CLOSEST_NODES = 0; + */ + FIND_CLOSEST_NODES = 0, + /** + * @generated from protobuf enum value: FETCH_DATA = 1; + */ + FETCH_DATA = 1, + /** + * @generated from protobuf enum value: DELETE_DATA = 2; + */ + DELETE_DATA = 2 +} +/** + * @generated from protobuf enum dht.NodeType + */ +export enum NodeType { + /** + * @generated from protobuf enum value: NODEJS = 0; + */ + NODEJS = 0, + /** + * @generated from protobuf enum value: BROWSER = 1; + */ + BROWSER = 1 +} +/** + * @generated from protobuf enum dht.RpcResponseError + */ +export enum RpcResponseError { + /** + * @generated from protobuf enum value: SERVER_TIMOUT = 0; + */ + SERVER_TIMOUT = 0, + /** + * @generated from protobuf enum value: CLIENT_TIMEOUT = 1; + */ + CLIENT_TIMEOUT = 1, + /** + * @generated from protobuf enum value: SERVER_ERROR = 2; + */ + SERVER_ERROR = 2, + /** + * @generated from protobuf enum value: UNKNOWN_RPC_METHOD = 3; + */ + UNKNOWN_RPC_METHOD = 3 +} +/** + * @generated from protobuf enum dht.RouteMessageError + */ +export enum RouteMessageError { + /** + * @generated from protobuf enum value: NO_TARGETS = 0; + */ + NO_TARGETS = 0, + /** + * @generated from protobuf enum value: DUPLICATE = 1; + */ + DUPLICATE = 1, + /** + * TODO: can this be removed? If DhtNode is already stopped the server side requests + * should not be processed + * + * @generated from protobuf enum value: STOPPED = 2; + */ + STOPPED = 2 +} +/** + * @generated from protobuf enum dht.HandshakeError + */ +export enum HandshakeError { + /** + * @generated from protobuf enum value: DUPLICATE_CONNECTION = 0; + */ + DUPLICATE_CONNECTION = 0, + /** + * @generated from protobuf enum value: INVALID_TARGET_PEER_DESCRIPTOR = 1; + */ + INVALID_TARGET_PEER_DESCRIPTOR = 1, + /** + * @generated from protobuf enum value: UNSUPPORTED_VERSION = 2; + */ + UNSUPPORTED_VERSION = 2 +} +/** + * @generated from protobuf enum dht.DisconnectMode + */ +export enum DisconnectMode { + /** + * @generated from protobuf enum value: NORMAL = 0; + */ + NORMAL = 0, + /** + * @generated from protobuf enum value: LEAVING = 1; + */ + LEAVING = 1 +} +// @generated message type with reflection information, may provide speed optimized methods +class StoreDataRequest$Type extends MessageType { + constructor() { + super("dht.StoreDataRequest", [ + { no: 1, name: "key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "data", kind: "message", T: () => Any }, + { no: 3, name: "creator", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 4, name: "createdAt", kind: "message", T: () => Timestamp }, + { no: 5, name: "ttl", kind: "scalar", T: 13 /*ScalarType.UINT32*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.StoreDataRequest + */ +export const StoreDataRequest = new StoreDataRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class StoreDataResponse$Type extends MessageType { + constructor() { + super("dht.StoreDataResponse", []); + } +} +/** + * @generated MessageType for protobuf message dht.StoreDataResponse + */ +export const StoreDataResponse = new StoreDataResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ExternalStoreDataRequest$Type extends MessageType { + constructor() { + super("dht.ExternalStoreDataRequest", [ + { no: 1, name: "key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "data", kind: "message", T: () => Any } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ExternalStoreDataRequest + */ +export const ExternalStoreDataRequest = new ExternalStoreDataRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ExternalStoreDataResponse$Type extends MessageType { + constructor() { + super("dht.ExternalStoreDataResponse", [ + { no: 1, name: "storers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ExternalStoreDataResponse + */ +export const ExternalStoreDataResponse = new ExternalStoreDataResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ReplicateDataRequest$Type extends MessageType { + constructor() { + super("dht.ReplicateDataRequest", [ + { no: 1, name: "entry", kind: "message", T: () => DataEntry } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ReplicateDataRequest + */ +export const ReplicateDataRequest = new ReplicateDataRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class DataEntry$Type extends MessageType { + constructor() { + super("dht.DataEntry", [ + { no: 1, name: "key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "data", kind: "message", T: () => Any }, + { no: 3, name: "creator", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 4, name: "createdAt", kind: "message", T: () => Timestamp }, + { no: 5, name: "storedAt", kind: "message", T: () => Timestamp }, + { no: 6, name: "ttl", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 7, name: "stale", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 8, name: "deleted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.DataEntry + */ +export const DataEntry = new DataEntry$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ClosestPeersRequest$Type extends MessageType { + constructor() { + super("dht.ClosestPeersRequest", [ + { no: 1, name: "nodeId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ClosestPeersRequest + */ +export const ClosestPeersRequest = new ClosestPeersRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ClosestPeersResponse$Type extends MessageType { + constructor() { + super("dht.ClosestPeersResponse", [ + { no: 1, name: "peers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, + { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ClosestPeersResponse + */ +export const ClosestPeersResponse = new ClosestPeersResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ClosestRingPeersRequest$Type extends MessageType { + constructor() { + super("dht.ClosestRingPeersRequest", [ + { no: 1, name: "ringId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ClosestRingPeersRequest + */ +export const ClosestRingPeersRequest = new ClosestRingPeersRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ClosestRingPeersResponse$Type extends MessageType { + constructor() { + super("dht.ClosestRingPeersResponse", [ + { no: 1, name: "leftPeers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, + { no: 2, name: "rightPeers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, + { no: 3, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ClosestRingPeersResponse + */ +export const ClosestRingPeersResponse = new ClosestRingPeersResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class RecursiveOperationRequest$Type extends MessageType { + constructor() { + super("dht.RecursiveOperationRequest", [ + { no: 1, name: "sessionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "operation", kind: "enum", T: () => ["dht.RecursiveOperation", RecursiveOperation] } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.RecursiveOperationRequest + */ +export const RecursiveOperationRequest = new RecursiveOperationRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class RecursiveOperationResponse$Type extends MessageType { + constructor() { + super("dht.RecursiveOperationResponse", [ + { no: 1, name: "closestConnectedNodes", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, + { no: 2, name: "dataEntries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => DataEntry }, + { no: 3, name: "noCloserNodesFound", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 4, name: "routingPath", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.RecursiveOperationResponse + */ +export const RecursiveOperationResponse = new RecursiveOperationResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class PingRequest$Type extends MessageType { + constructor() { + super("dht.PingRequest", [ + { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.PingRequest + */ +export const PingRequest = new PingRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class PingResponse$Type extends MessageType { + constructor() { + super("dht.PingResponse", [ + { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.PingResponse + */ +export const PingResponse = new PingResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class LeaveNotice$Type extends MessageType { + constructor() { + super("dht.LeaveNotice", []); + } +} +/** + * @generated MessageType for protobuf message dht.LeaveNotice + */ +export const LeaveNotice = new LeaveNotice$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class PeerDescriptor$Type extends MessageType { + constructor() { + super("dht.PeerDescriptor", [ + { no: 1, name: "nodeId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 2, name: "type", kind: "enum", T: () => ["dht.NodeType", NodeType] }, + { no: 3, name: "udp", kind: "message", T: () => ConnectivityMethod }, + { no: 4, name: "tcp", kind: "message", T: () => ConnectivityMethod }, + { no: 5, name: "websocket", kind: "message", T: () => ConnectivityMethod }, + { no: 6, name: "region", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, + { no: 7, name: "ipAddress", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, + { no: 8, name: "publicKey", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ }, + { no: 9, name: "signature", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.PeerDescriptor + */ +export const PeerDescriptor = new PeerDescriptor$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ConnectivityMethod$Type extends MessageType { + constructor() { + super("dht.ConnectivityMethod", [ + { no: 1, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 2, name: "host", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 3, name: "tls", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ConnectivityMethod + */ +export const ConnectivityMethod = new ConnectivityMethod$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class RouteMessageWrapper$Type extends MessageType { + constructor() { + super("dht.RouteMessageWrapper", [ + { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "sourcePeer", kind: "message", T: () => PeerDescriptor }, + { no: 3, name: "target", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, + { no: 4, name: "message", kind: "message", T: () => Message }, + { no: 5, name: "reachableThrough", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, + { no: 6, name: "routingPath", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, + { no: 7, name: "parallelRootNodeIds", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.RouteMessageWrapper + */ +export const RouteMessageWrapper = new RouteMessageWrapper$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class RouteMessageAck$Type extends MessageType { + constructor() { + super("dht.RouteMessageAck", [ + { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "error", kind: "enum", opt: true, T: () => ["dht.RouteMessageError", RouteMessageError] } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.RouteMessageAck + */ +export const RouteMessageAck = new RouteMessageAck$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ConnectivityRequest$Type extends MessageType { + constructor() { + super("dht.ConnectivityRequest", [ + { no: 1, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 2, name: "tls", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, + { no: 3, name: "host", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, + { no: 4, name: "allowSelfSignedCertificate", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ConnectivityRequest + */ +export const ConnectivityRequest = new ConnectivityRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ConnectivityResponse$Type extends MessageType { + constructor() { + super("dht.ConnectivityResponse", [ + { no: 1, name: "host", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "natType", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 3, name: "websocket", kind: "message", T: () => ConnectivityMethod }, + { no: 4, name: "ipAddress", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, + { no: 5, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 6, name: "latitude", kind: "scalar", opt: true, T: 1 /*ScalarType.DOUBLE*/ }, + { no: 7, name: "longitude", kind: "scalar", opt: true, T: 1 /*ScalarType.DOUBLE*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ConnectivityResponse + */ +export const ConnectivityResponse = new ConnectivityResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class HandshakeRequest$Type extends MessageType { + constructor() { + super("dht.HandshakeRequest", [ + { no: 1, name: "sourcePeerDescriptor", kind: "message", T: () => PeerDescriptor }, + { no: 2, name: "targetPeerDescriptor", kind: "message", T: () => PeerDescriptor }, + { no: 3, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.HandshakeRequest + */ +export const HandshakeRequest = new HandshakeRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class HandshakeResponse$Type extends MessageType { + constructor() { + super("dht.HandshakeResponse", [ + { no: 1, name: "sourcePeerDescriptor", kind: "message", T: () => PeerDescriptor }, + { no: 2, name: "error", kind: "enum", opt: true, T: () => ["dht.HandshakeError", HandshakeError] }, + { no: 3, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.HandshakeResponse + */ +export const HandshakeResponse = new HandshakeResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class Message$Type extends MessageType { + constructor() { + super("dht.Message", [ + { no: 1, name: "messageId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "sourceDescriptor", kind: "message", T: () => PeerDescriptor }, + { no: 3, name: "targetDescriptor", kind: "message", T: () => PeerDescriptor }, + { no: 4, name: "serviceId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 5, name: "rpcMessage", kind: "message", oneof: "body", T: () => RpcMessage }, + { no: 6, name: "connectivityRequest", kind: "message", oneof: "body", T: () => ConnectivityRequest }, + { no: 7, name: "connectivityResponse", kind: "message", oneof: "body", T: () => ConnectivityResponse }, + { no: 8, name: "handshakeRequest", kind: "message", oneof: "body", T: () => HandshakeRequest }, + { no: 9, name: "handshakeResponse", kind: "message", oneof: "body", T: () => HandshakeResponse }, + { no: 10, name: "recursiveOperationRequest", kind: "message", oneof: "body", T: () => RecursiveOperationRequest } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.Message + */ +export const Message = new Message$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class WebsocketConnectionRequest$Type extends MessageType { + constructor() { + super("dht.WebsocketConnectionRequest", []); + } +} +/** + * @generated MessageType for protobuf message dht.WebsocketConnectionRequest + */ +export const WebsocketConnectionRequest = new WebsocketConnectionRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class WebrtcConnectionRequest$Type extends MessageType { + constructor() { + super("dht.WebrtcConnectionRequest", []); + } +} +/** + * @generated MessageType for protobuf message dht.WebrtcConnectionRequest + */ +export const WebrtcConnectionRequest = new WebrtcConnectionRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class RtcOffer$Type extends MessageType { + constructor() { + super("dht.RtcOffer", [ + { no: 1, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.RtcOffer + */ +export const RtcOffer = new RtcOffer$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class RtcAnswer$Type extends MessageType { + constructor() { + super("dht.RtcAnswer", [ + { no: 1, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.RtcAnswer + */ +export const RtcAnswer = new RtcAnswer$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class IceCandidate$Type extends MessageType { + constructor() { + super("dht.IceCandidate", [ + { no: 1, name: "candidate", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 2, name: "mid", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, + { no: 3, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.IceCandidate + */ +export const IceCandidate = new IceCandidate$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class LockRequest$Type extends MessageType { + constructor() { + super("dht.LockRequest", [ + { no: 1, name: "lockId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.LockRequest + */ +export const LockRequest = new LockRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class UnlockRequest$Type extends MessageType { + constructor() { + super("dht.UnlockRequest", [ + { no: 1, name: "lockId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.UnlockRequest + */ +export const UnlockRequest = new UnlockRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class LockResponse$Type extends MessageType { + constructor() { + super("dht.LockResponse", [ + { no: 1, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.LockResponse + */ +export const LockResponse = new LockResponse$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class DisconnectNotice$Type extends MessageType { + constructor() { + super("dht.DisconnectNotice", [ + { no: 1, name: "disconnectMode", kind: "enum", T: () => ["dht.DisconnectMode", DisconnectMode] } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.DisconnectNotice + */ +export const DisconnectNotice = new DisconnectNotice$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class SetPrivateRequest$Type extends MessageType { + constructor() { + super("dht.SetPrivateRequest", [ + { no: 1, name: "isPrivate", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.SetPrivateRequest + */ +export const SetPrivateRequest = new SetPrivateRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ExternalFetchDataRequest$Type extends MessageType { + constructor() { + super("dht.ExternalFetchDataRequest", [ + { no: 1, name: "key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ExternalFetchDataRequest + */ +export const ExternalFetchDataRequest = new ExternalFetchDataRequest$Type(); +// @generated message type with reflection information, may provide speed optimized methods +class ExternalFetchDataResponse$Type extends MessageType { + constructor() { + super("dht.ExternalFetchDataResponse", [ + { no: 1, name: "entries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => DataEntry } + ]); + } +} +/** + * @generated MessageType for protobuf message dht.ExternalFetchDataResponse + */ +export const ExternalFetchDataResponse = new ExternalFetchDataResponse$Type(); +/** + * @generated ServiceType for protobuf service dht.DhtNodeRpc + */ +export const DhtNodeRpc = new ServiceType("dht.DhtNodeRpc", [ + { name: "getClosestPeers", options: {}, I: ClosestPeersRequest, O: ClosestPeersResponse }, + { name: "getClosestRingPeers", options: {}, I: ClosestRingPeersRequest, O: ClosestRingPeersResponse }, + { name: "ping", options: {}, I: PingRequest, O: PingResponse }, + { name: "leaveNotice", options: {}, I: LeaveNotice, O: Empty } +]); +/** + * @generated ServiceType for protobuf service dht.RouterRpc + */ +export const RouterRpc = new ServiceType("dht.RouterRpc", [ + { name: "routeMessage", options: {}, I: RouteMessageWrapper, O: RouteMessageAck }, + { name: "forwardMessage", options: {}, I: RouteMessageWrapper, O: RouteMessageAck } +]); +/** + * @generated ServiceType for protobuf service dht.RecursiveOperationRpc + */ +export const RecursiveOperationRpc = new ServiceType("dht.RecursiveOperationRpc", [ + { name: "routeRequest", options: {}, I: RouteMessageWrapper, O: RouteMessageAck } +]); +/** + * @generated ServiceType for protobuf service dht.StoreRpc + */ +export const StoreRpc = new ServiceType("dht.StoreRpc", [ + { name: "storeData", options: {}, I: StoreDataRequest, O: StoreDataResponse }, + { name: "replicateData", options: {}, I: ReplicateDataRequest, O: Empty } +]); +/** + * @generated ServiceType for protobuf service dht.RecursiveOperationSessionRpc + */ +export const RecursiveOperationSessionRpc = new ServiceType("dht.RecursiveOperationSessionRpc", [ + { name: "sendResponse", options: {}, I: RecursiveOperationResponse, O: Empty } +]); +/** + * @generated ServiceType for protobuf service dht.WebsocketClientConnectorRpc + */ +export const WebsocketClientConnectorRpc = new ServiceType("dht.WebsocketClientConnectorRpc", [ + { name: "requestConnection", options: {}, I: WebsocketConnectionRequest, O: Empty } +]); +/** + * @generated ServiceType for protobuf service dht.WebrtcConnectorRpc + */ +export const WebrtcConnectorRpc = new ServiceType("dht.WebrtcConnectorRpc", [ + { name: "requestConnection", options: {}, I: WebrtcConnectionRequest, O: Empty }, + { name: "rtcOffer", options: {}, I: RtcOffer, O: Empty }, + { name: "rtcAnswer", options: {}, I: RtcAnswer, O: Empty }, + { name: "iceCandidate", options: {}, I: IceCandidate, O: Empty } +]); +/** + * @generated ServiceType for protobuf service dht.ConnectionLockRpc + */ +export const ConnectionLockRpc = new ServiceType("dht.ConnectionLockRpc", [ + { name: "lockRequest", options: {}, I: LockRequest, O: LockResponse }, + { name: "unlockRequest", options: {}, I: UnlockRequest, O: Empty }, + { name: "gracefulDisconnect", options: {}, I: DisconnectNotice, O: Empty }, + { name: "setPrivate", options: {}, I: SetPrivateRequest, O: Empty } +]); +/** + * @generated ServiceType for protobuf service dht.ExternalApiRpc + */ +export const ExternalApiRpc = new ServiceType("dht.ExternalApiRpc", [ + { name: "externalFetchData", options: {}, I: ExternalFetchDataRequest, O: ExternalFetchDataResponse }, + { name: "externalStoreData", options: {}, I: ExternalStoreDataRequest, O: ExternalStoreDataResponse } +]); diff --git a/packages/trackerless-network/generated/packages/dht/protos/PeerDescriptor.ts b/packages/trackerless-network/generated/packages/dht/protos/PeerDescriptor.ts deleted file mode 100644 index 1f19652ec8..0000000000 --- a/packages/trackerless-network/generated/packages/dht/protos/PeerDescriptor.ts +++ /dev/null @@ -1,111 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/dht/protos/PeerDescriptor.proto" (package "peerDescriptor", syntax proto3) -// tslint:disable -import { MessageType } from "@protobuf-ts/runtime"; -/** - * @generated from protobuf message peerDescriptor.PeerDescriptor - */ -export interface PeerDescriptor { - /** - * @generated from protobuf field: bytes nodeId = 1; - */ - nodeId: Uint8Array; - /** - * @generated from protobuf field: peerDescriptor.NodeType type = 2; - */ - type: NodeType; - /** - * @generated from protobuf field: peerDescriptor.ConnectivityMethod udp = 3; - */ - udp?: ConnectivityMethod; - /** - * @generated from protobuf field: peerDescriptor.ConnectivityMethod tcp = 4; - */ - tcp?: ConnectivityMethod; - /** - * @generated from protobuf field: peerDescriptor.ConnectivityMethod websocket = 5; - */ - websocket?: ConnectivityMethod; - /** - * @generated from protobuf field: optional uint32 region = 6; - */ - region?: number; - /** - * @generated from protobuf field: optional uint32 ipAddress = 7; - */ - ipAddress?: number; - /** - * @generated from protobuf field: optional bytes publicKey = 8; - */ - publicKey?: Uint8Array; - /** - * signature of fields 2-8 - * - * @generated from protobuf field: optional bytes signature = 9; - */ - signature?: Uint8Array; -} -/** - * @generated from protobuf message peerDescriptor.ConnectivityMethod - */ -export interface ConnectivityMethod { - /** - * @generated from protobuf field: uint32 port = 1; - */ - port: number; - /** - * @generated from protobuf field: string host = 2; - */ - host: string; - /** - * @generated from protobuf field: bool tls = 3; - */ - tls: boolean; -} -/** - * @generated from protobuf enum peerDescriptor.NodeType - */ -export enum NodeType { - /** - * @generated from protobuf enum value: NODEJS = 0; - */ - NODEJS = 0, - /** - * @generated from protobuf enum value: BROWSER = 1; - */ - BROWSER = 1 -} -// @generated message type with reflection information, may provide speed optimized methods -class PeerDescriptor$Type extends MessageType { - constructor() { - super("peerDescriptor.PeerDescriptor", [ - { no: 1, name: "nodeId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 2, name: "type", kind: "enum", T: () => ["peerDescriptor.NodeType", NodeType] }, - { no: 3, name: "udp", kind: "message", T: () => ConnectivityMethod }, - { no: 4, name: "tcp", kind: "message", T: () => ConnectivityMethod }, - { no: 5, name: "websocket", kind: "message", T: () => ConnectivityMethod }, - { no: 6, name: "region", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, - { no: 7, name: "ipAddress", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, - { no: 8, name: "publicKey", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ }, - { no: 9, name: "signature", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message peerDescriptor.PeerDescriptor - */ -export const PeerDescriptor = new PeerDescriptor$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ConnectivityMethod$Type extends MessageType { - constructor() { - super("peerDescriptor.ConnectivityMethod", [ - { no: 1, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, - { no: 2, name: "host", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "tls", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message peerDescriptor.ConnectivityMethod - */ -export const ConnectivityMethod = new ConnectivityMethod$Type(); diff --git a/packages/trackerless-network/generated/packages/trackerless-network/protos/NetworkRpc.ts b/packages/trackerless-network/generated/packages/trackerless-network/protos/NetworkRpc.ts index aea08ee43f..769341508e 100644 --- a/packages/trackerless-network/generated/packages/trackerless-network/protos/NetworkRpc.ts +++ b/packages/trackerless-network/generated/packages/trackerless-network/protos/NetworkRpc.ts @@ -4,7 +4,7 @@ import { Empty } from "../../../google/protobuf/empty"; import { ServiceType } from "@protobuf-ts/runtime-rpc"; import { MessageType } from "@protobuf-ts/runtime"; -import { PeerDescriptor } from "../../dht/protos/PeerDescriptor"; +import { PeerDescriptor } from "../../dht/protos/DhtRpc"; /** * @generated from protobuf message MessageID */ @@ -208,7 +208,7 @@ export interface StreamPartHandshakeResponse { */ requestId: string; /** - * @generated from protobuf field: optional peerDescriptor.PeerDescriptor interleaveTargetDescriptor = 3; + * @generated from protobuf field: optional dht.PeerDescriptor interleaveTargetDescriptor = 3; */ interleaveTargetDescriptor?: PeerDescriptor; } @@ -219,7 +219,7 @@ export interface InterleaveRequest { /** * this is a required field but in generated NetworkRpc.ts it is incorrectly annotated as optional (NET-1082) * - * @generated from protobuf field: peerDescriptor.PeerDescriptor interleaveTargetDescriptor = 1; + * @generated from protobuf field: dht.PeerDescriptor interleaveTargetDescriptor = 1; */ interleaveTargetDescriptor?: PeerDescriptor; } @@ -258,7 +258,7 @@ export interface NeighborUpdate { */ removeMe: boolean; /** - * @generated from protobuf field: repeated peerDescriptor.PeerDescriptor neighborDescriptors = 3; + * @generated from protobuf field: repeated dht.PeerDescriptor neighborDescriptors = 3; */ neighborDescriptors: PeerDescriptor[]; } @@ -312,11 +312,11 @@ export interface StreamPartitionInfo { */ id: string; /** - * @generated from protobuf field: repeated peerDescriptor.PeerDescriptor controlLayerNeighbors = 2; + * @generated from protobuf field: repeated dht.PeerDescriptor controlLayerNeighbors = 2; */ controlLayerNeighbors: PeerDescriptor[]; /** - * @generated from protobuf field: repeated peerDescriptor.PeerDescriptor deprecatedContentDeliveryLayerNeighbors = 3; + * @generated from protobuf field: repeated dht.PeerDescriptor deprecatedContentDeliveryLayerNeighbors = 3; */ deprecatedContentDeliveryLayerNeighbors: PeerDescriptor[]; /** @@ -329,7 +329,7 @@ export interface StreamPartitionInfo { */ export interface ContentDeliveryLayerNeighborInfo { /** - * @generated from protobuf field: peerDescriptor.PeerDescriptor peerDescriptor = 1; + * @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 1; */ peerDescriptor?: PeerDescriptor; /** @@ -342,11 +342,11 @@ export interface ContentDeliveryLayerNeighborInfo { */ export interface ControlLayerInfo { /** - * @generated from protobuf field: repeated peerDescriptor.PeerDescriptor neighbors = 1; + * @generated from protobuf field: repeated dht.PeerDescriptor neighbors = 1; */ neighbors: PeerDescriptor[]; /** - * @generated from protobuf field: repeated peerDescriptor.PeerDescriptor connections = 2; + * @generated from protobuf field: repeated dht.PeerDescriptor connections = 2; */ connections: PeerDescriptor[]; } @@ -360,7 +360,7 @@ export interface NodeInfoRequest { */ export interface NodeInfoResponse { /** - * @generated from protobuf field: peerDescriptor.PeerDescriptor peerDescriptor = 1; + * @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 1; */ peerDescriptor?: PeerDescriptor; /** diff --git a/packages/trackerless-network/protos/NetworkRpc.proto b/packages/trackerless-network/protos/NetworkRpc.proto index 166b5ddc91..00dd12ffd4 100644 --- a/packages/trackerless-network/protos/NetworkRpc.proto +++ b/packages/trackerless-network/protos/NetworkRpc.proto @@ -4,7 +4,7 @@ option optimize_for = CODE_SIZE; import "google/protobuf/empty.proto"; import "google/protobuf/any.proto"; -import "packages/dht/protos/PeerDescriptor.proto"; +import "packages/dht/protos/DhtRpc.proto"; service ContentDeliveryRpc { rpc sendStreamMessage (StreamMessage) returns (google.protobuf.Empty); @@ -113,12 +113,12 @@ message StreamPartHandshakeRequest { message StreamPartHandshakeResponse { bool accepted = 1; string requestId = 2; - optional peerDescriptor.PeerDescriptor interleaveTargetDescriptor = 3; + optional dht.PeerDescriptor interleaveTargetDescriptor = 3; } message InterleaveRequest { // this is a required field but in generated NetworkRpc.ts it is incorrectly annotated as optional (NET-1082) - peerDescriptor.PeerDescriptor interleaveTargetDescriptor = 1; + dht.PeerDescriptor interleaveTargetDescriptor = 1; } message InterleaveResponse { @@ -133,7 +133,7 @@ message LeaveStreamPartNotice { message NeighborUpdate { string streamPartId = 1; bool removeMe = 2; - repeated peerDescriptor.PeerDescriptor neighborDescriptors = 3; + repeated dht.PeerDescriptor neighborDescriptors = 3; } message ProxyConnectionRequest { @@ -162,25 +162,25 @@ enum ProxyDirection { message StreamPartitionInfo { string id = 1; - repeated peerDescriptor.PeerDescriptor controlLayerNeighbors = 2; - repeated peerDescriptor.PeerDescriptor deprecatedContentDeliveryLayerNeighbors = 3; + repeated dht.PeerDescriptor controlLayerNeighbors = 2; + repeated dht.PeerDescriptor deprecatedContentDeliveryLayerNeighbors = 3; repeated ContentDeliveryLayerNeighborInfo contentDeliveryLayerNeighbors = 4; } message ContentDeliveryLayerNeighborInfo { - peerDescriptor.PeerDescriptor peerDescriptor = 1; + dht.PeerDescriptor peerDescriptor = 1; optional int32 rtt = 2; } message ControlLayerInfo { - repeated peerDescriptor.PeerDescriptor neighbors = 1; - repeated peerDescriptor.PeerDescriptor connections = 2; + repeated dht.PeerDescriptor neighbors = 1; + repeated dht.PeerDescriptor connections = 2; } message NodeInfoRequest {} message NodeInfoResponse { - peerDescriptor.PeerDescriptor peerDescriptor = 1; + dht.PeerDescriptor peerDescriptor = 1; repeated StreamPartitionInfo streamPartitions = 2; ControlLayerInfo controlLayer = 3; string version = 4; diff --git a/packages/trackerless-network/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts b/packages/trackerless-network/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts index 0ea1ef39da..6d92fc63cf 100644 --- a/packages/trackerless-network/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts +++ b/packages/trackerless-network/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts @@ -1,14 +1,8 @@ import { ServerCallContext } from '@protobuf-ts/runtime-rpc' -import { - ConnectionLocker, - DhtAddress, - DhtCallContext, - ListeningRpcCommunicator, - toNodeId, - PeerDescriptor -} from '@streamr/dht' +import { ConnectionLocker, DhtAddress, DhtCallContext, ListeningRpcCommunicator, toNodeId } from '@streamr/dht' import { StreamPartID } from '@streamr/utils' import { Empty } from '../../../generated/google/protobuf/empty' +import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc' import { CloseTemporaryConnection, TemporaryConnectionRequest, diff --git a/packages/trackerless-network/test/unit/ExternalNetworkRpc.test.ts b/packages/trackerless-network/test/unit/ExternalNetworkRpc.test.ts index b4756d36c2..d47c04dc56 100644 --- a/packages/trackerless-network/test/unit/ExternalNetworkRpc.test.ts +++ b/packages/trackerless-network/test/unit/ExternalNetworkRpc.test.ts @@ -1,10 +1,10 @@ import { Message } from '@streamr/dht' import { ExternalNetworkRpc, SERVICE_ID } from '../../src/logic/ExternalNetworkRpc' +import { HandshakeRequest, HandshakeResponse } from '../../generated/packages/dht/protos/DhtRpc' import { MockTransport } from '../utils/mock/MockTransport' import { RpcMessage } from '@streamr/proto-rpc' import { Any } from '../../generated/google/protobuf/any' import { HandshakeRpcClient } from '../../generated/packages/trackerless-network/protos/NetworkRpc.client' -import { StreamPartHandshakeRequest, StreamPartHandshakeResponse } from '../../generated/packages/trackerless-network/protos/NetworkRpc' describe('ExternalNetworkRpc', () => { @@ -23,7 +23,7 @@ describe('ExternalNetworkRpc', () => { }) it('registers method', async () => { - rpc.registerRpcMethod(StreamPartHandshakeRequest, StreamPartHandshakeResponse, 'handshake', () => fn()) + rpc.registerRpcMethod(HandshakeRequest, HandshakeResponse, 'handshake', () => fn()) transport.emit('message', Message.create({ serviceId: SERVICE_ID, body: { @@ -33,7 +33,7 @@ describe('ExternalNetworkRpc', () => { request: 'request', method: 'handshake' }, - body: Any.pack(StreamPartHandshakeRequest.create(), StreamPartHandshakeRequest) + body: Any.pack(HandshakeRequest.create(), HandshakeRequest) }) } })) diff --git a/packages/trackerless-network/test/unit/PeerDescriptorStoreManager.test.ts b/packages/trackerless-network/test/unit/PeerDescriptorStoreManager.test.ts index 853e021650..752205032a 100644 --- a/packages/trackerless-network/test/unit/PeerDescriptorStoreManager.test.ts +++ b/packages/trackerless-network/test/unit/PeerDescriptorStoreManager.test.ts @@ -1,7 +1,8 @@ -import { PeerDescriptor, areEqualPeerDescriptors, randomDhtAddress, DataEntry } from '@streamr/dht' +import { PeerDescriptor, areEqualPeerDescriptors, randomDhtAddress } from '@streamr/dht' import { wait } from '@streamr/utils' import { PeerDescriptorStoreManager } from '../../src/logic/PeerDescriptorStoreManager' import { Any } from '../../generated/google/protobuf/any' +import { DataEntry } from '../../generated/packages/dht/protos/DhtRpc' import { createMockPeerDescriptor } from '../utils/utils' const KEY = randomDhtAddress()