import net from "node:net";
import type { IncomingMessage } from "node:http";
import type { Logger } from "pino";
import type { RequestHandler } from "express";
export interface ScriptRoute {
    hostname: string;
    port: number;
}
export interface ScriptRouteEntry extends ScriptRoute {
    workspaceId: string;
    projectSlug: string;
    scriptName: string;
}
export declare class ScriptRouteStore {
    private routes;
    private workspaceHostnames;
    registerRoute(entry: ScriptRouteEntry): void;
    removeRoute(hostname: string): void;
    removeRouteForWorkspaceScript(params: {
        workspaceId: string;
        scriptName: string;
    }): void;
    removeRoutesForPort(port: number): void;
    findRoute(host: string): ScriptRoute | null;
    getRouteEntry(hostname: string): ScriptRouteEntry | null;
    listRoutes(): ScriptRouteEntry[];
    listRoutesForWorkspace(workspaceId: string): ScriptRouteEntry[];
    private addHostnameToWorkspaceIndex;
    private removeHostnameFromWorkspaceIndex;
}
export declare function createScriptProxyMiddleware({ routeStore, logger, }: {
    routeStore: ScriptRouteStore;
    logger: Logger;
}): RequestHandler;
export declare function createScriptProxyUpgradeHandler({ routeStore, logger, }: {
    routeStore: ScriptRouteStore;
    logger: Logger;
}): (req: IncomingMessage, socket: net.Socket, head: Buffer) => void;
export declare function findFreePort(): Promise<number>;
//# sourceMappingURL=script-proxy.d.ts.map