UNPKG

@microsoft/dev-tunnels-ssh

Version:
100 lines 4.78 kB
import { CancellationToken, Disposable, Event } from 'vscode-jsonrpc'; import { Stream } from './streams'; import { SshChannel } from './sshChannel'; import { SshStream } from './sshStream'; import { SshSession } from './sshSession'; import { SshSessionClosedEventArgs } from './events/sshSessionClosedEventArgs'; import { SshChannelOpeningEventArgs } from './events/sshChannelOpeningEventArgs'; import { Trace } from './trace'; import { Progress } from './progress'; import { SshReportProgressEventArgs } from './events/sshReportProgressEventArgs'; /** * Multiplexes multiple virtual streams (channels) over a single transport stream, using the * SSH protocol while providing a simplified interface without any encryption or authentication. * * This class is a complement to `SecureStream`, which provides only the encryption and * authentication functions of SSH. * * To communicate over multiple channels, two sides first establish a transport stream * over a pipe, socket, or anything else. Then one side accepts a channel while the * other side opens a channel. Either side can both open and accept channels over the * same transport stream, as long as the other side does the complementary action. */ export declare class MultiChannelStream implements Disposable { protected readonly transportStream: Stream; protected readonly session: SshSession; private disposed; private disposables; private readonly reportProgressEmitter; /** * Event that is raised to report connection progress. * * See `Progress` for a description of the different progress events that can be reported. */ readonly onReportProgress: Event<SshReportProgressEventArgs>; /** * Creates a new multi-channel stream over an underlying transport stream. * @param transportStream Stream that is used to multiplex all the channels. */ constructor(transportStream: Stream); get trace(): Trace; set trace(trace: Trace); protected raiseReportProgress(progress: Progress, sessionNumber?: number): void; /** * Gets or sets the maximum window size for channels within the multi-channel stream. * @see `SshChannel.maxWindowSize` */ channelMaxWindowSize: number; get isClosed(): boolean; private readonly closedEmitter; readonly onClosed: Event<SshSessionClosedEventArgs>; private readonly channelOpeningEmitter; readonly onChannelOpening: Event<SshChannelOpeningEventArgs>; /** * Initiates the SSH session over the transport stream by exchanging initial messages with the * remote peer. Waits for the protocol version exchange and key exchange. Additional message * processing is kicked off as a background promise chain. * @param cancellation optional cancellation token. */ connect(cancellation?: CancellationToken): Promise<void>; /** * Asynchronously waits for the other side to open a channel. * @param channelType optional channel type * @param cancellation optional cancellation token. */ acceptChannel(channelType?: string, cancellation?: CancellationToken): Promise<SshChannel>; /** * Asynchronously waits for the other side to open a channel. * @param channelType optional channel type * @param cancellation optional cancellation token. */ acceptStream(channelType?: string, cancellation?: CancellationToken): Promise<SshStream>; /** * Opens a channel and asynchronously waits for the other side to accept it. * @param channelType optional channel type * @param cancellation optional cancellation token. */ openChannel(channelType?: string, cancellation?: CancellationToken): Promise<SshChannel>; /** * Opens a channel and asynchronously waits for the other side to accept it. * @param channelType optional channel type * @param cancellation optional cancellation token. */ openStream(channelType?: string, cancellation?: CancellationToken): Promise<SshStream>; /** * Creates a stream instance for a channel. May be overridden to create a `SshStream` subclass. */ protected createStream(channel: SshChannel): SshStream; /** * Connects, waits until the session closes or `cancellation` is cancelled, and then disposes the * session and the transport stream. * @param cancellation optional cancellation token. */ connectAndRunUntilClosed(cancellation?: CancellationToken): Promise<void>; dispose(): void; close(): Promise<void>; private onSessionClosed; private onSessionChannelOpening; private unsubscribe; } //# sourceMappingURL=multiChannelStream.d.ts.map