Danish Arora 0b8936f1f1
feat: ConnectionManager extends EventEmitter & exposed on the Waku interface (& minor improvements) (#1447)
* move KeepAliveOptions to dedicated interface file

* update export for KeepAlive

* expose `ConnectionManager` on the waku node

* update ConnectionManager test to use the exposed API

* rm: only for the test
2023-07-31 13:54:39 +05:30

51 lines
1.2 KiB
TypeScript

import type { Stream } from "@libp2p/interface-connection";
import type { PeerId } from "@libp2p/interface-peer-id";
import type { Multiaddr } from "@multiformats/multiaddr";
import { IConnectionManager } from "./connection_manager.js";
import type { IFilter } from "./filter.js";
import type { Libp2p } from "./libp2p.js";
import type { ILightPush } from "./light_push.js";
import { Protocols } from "./protocols.js";
import type { IRelay } from "./relay.js";
import type { IStore } from "./store.js";
export interface Waku {
libp2p: Libp2p;
relay?: IRelay;
store?: IStore;
filter?: IFilter;
lightPush?: ILightPush;
connectionManager: IConnectionManager;
dial(peer: PeerId | Multiaddr, protocols?: Protocols[]): Promise<Stream>;
start(): Promise<void>;
stop(): Promise<void>;
isStarted(): boolean;
}
export interface LightNode extends Waku {
relay: undefined;
store: IStore;
filter: IFilter;
lightPush: ILightPush;
}
export interface RelayNode extends Waku {
relay: IRelay;
store: undefined;
filter: undefined;
lightPush: undefined;
}
export interface FullNode extends Waku {
relay: IRelay;
store: IStore;
filter: IFilter;
lightPush: ILightPush;
}