remoteAuthorityResolver.ts ×11

Frontier kind: Code frontier

unlabeled · c_77372d5fb7a4

150 tests · 16182 LOC · 74 files · introduces 0 tests · 135 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges135 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1993 ranges16182 lines · 74 files · Browse complete extent
All tests (intent)
150 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 135 introduced LOC across 11 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/remote/common/remoteAuthorityResolver.ts 135 introduced LOC · 11 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- remoteAuthorityResolver.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { ErrorNoTelemetry } from '../../../base/common/errors.js';
7 > import { Event } from '../../../base/common/event.js';
8 > import { URI } from '../../../base/common/uri.js';
9 > import { createDecorator } from '../../instantiation/common/instantiation.js';
10 >
11 > export const IRemoteAuthorityResolverService = createDecorator<IRemoteAuthorityResolverService>('remoteAuthorityResolverService');
12 >
13 > export const enum RemoteConnectionType {
14 > WebSocket,
15 > Managed
16 > }
17 >
18 > export class ManagedRemoteConnection {
19 > public readonly type = RemoteConnectionType.Managed;
20 >
21 > constructor(
22 public readonly id: number
23 ) { }
25 > public toString(): string {
26 return `Managed(${this.id})`;
27 }
29 >
30 > export class WebSocketRemoteConnection {
31 > public readonly type = RemoteConnectionType.WebSocket;
32 >
33 > constructor(
34 public readonly host: string,
35 public readonly port: number,
36 ) { }
38 > public toString(): string {
39 return `WebSocket(${this.host}:${this.port})`;
40 }
42 >
43 > export type RemoteConnection = WebSocketRemoteConnection | ManagedRemoteConnection;
44 >
45 > export type RemoteConnectionOfType<T extends RemoteConnectionType> = RemoteConnection & { type: T };
46 >
47 > export interface ResolvedAuthority {
48 > readonly authority: string;
49 > readonly connectTo: RemoteConnection;
50 > readonly connectionToken: string | undefined;
51 > }
52 >
53 > export interface ResolvedOptions {
54 > readonly extensionHostEnv?: { [key: string]: string | null };
55 > readonly isTrusted?: boolean;
56 > readonly authenticationSession?: { id: string; providerId: string };
57 > }
58 >
59 > export interface TunnelDescription {
60 > remoteAddress: { port: number; host: string };
61 > localAddress: { port: number; host: string } | string;
62 > privacy?: string;
63 > protocol?: string;
64 > }
65 > export interface TunnelPrivacy {
66 > themeIcon: string;
67 > id: string;
68 > label: string;
69 > }
70 > export interface TunnelInformation {
71 > environmentTunnels?: TunnelDescription[];
72 > features?: {
73 > elevation: boolean;
74 > public?: boolean;
75 > privacyOptions: TunnelPrivacy[];
76 > protocol: boolean;
77 > };
78 > }
79 >
80 > export interface ResolverResult {
81 > authority: ResolvedAuthority;
82 > options?: ResolvedOptions;
83 > tunnelInformation?: TunnelInformation;
84 > }
85 >
86 > export interface IRemoteConnectionData {
87 > connectTo: RemoteConnection;
88 > connectionToken: string | undefined;
89 > }
90 >
91 > export enum RemoteAuthorityResolverErrorCode {
92 > Unknown = 'Unknown',
93 > NotAvailable = 'NotAvailable',
94 > TemporarilyNotAvailable = 'TemporarilyNotAvailable',
95 > NoResolverFound = 'NoResolverFound',
96 > InvalidAuthority = 'InvalidAuthority'
97 > }
98 >
99 > export class RemoteAuthorityResolverError extends ErrorNoTelemetry {
100 >
101 > public static isNotAvailable(err: any): boolean {
102 return (err instanceof RemoteAuthorityResolverError) && err._code === RemoteAuthorityResolverErrorCode.NotAvailable;
103 }
105 > public static isTemporarilyNotAvailable(err: any): boolean {
106 return (err instanceof RemoteAuthorityResolverError) && err._code === RemoteAuthorityResolverErrorCode.TemporarilyNotAvailable;
107 }
109 > public static isNoResolverFound(err: any): err is RemoteAuthorityResolverError {
110 return (err instanceof RemoteAuthorityResolverError) && err._code === RemoteAuthorityResolverErrorCode.NoResolverFound;
111 }
113 > public static isInvalidAuthority(err: any): boolean {
114 return (err instanceof RemoteAuthorityResolverError) && err._code === RemoteAuthorityResolverErrorCode.InvalidAuthority;
115 }
117 > public static isHandled(err: any): boolean {
118 return (err instanceof RemoteAuthorityResolverError) && err.isHandled;
119 }
121 > public readonly _message: string | undefined;
122 > public readonly _code: RemoteAuthorityResolverErrorCode;
123 > public readonly _detail: unknown;
124 >
125 > public isHandled: boolean;
126 >
127 > constructor(message?: string, code: RemoteAuthorityResolverErrorCode = RemoteAuthorityResolverErrorCode.Unknown, detail?: unknown) {
128 super(message);
129
138 Object.setPrototypeOf(this, RemoteAuthorityResolverError.prototype);
139 }
141 >
142 > export interface IRemoteAuthorityResolverService {
143 >
144 > readonly _serviceBrand: undefined;
145 >
146 > readonly onDidChangeConnectionData: Event<void>;
147 >
148 > resolveAuthority(authority: string): Promise<ResolverResult>;
149 > getConnectionData(authority: string): IRemoteConnectionData | null;
150 > /**
151 > * Get the canonical URI for a `vscode-remote://` URI.
152 > *
153 > * **NOTE**: This can throw e.g. in cases where there is no resolver installed for the specific remote authority.
154 > *
155 > * @param uri The `vscode-remote://` URI
156 > */
157 > getCanonicalURI(uri: URI): Promise<URI>;
158 >
159 > _clearResolvedAuthority(authority: string): void;
160 > _setResolvedAuthority(resolvedAuthority: ResolvedAuthority, resolvedOptions?: ResolvedOptions): void;
161 > _setResolvedAuthorityError(authority: string, err: any): void;
162 > _setAuthorityConnectionToken(authority: string, connectionToken: string): void;
163 > _setCanonicalURIProvider(provider: (uri: URI) => Promise<URI>): void;
164 > }
165 >
166 > export function getRemoteAuthorityPrefix(remoteAuthority: string): string {
167 const plusIndex = remoteAuthority.indexOf('+');
168 if (plusIndex === -1) {