import type { RoutePreprocessor } from './route-preprocessor.js'; /** * Server that receives UDP datagrams from Rust via Unix stream socket * and dispatches them to TypeScript datagramHandler callbacks. * * Protocol: length-prefixed JSON frames over a persistent Unix stream socket. * - Rust→TS: { type: "datagram", routeKey, sourceIp, sourcePort, destPort, payloadBase64 } * - TS→Rust: { type: "reply", sourceIp, sourcePort, destPort, payloadBase64 } */ export declare class DatagramHandlerServer { private static readonly MAX_BUFFER_SIZE; private server; private connection; private socketPath; private preprocessor; private readBuffer; constructor(socketPath: string, preprocessor: RoutePreprocessor); /** * Start listening on the Unix socket. */ start(): Promise; /** * Stop the server and clean up. */ stop(): Promise; /** * Handle a new connection from Rust. * Only one connection at a time (Rust maintains a persistent connection). */ private handleConnection; /** * Process length-prefixed frames from the read buffer. */ private processFrames; /** * Handle a received datagram message from Rust. */ private handleMessage; /** * Send a reply frame back to Rust. */ private sendReply; /** * Get the socket path for passing to Rust via IPC. */ getSocketPath(): string; }