Merge from vscode 817eb6b0c720a4ecbc13c020afbbebfed667aa09 (#7356)

This commit is contained in:
Anthony Dresser
2019-09-24 21:36:17 -07:00
committed by GitHub
parent a29ae4d3b9
commit 6a6048d40f
541 changed files with 7045 additions and 7287 deletions

View File

@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { URI } from 'vs/base/common/uri';
export const ITunnelService = createDecorator<ITunnelService>('tunnelService');
@@ -17,5 +18,21 @@ export interface RemoteTunnel {
export interface ITunnelService {
_serviceBrand: undefined;
readonly tunnels: Promise<readonly RemoteTunnel[]>;
openTunnel(remotePort: number): Promise<RemoteTunnel> | undefined;
}
export function extractLocalHostUriMetaDataForPortMapping(uri: URI): { address: string, port: number } | undefined {
if (uri.scheme !== 'http' && uri.scheme !== 'https') {
return undefined;
}
const localhostMatch = /^(localhost|127\.0\.0\.1):(\d+)$/.exec(uri.authority);
if (!localhostMatch) {
return undefined;
}
return {
address: localhostMatch[1],
port: +localhostMatch[2],
};
}

View File

@@ -8,11 +8,9 @@ import { ITunnelService, RemoteTunnel } from 'vs/platform/remote/common/tunnel';
export class NoOpTunnelService implements ITunnelService {
_serviceBrand: undefined;
public constructor(
) {
}
public readonly tunnels: Promise<readonly RemoteTunnel[]> = Promise.resolve([]);
openTunnel(remotePort: number): Promise<RemoteTunnel> | undefined {
openTunnel(_remotePort: number): Promise<RemoteTunnel> | undefined {
return undefined;
}
}