"use strict";
//
//  Copyright (c) Microsoft Corporation. All rights reserved.
//
Object.defineProperty(exports, "__esModule", { value: true });
exports.RemotePortStreamer = void 0;
const vscode_jsonrpc_1 = require("vscode-jsonrpc");
const dev_tunnels_ssh_1 = require("@microsoft/dev-tunnels-ssh");
const remotePortConnector_1 = require("./remotePortConnector");
/**
 * Receives SSH channels forwarded from a remote port and exposes them as streams.
 */
class RemotePortStreamer extends remotePortConnector_1.RemotePortConnector {
    /* @internal */
    constructor(session, remoteIPAddress, remotePort) {
        super(session, remoteIPAddress, remotePort);
        this.streamOpenedEmitter = new vscode_jsonrpc_1.Emitter();
        /**
         * Event raised when a new connection stream is forwarded from the remote port.
         */
        this.onStreamOpened = this.streamOpenedEmitter.event;
    }
    /* @internal */
    async onPortChannelOpening(request, cancellation) {
        const stream = new dev_tunnels_ssh_1.SshStream(request.channel);
        this.streamOpenedEmitter.fire(stream);
    }
}
exports.RemotePortStreamer = RemotePortStreamer;
//# sourceMappingURL=https://github.com/VSCodium/sourcemaps/releases/download/stable-824c4c46a288b839f13b24022655329c2aeb9f81/node_modules-@microsoft-dev-tunnels-ssh-tcp-services-remotePortStreamer.js.map