/**
 * Proxy Log Receiver for Onebox
 *
 * TCP server that receives reverse proxy access logs and broadcasts them to WebSocket clients.
 * Supports per-client filtering by domain and adaptive sampling at high volume.
 */
/**
 * Filter applied to a WebSocket client's log stream
 */
export interface ILogFilter {
    domain?: string;
    service?: string;
    sampleRate?: number;
}
/**
 * Reverse proxy access log entry structure.
 */
export interface IProxyAccessLog {
    ts: number;
    level?: string;
    logger?: string;
    msg?: string;
    request: {
        remote_ip: string;
        remote_port?: string;
        client_ip?: string;
        proto: string;
        method: string;
        host: string;
        uri: string;
        headers?: Record<string, string[]>;
        tls?: {
            resumed: boolean;
            version: number;
            cipher_suite: number;
            proto: string;
            server_name: string;
        };
    };
    bytes_read?: number;
    user_id?: string;
    duration: number;
    size: number;
    status: number;
    resp_headers?: Record<string, string[]>;
}
/**
 * ProxyLogReceiver - TCP server for reverse proxy access logs
 */
export declare class ProxyLogReceiver {
    private server;
    private clients;
    private port;
    private running;
    private connections;
    private connectionHandlers;
    private logCountWindow;
    private windowSize;
    private currentSampleRate;
    private logCounter;
    private recentLogs;
    private maxRecentLogs;
    private trafficStats;
    private maxStatsAge;
    private statsInterval;
    constructor(port?: number);
    /**
     * Create a new stats bucket
     */
    private createStatsBucket;
    /**
     * Get current stats bucket, creating new one if needed
     */
    private getCurrentStatsBucket;
    /**
     * Record a request in traffic stats
     */
    private recordTrafficStats;
    /**
     * Start the TCP server
     */
    start(): Promise<void>;
    /**
     * Handle a single TCP connection from the reverse proxy
     */
    private handleConnection;
    /**
     * Process a single access log line
     */
    private processLogLine;
    /**
     * Update adaptive sampling rate based on log volume
     */
    private updateSampling;
    /**
     * Broadcast a log entry to all connected WebSocket clients
     */
    private broadcast;
    /**
     * Check if a log entry matches a client's filter
     */
    private matchesFilter;
    /**
     * Add a WebSocket client to receive logs
     */
    addClient(clientId: string, ws: WebSocket, filter?: ILogFilter): void;
    /**
     * Remove a WebSocket client
     */
    removeClient(clientId: string): void;
    /**
     * Update a client's filter
     */
    updateClientFilter(clientId: string, filter: ILogFilter): void;
    /**
     * Stop the TCP server
     */
    stop(): Promise<void>;
    /**
     * Get current stats
     */
    getStats(): {
        running: boolean;
        port: number;
        clients: number;
        connections: number;
        sampleRate: number;
        recentLogsCount: number;
    };
    /**
     * Get aggregated traffic stats for the specified time range
     * @param minutes Number of minutes to aggregate (default: 60)
     */
    getTrafficStats(minutes?: number): {
        requestCount: number;
        errorCount: number;
        avgResponseTime: number;
        totalBytes: number;
        statusCounts: Record<string, number>;
        requestsPerMinute: number;
        errorRate: number;
    };
}
