Add tunnel creation options to web api

This commit is contained in:
Alex Ross 2020-11-25 11:44:58 +01:00
parent 221a5570b6
commit 799e72cc2f
2 changed files with 11 additions and 4 deletions

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ITunnelService, TunnelOptions, RemoteTunnel } from 'vs/platform/remote/common/tunnel';
import { ITunnelService, TunnelOptions, RemoteTunnel, TunnelCreationOptions } from 'vs/platform/remote/common/tunnel';
import { Disposable } from 'vs/base/common/lifecycle';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
@ -20,8 +20,8 @@ export class TunnelFactoryContribution extends Disposable implements IWorkbenchC
const tunnelFactory = environmentService.options?.tunnelProvider?.tunnelFactory;
if (tunnelFactory) {
this._register(tunnelService.setTunnelProvider({
forwardPort: (tunnelOptions: TunnelOptions): Promise<RemoteTunnel> | undefined => {
const tunnelPromise = tunnelFactory(tunnelOptions);
forwardPort: (tunnelOptions: TunnelOptions, tunnelCreationOptions: TunnelCreationOptions): Promise<RemoteTunnel> | undefined => {
const tunnelPromise = tunnelFactory(tunnelOptions, tunnelCreationOptions);
if (!tunnelPromise) {
return undefined;
}

View file

@ -52,7 +52,7 @@ interface ITunnelProvider {
}
interface ITunnelFactory {
(tunnelOptions: ITunnelOptions, elevate?: boolean): Promise<ITunnel> | undefined;
(tunnelOptions: ITunnelOptions, tunnelCreationOptions: TunnelCreationOptions): Promise<ITunnel> | undefined;
}
interface ITunnelOptions {
@ -66,6 +66,13 @@ interface ITunnelOptions {
label?: string;
}
export interface TunnelCreationOptions {
/**
* True when the local operating system will require elevation to use the requested local port.
*/
elevationRequired?: boolean;
}
interface ITunnel extends IDisposable {
remoteAddress: { port: number, host: string };