import type { RoutePreprocessor } from './route-preprocessor.js';
/**
 * Unix domain socket server that receives relayed connections from the Rust proxy.
 *
 * When Rust encounters a route of type `socket-handler`, it connects to this
 * Unix socket, sends a JSON metadata line, then proxies the raw TCP bytes.
 * This server reads the metadata, finds the original JS handler, builds an
 * IRouteContext, and hands the socket to the handler.
 */
export declare class SocketHandlerServer {
    private server;
    private socketPath;
    private preprocessor;
    private activeSockets;
    constructor(preprocessor: RoutePreprocessor);
    /**
     * The Unix socket path this server listens on.
     */
    getSocketPath(): string;
    /**
     * Start listening for relayed connections from Rust.
     */
    start(): Promise<void>;
    /**
     * Stop the server and clean up.
     */
    stop(): Promise<void>;
    /**
     * Handle an incoming relayed connection from Rust.
     *
     * Protocol: Rust sends a single JSON line with metadata, then raw bytes follow.
     * JSON format: { "routeKey": "my-route", "remoteIP": "1.2.3.4", "remotePort": 12345,
     *                "localPort": 443, "isTLS": true, "domain": "example.com" }
     */
    private handleConnection;
    /**
     * Dispatch a relayed connection to the appropriate JS handler.
     */
    private dispatchToHandler;
    /**
     * Forward a connection to a dynamically resolved target.
     * Used for routes with function-based host/port that Rust cannot handle.
     */
    private forwardDynamicRoute;
}
