mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-19 18:14:50 +01:00
Add tunnel creation options to web api
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* 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 { Disposable } from 'vs/base/common/lifecycle';
|
||||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
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;
|
const tunnelFactory = environmentService.options?.tunnelProvider?.tunnelFactory;
|
||||||
if (tunnelFactory) {
|
if (tunnelFactory) {
|
||||||
this._register(tunnelService.setTunnelProvider({
|
this._register(tunnelService.setTunnelProvider({
|
||||||
forwardPort: (tunnelOptions: TunnelOptions): Promise<RemoteTunnel> | undefined => {
|
forwardPort: (tunnelOptions: TunnelOptions, tunnelCreationOptions: TunnelCreationOptions): Promise<RemoteTunnel> | undefined => {
|
||||||
const tunnelPromise = tunnelFactory(tunnelOptions);
|
const tunnelPromise = tunnelFactory(tunnelOptions, tunnelCreationOptions);
|
||||||
if (!tunnelPromise) {
|
if (!tunnelPromise) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ interface ITunnelProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface ITunnelFactory {
|
interface ITunnelFactory {
|
||||||
(tunnelOptions: ITunnelOptions, elevate?: boolean): Promise<ITunnel> | undefined;
|
(tunnelOptions: ITunnelOptions, tunnelCreationOptions: TunnelCreationOptions): Promise<ITunnel> | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ITunnelOptions {
|
interface ITunnelOptions {
|
||||||
@@ -66,6 +66,13 @@ interface ITunnelOptions {
|
|||||||
label?: string;
|
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 {
|
interface ITunnel extends IDisposable {
|
||||||
remoteAddress: { port: number, host: string };
|
remoteAddress: { port: number, host: string };
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user