extHostTunnelService.ts 1.3 KB
Newer Older
1 2 3 4 5
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

A
Alex Ross 已提交
6
import { ExtHostTunnelServiceShape } from 'vs/workbench/api/common/extHost.protocol';
7
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
A
Alex Ross 已提交
8 9 10 11 12 13 14 15 16 17 18 19 20
import * as vscode from 'vscode';

export interface TunnelOptions {
	remote: { port: number, host: string };
	localPort?: number;
	name?: string;
	closeable?: boolean;
}

export interface TunnelDto {
	remote: { port: number, host: string };
	localAddress: string;
}
21 22

export interface IExtHostTunnelService extends ExtHostTunnelServiceShape {
A
Alex Ross 已提交
23
	readonly _serviceBrand: undefined;
A
Alex Ross 已提交
24
	makeTunnel(forward: TunnelOptions): Promise<vscode.Tunnel | undefined>;
25 26 27
}

export const IExtHostTunnelService = createDecorator<IExtHostTunnelService>('IExtHostTunnelService');
28 29 30 31 32 33 34 35 36 37

export class ExtHostTunnelService implements IExtHostTunnelService {
	_serviceBrand: undefined;
	async makeTunnel(forward: TunnelOptions): Promise<vscode.Tunnel | undefined> {
		return undefined;
	}
	async $findCandidatePorts(): Promise<{ port: number; detail: string; }[]> {
		return [];
	}
}