UNPKG

@libp2p/interface-mocks

Version:
17 lines 1.01 kB
import type { Connection } from '@libp2p/interface-connection'; import type { PeerId } from '@libp2p/interface-peer-id'; import type { IncomingStreamData, Registrar, StreamHandler, Topology, StreamHandlerOptions, StreamHandlerRecord } from '@libp2p/interface-registrar'; export declare class MockRegistrar implements Registrar { private readonly topologies; private readonly handlers; getProtocols(): string[]; handle(protocol: string, handler: StreamHandler, opts?: StreamHandlerOptions): Promise<void>; unhandle(protocol: string): Promise<void>; getHandler(protocol: string): StreamHandlerRecord; register(protocol: string, topology: Topology): Promise<string>; unregister(id: string | string[]): void; getTopologies(protocol: string): Topology[]; } export declare function mockRegistrar(): Registrar; export declare function mockIncomingStreamEvent(protocol: string, conn: Connection, remotePeer: PeerId): Promise<IncomingStreamData>; //# sourceMappingURL=registrar.d.ts.map