mirror of
https://github.com/coder/code-server.git
synced 2026-05-10 14:27:26 +02:00
chore(vscode): update to 1.54.2
This commit is contained in:
@@ -99,10 +99,6 @@ export function isAllInterfaces(host: string): boolean {
|
||||
return ALL_INTERFACES_ADDRESSES.indexOf(host) >= 0;
|
||||
}
|
||||
|
||||
function getOtherLocalhost(host: string): string | undefined {
|
||||
return (host === 'localhost') ? '127.0.0.1' : ((host === '127.0.0.1') ? 'localhost' : undefined);
|
||||
}
|
||||
|
||||
export function isPortPrivileged(port: number, os?: OperatingSystem): boolean {
|
||||
if (os) {
|
||||
return os !== OperatingSystem.Windows && (port < 1024);
|
||||
@@ -282,20 +278,25 @@ export abstract class AbstractTunnelService implements ITunnelService {
|
||||
}
|
||||
|
||||
protected getTunnelFromMap(remoteHost: string, remotePort: number): { refcount: number, readonly value: Promise<RemoteTunnel | undefined> } | undefined {
|
||||
const otherLocalhost = getOtherLocalhost(remoteHost);
|
||||
let portMap: Map<number, { refcount: number, readonly value: Promise<RemoteTunnel | undefined> }> | undefined;
|
||||
if (otherLocalhost) {
|
||||
const firstMap = this._tunnels.get(remoteHost);
|
||||
const secondMap = this._tunnels.get(otherLocalhost);
|
||||
if (firstMap && secondMap) {
|
||||
portMap = new Map([...Array.from(firstMap.entries()), ...Array.from(secondMap.entries())]);
|
||||
} else {
|
||||
portMap = firstMap ?? secondMap;
|
||||
}
|
||||
} else {
|
||||
portMap = this._tunnels.get(remoteHost);
|
||||
let hosts = [remoteHost];
|
||||
// Order matters. We want the original host to be first.
|
||||
if (isLocalhost(remoteHost)) {
|
||||
hosts.push(...LOCALHOST_ADDRESSES);
|
||||
// For localhost, we add the all interfaces hosts because if the tunnel is already available at all interfaces,
|
||||
// then of course it is available at localhost.
|
||||
hosts.push(...ALL_INTERFACES_ADDRESSES);
|
||||
} else if (isAllInterfaces(remoteHost)) {
|
||||
hosts.push(...ALL_INTERFACES_ADDRESSES);
|
||||
}
|
||||
return portMap ? portMap.get(remotePort) : undefined;
|
||||
|
||||
const existingPortMaps = hosts.map(host => this._tunnels.get(host));
|
||||
for (const map of existingPortMaps) {
|
||||
const existingTunnel = map?.get(remotePort);
|
||||
if (existingTunnel) {
|
||||
return existingTunnel;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
canTunnel(uri: URI): boolean {
|
||||
|
||||
Reference in New Issue
Block a user