/// /// import * as streams from 'stream'; import type { StreamMuxer, StreamMuxerInit } from './types'; import { GoAwayCode } from './frame'; import { YamuxStream } from './stream'; import { Config } from './config'; export interface YamuxMuxerInit extends StreamMuxerInit, Partial { } export declare class Yamux { private readonly _init; constructor(init?: YamuxMuxerInit); createStreamMuxer(init?: YamuxMuxerInit): YamuxMuxer; } export declare class YamuxMuxer extends streams.Duplex implements StreamMuxer { private readonly _init; private readonly config; private readonly log?; /** Used to close the muxer from either the sink or source */ private readonly closeController; /** The next stream id to be used when initiating a new stream */ private nextStreamID; /** Primary stream mapping, streamID => stream */ private readonly _streams; /** The next ping id to be used when pinging */ private nextPingID; /** Tracking info for the currently active ping */ private activePing?; /** Round trip time */ private rtt; /** True if client, false if server */ private readonly client; private localGoAway?; private remoteGoAway?; /** Number of tracked inbound streams */ private numInboundStreams; /** Number of tracked outbound streams */ private numOutboundStreams; private readonly onIncomingStream?; private readonly onStreamEnd?; private readonly decoder; constructor(init: YamuxMuxerInit); get streams(): YamuxStream[]; newStream(name?: string | undefined): YamuxStream; /** * Initiate a ping and wait for a response * * Note: only a single ping will be initiated at a time. * If a ping is already in progress, a new ping will not be initiated. * * @returns the round-trip-time in milliseconds */ ping(): Promise; /** * Get the ping round trip time * * Note: Will return 0 if no successful ping has yet been completed * * @returns the round-trip-time in milliseconds */ getRTT(): number; /** * Close the muxer * * @param err * @param reason - The GoAway reason to be sent */ close(err?: Error, reason?: GoAwayCode): void; isClosed(): boolean; _read(size: number): void; _final(callback: (error?: (Error | null)) => void): void; _destroy(error: any, callback: (error: (Error | null)) => void): void; _write(chunk: any, encoding: BufferEncoding, callback: (error?: (Error | null)) => void): void; /** * Called when either the local or remote shuts down the muxer */ private _closeMuxer; /** Create a new stream */ private _newStream; /** * closeStream is used to close a stream once both sides have * issued a close. */ private closeStream; private keepAliveLoop; private handleFrame; private handlePing; private handlePingResponse; private handleGoAway; private handleStreamMessage; private incomingStream; private sendFrame; private sendPing; private sendGoAway; } //# sourceMappingURL=muxer.d.ts.map