UNPKG

@microsoft/dev-tunnels-ssh

Version:
71 lines 3.24 kB
import { CancellationToken, Disposable } from 'vscode-jsonrpc'; import { Stream } from '../streams'; import { KeyExchangeService } from '../services/keyExchangeService'; import { SshMessage } from '../messages/sshMessage'; import { SessionMetrics } from '../metrics/sessionMetrics'; import { SshSessionAlgorithms } from '../sshSessionAlgorithms'; import { SshSessionConfiguration } from '../sshSessionConfiguration'; import { Trace } from '../trace'; /** * Implements the base SSH protocol (sending and receiving messages) over a Stream. */ export declare class SshProtocol implements Disposable { private readonly config; private readonly metrics; private readonly trace; private static readonly maxPacketLength; private static readonly packetLengthSize; private static readonly paddingLengthSize; private stream; private readonly sessionSemaphore; private inboundPacketSequence; private outboundPacketSequence; private inboundFlow; private outboundFlow; private lastIncomingTimestamp; private readonly recentSentMessages; private readonly sendWriter; private readonly receiveWriter; constructor(stream: Stream, config: SshSessionConfiguration, metrics: SessionMetrics, trace: Trace); extensions: Map<string, string> | null; kexService: KeyExchangeService | null; algorithms: SshSessionAlgorithms | null; messageContext: string | null; outgoingMessagesHaveLatencyInfo: boolean; incomingMessagesHaveLatencyInfo: boolean; outgoingMessagesHaveReconnectInfo: boolean; incomingMessagesHaveReconnectInfo: boolean; get lastIncomingSequence(): number; getSentMessages(startingSequenceNumber: number): SshMessage[] | null; writeProtocolVersion(version: string, cancellation?: CancellationToken): Promise<void>; readProtocolVersion(cancellation?: CancellationToken): Promise<string>; handleNewKeys(cancellation?: CancellationToken): Promise<void>; /** * Attempts to read from the stream until the buffer is full. * @returns True if the read succeeded, false if the stream was disposed. */ private read; /** * Attempts to write data to the stream. * @returns True if the write succeeded, false if the stream was disposed. */ private write; considerReExchange(initial: boolean, cancellation?: CancellationToken): Promise<void>; private computeHmac; private verifyHmac; private readAndVerifyHmac; /** * Attemps to write one message to the stream. * @returns `true` if writing succeeded, `false` if the stream was disposed. * @throws SshConnectionException if writing to the stream failed for any other reason. */ sendMessage(message: SshMessage, cancellation?: CancellationToken): Promise<boolean>; /** * Attemps to read one message from the stream. * @returns The message, or `null` if the stream was disposed. * @throws SshConnectionError if reading from the stream failed for any other reason. */ receiveMessage(cancellation?: CancellationToken): Promise<SshMessage | null>; dispose(): void; } //# sourceMappingURL=sshProtocol.d.ts.map