提交 3ace4436 编写于 作者: A Alex Ross

Add a type for TunnelDescription

Part of #88244
上级 9957d02f
...@@ -17,8 +17,12 @@ export interface ResolvedOptions { ...@@ -17,8 +17,12 @@ export interface ResolvedOptions {
readonly extensionHostEnv?: { [key: string]: string | null }; readonly extensionHostEnv?: { [key: string]: string | null };
} }
export interface TunnelDescription {
remoteAddress: { port: number, host: string };
localAddress: string;
}
export interface TunnelInformation { export interface TunnelInformation {
environmentTunnels?: { remoteAddress: { port: number, host: string }, localAddress: string }[]; environmentTunnels?: TunnelDescription[];
hideCandidatePorts?: boolean; hideCandidatePorts?: boolean;
} }
......
...@@ -40,10 +40,13 @@ declare module 'vscode' { ...@@ -40,10 +40,13 @@ declare module 'vscode' {
label?: string; label?: string;
} }
export interface Tunnel { export interface TunnelDescription {
remoteAddress: { port: number, host: string }; remoteAddress: { port: number, host: string };
//The complete local address(ex. localhost:1234) //The complete local address(ex. localhost:1234)
localAddress: string; localAddress: string;
}
export interface Tunnel extends TunnelDescription {
// Implementers of Tunnel should fire onDidDispose when dispose is called. // Implementers of Tunnel should fire onDidDispose when dispose is called.
onDidDispose: Event<void>; onDidDispose: Event<void>;
dispose(): void; dispose(): void;
...@@ -58,7 +61,7 @@ declare module 'vscode' { ...@@ -58,7 +61,7 @@ declare module 'vscode' {
* The localAddress should be the complete local address (ex. localhost:1234) for connecting to the port. Tunnels provided through * The localAddress should be the complete local address (ex. localhost:1234) for connecting to the port. Tunnels provided through
* detected are read-only from the forwarded ports UI. * detected are read-only from the forwarded ports UI.
*/ */
environmentTunnels?: { remoteAddress: { port: number, host: string }, localAddress: string }[]; environmentTunnels?: TunnelDescription[];
hideCandidatePorts?: boolean; hideCandidatePorts?: boolean;
} }
......
...@@ -11,7 +11,7 @@ import { ITunnelService, RemoteTunnel } from 'vs/platform/remote/common/tunnel'; ...@@ -11,7 +11,7 @@ import { ITunnelService, RemoteTunnel } from 'vs/platform/remote/common/tunnel';
import { Disposable } from 'vs/base/common/lifecycle'; import { Disposable } from 'vs/base/common/lifecycle';
import { IEditableData } from 'vs/workbench/common/views'; import { IEditableData } from 'vs/workbench/common/views';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { TunnelInformation } from 'vs/platform/remote/common/remoteAuthorityResolver'; import { TunnelInformation, TunnelDescription } from 'vs/platform/remote/common/remoteAuthorityResolver';
export const IRemoteExplorerService = createDecorator<IRemoteExplorerService>('remoteExplorerService'); export const IRemoteExplorerService = createDecorator<IRemoteExplorerService>('remoteExplorerService');
export const REMOTE_EXPLORER_TYPE_KEY: string = 'remote.explorerType'; export const REMOTE_EXPLORER_TYPE_KEY: string = 'remote.explorerType';
...@@ -172,7 +172,7 @@ export class TunnelModel extends Disposable { ...@@ -172,7 +172,7 @@ export class TunnelModel extends Disposable {
return (this.forwarded.get(key) || this.detected.get(key))?.localAddress; return (this.forwarded.get(key) || this.detected.get(key))?.localAddress;
} }
addEnvironmentTunnels(tunnels: { remoteAddress: { port: number, host: string }, localAddress: string }[]): void { addEnvironmentTunnels(tunnels: TunnelDescription[]): void {
tunnels.forEach(tunnel => { tunnels.forEach(tunnel => {
this.detected.set(MakeAddress(tunnel.remoteAddress.host, tunnel.remoteAddress.port), { this.detected.set(MakeAddress(tunnel.remoteAddress.host, tunnel.remoteAddress.port), {
remoteHost: tunnel.remoteAddress.host, remoteHost: tunnel.remoteAddress.host,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册