import * as plugins from '../plugins.js';
import { DcRouter } from '../classes.dcrouter.js';
import type { IAsnActivity } from '../../dist_ts_interfaces/data/stats.js';
export declare class MetricsManager {
    private metricsLogger;
    private smartMetrics;
    private dcRouter;
    private resetInterval?;
    private metricsCache;
    private readonly MAX_TOP_DOMAINS;
    private emailMetrics;
    private dnsMetrics;
    private emailMinuteBuckets;
    private dnsMinuteBuckets;
    private securityMetrics;
    constructor(dcRouter: DcRouter);
    start(): Promise<void>;
    stop(): Promise<void>;
    getServerStats(): Promise<{
        uptime: number;
        startTime: number;
        memoryUsage: {
            heapUsed: number;
            heapTotal: number;
            external: number;
            rss: number;
            maxMemoryMB: number;
            actualUsageBytes: number;
            actualUsagePercentage: number;
        };
        cpuUsage: {
            user: number;
            system: number;
        };
        activeConnections: number;
        totalConnections: number;
        requestsPerSecond: number;
        throughput: {
            bytesIn: number;
            bytesOut: number;
            bytesInPerSecond: number;
            bytesOutPerSecond: number;
        };
    }>;
    getEmailStats(): Promise<{
        sentToday: number;
        receivedToday: number;
        failedToday: number;
        bounceRate: number;
        deliveryRate: number;
        queueSize: number;
        averageDeliveryTime: number;
        topRecipients: {
            email: string;
            count: number;
        }[];
        recentActivity: {
            timestamp: number;
            type: string;
            details: string;
        }[];
    }>;
    getDnsStats(): Promise<{
        queriesPerSecond: number;
        totalQueries: number;
        cacheHits: number;
        cacheMisses: number;
        cacheHitRate: number;
        topDomains: {
            domain: string;
            count: number;
        }[];
        queryTypes: Record<string, number>;
        averageResponseTime: number;
        activeDomains: number;
        recentQueries: {
            timestamp: number;
            domain: string;
            type: string;
            answered: boolean;
            responseTimeMs: number;
        }[];
    }>;
    /**
     * Sync security metrics from the SecurityLogger singleton (last 24h).
     * Called before returning security stats so counters reflect real events.
     */
    private syncFromSecurityLogger;
    getSecurityStats(): Promise<{
        blockedIPs: number;
        authFailures: number;
        spamDetected: number;
        malwareDetected: number;
        phishingDetected: number;
        totalThreatsBlocked: number;
        recentIncidents: {
            timestamp: number;
            type: string;
            severity: string;
            details: string;
        }[];
    }>;
    getActiveConnectionSnapshots(options?: plugins.smartproxy.IActiveConnectionSnapshotOptions): Promise<plugins.smartproxy.IActiveConnectionSnapshot[]>;
    getConnectionInfo(): Promise<{
        type: string;
        count: number;
        source: string;
        lastActivity: Date;
    }[]>;
    trackEmailSent(recipient?: string, deliveryTimeMs?: number): void;
    trackEmailReceived(sender?: string): void;
    trackEmailFailed(recipient?: string, reason?: string): void;
    trackEmailBounced(recipient?: string): void;
    updateQueueSize(size: number): void;
    trackDnsQuery(queryType: string, domain: string, cacheHit: boolean, responseTimeMs?: number, answered?: boolean): void;
    trackBlockedIP(ip?: string, reason?: string): void;
    trackAuthFailure(username?: string, ip?: string): void;
    trackSpamDetected(sender?: string): void;
    trackMalwareDetected(source?: string): void;
    trackPhishingDetected(source?: string): void;
    getNetworkStats(): Promise<{
        connectionsByIP: Map<string, number>;
        throughputRate: {
            bytesInPerSecond: number;
            bytesOutPerSecond: number;
        };
        topIPs: Array<{
            ip: string;
            count: number;
        }>;
        topIPsByBandwidth: Array<{
            ip: string;
            count: number;
            bwIn: number;
            bwOut: number;
        }>;
        topASNs: IAsnActivity[];
        totalDataTransferred: {
            bytesIn: number;
            bytesOut: number;
        };
        throughputHistory: Array<{
            timestamp: number;
            in: number;
            out: number;
        }>;
        throughputByIP: Map<string, {
            in: number;
            out: number;
        }>;
        requestsPerSecond: number;
        requestsTotal: number;
        backends: Array<any>;
        domainActivity: Array<{
            domain: string;
            bytesInPerSecond: number;
            bytesOutPerSecond: number;
            activeConnections: number;
            routeCount: number;
            requestCount: number;
            requestsPerSecond?: number;
            requestsLastMinute?: number;
        }>;
        frontendProtocols: null;
        backendProtocols: null;
    } | {
        connectionsByIP: Map<string, number>;
        throughputRate: {
            bytesInPerSecond: number;
            bytesOutPerSecond: number;
        };
        topIPs: {
            ip: string;
            count: number;
        }[];
        topIPsByBandwidth: {
            ip: string;
            count: number;
            bwIn: number;
            bwOut: number;
        }[];
        topASNs: IAsnActivity[];
        totalDataTransferred: {
            bytesIn: number;
            bytesOut: number;
        };
        throughputHistory: import("@push.rocks/smartproxy/dist_ts/proxies/smart-proxy/index.js").IThroughputHistoryPoint[];
        throughputByIP: Map<string, import("@push.rocks/smartproxy/dist_ts/proxies/smart-proxy/index.js").IThroughputData>;
        requestsPerSecond: number;
        requestsTotal: number;
        backends: any[];
        frontendProtocols: import("@push.rocks/smartproxy/dist_ts/proxies/smart-proxy/index.js").IProtocolDistribution;
        backendProtocols: import("@push.rocks/smartproxy/dist_ts/proxies/smart-proxy/index.js").IProtocolDistribution;
        domainActivity: {
            domain: string;
            bytesInPerSecond: number;
            bytesOutPerSecond: number;
            activeConnections: number;
            routeCount: number;
            requestCount: number;
            requestsPerSecond: number;
            requestsLastMinute: number;
        }[];
    }>;
    private buildTopASNs;
    private static minuteKey;
    private incrementEmailBucket;
    private incrementDnsBucket;
    /**
     * Increment the per-second query counter in the ring buffer.
     * Zeros any stale slots between the last write and the current second.
     */
    private incrementQueryRing;
    /**
     * Sum query counts from the ring buffer for the last N seconds.
     */
    private getQueryRingSum;
    private pruneOldBuckets;
    /**
     * Get email time-series data for the last N hours, aggregated per minute.
     */
    getEmailTimeSeries(hours?: number): {
        sent: Array<{
            timestamp: number;
            value: number;
        }>;
        received: Array<{
            timestamp: number;
            value: number;
        }>;
        failed: Array<{
            timestamp: number;
            value: number;
        }>;
    };
    /**
     * Get DNS time-series data for the last N hours, aggregated per minute.
     */
    getDnsTimeSeries(hours?: number): {
        queries: Array<{
            timestamp: number;
            value: number;
        }>;
    };
}
