Skip to content

Class: SshRouteRegistry

Owns user-scoped AppKit paths that proxy to HTTP ports over SSH forwarding.

Route ownership is checked against AppKit request identity before HTTP or WebSocket traffic reaches the remote service. User hashes only prevent path collisions and do not replace ownership checks.

new SshRouteRegistry(prefix): SshRouteRegistry

Creates an empty registry beneath one normalized AppKit route prefix.

string

SshRouteRegistry

add(session, input): Promise<SshForwardedRoute>

Registers or reuses a route and starts its local SSH forwarding bridge.

User-created paths are placed beneath userPathPrefix. Internal built-in service paths must provide their complete reserved path.

SshSession

RouteInput

Promise<SshForwardedRoute>


canHandleUpgrade(path): boolean

Returns whether an upgrade path belongs to a registered route or browser relay.

string

boolean


close(): Promise<void>

Removes every route and closes the shared HTTP/WebSocket proxy.

Promise<void>


handleUpgrade(request, socket, head): Promise<boolean>

Proxies an authorized matching HTTP Upgrade request, including WebSockets.

IncomingMessage

Socket

Buffer

Promise<boolean>


list(machineId?, ownerId?, options?): SshForwardedRoute[]

Lists routes, optionally filtered by machine and owner. Internal routes are excluded by default.

string

string

boolean

SshForwardedRoute[]


middleware(): (request, response, next) => Promise<void>

Returns Express middleware that authorizes, rewrites, and proxies matching HTTP requests. Unmatched requests continue to the next AppKit handler.

(request, response, next) => Promise<void>


remove(routeId, ownerId?): Promise<boolean>

Removes an owned route, closes active sockets, and deletes its local bridge.

string

string

Promise<boolean>


removeMachine(machineId, ownerId?): Promise<void>

Removes every matching route for one machine and optional owner.

string

string

Promise<void>


revokeOwner(machineId, ownerId): void

Revokes one owner’s active and future access to machine-owned service routes.

string

string

void


userPathPrefix(ownerId): string

Returns the collision-avoidance path namespace for one authenticated user.

string

string


whenSessionDrained(session): Promise<void>

Resolves after a replaced SSH session no longer backs routes or forwarded sockets.

SshSession

Promise<void>