UNPKG

@microsoft/dev-tunnels-ssh-tcp

Version:

SSH TCP extensions library for Dev Tunnels

52 lines 2.52 kB
/// <reference types="node" /> import * as net from 'net'; import { Event, Disposable } from 'vscode-jsonrpc'; import { SshServerSession, SshServerCredentials, SshSessionConfiguration, Stream, Trace } from '@microsoft/dev-tunnels-ssh'; import { TcpListenerFactory } from './tcpListenerFactory'; /** * Enables accepting SSH sessions on a TCP socket. * * It's possible to create an `SshServerSession` over any `Stream` instance; * this class is merely a convenient helper that manages creating sessions * over Node.js TCP `Socket`s from incoming connections. */ export declare class SshServer implements Disposable { private config; private tcpListener?; private readonly sessions; private readonly reconnectableSessions; constructor(config: SshSessionConfiguration); /** * Gets or sets a function that handles trace messages associated with the server sessions. * * By default, no messages are traced. To enable tracing, set this property to a function * that routes the message to console.log, a file, or anywhere else. * * @param level The level of message being traced: error, warning, info, or verbose. * @param eventId An integer that identifies the type of event. Normally this is one of * the values from `SshTraceEventIds`, but extensions may define additional event IDs. * @param msg A description of the event (non-localized). * @param err Optional `Error` object associated with the event, often included with * warning or error events. While the `Error.message` property is typically included as * (part of) the `msg` parameter, the error object may contain additional useful context * such as the stack trace. */ trace: Trace; private readonly errorEmitter; readonly onError: Event<Error>; private readonly sessionOpenedEmitter; readonly onSessionOpened: Event<SshServerSession>; readonly credentials: SshServerCredentials; /** * Gets or sets a factory for creating TCP listeners. * * Applications may override this factory to provide custom logic for selecting * local port numbers to listen on for port-forwarding. */ tcpListenerFactory: TcpListenerFactory; acceptSessions(localPort: number, localAddress?: string): Promise<void>; protected acceptConnection(socket: net.Socket): Promise<Stream>; private acceptSession; dispose(): void; } //# sourceMappingURL=sshServer.d.ts.map