/**
 * Concurrent DNS Detection Engine
 *
 * Implements parallel MX/TXT record lookups for 2x faster business domain detection.
 * Uses Promise.allSettled for fault tolerance and intelligent result merging.
 */
import { EmailProvider } from './api';
/**
 * Configuration for concurrent DNS detection
 */
export interface ConcurrentDNSConfig {
    /** Timeout for DNS queries in milliseconds */
    timeout: number;
    /** Enable parallel DNS queries (vs sequential fallback) */
    enableParallel: boolean;
    /** Prioritize MX record matches over TXT */
    prioritizeMX: boolean;
    /** Collect detailed debugging information */
    collectDebugInfo: boolean;
    /** Fall back to sequential mode on parallel failure */
    fallbackToSequential: boolean;
}
/**
 * Result from a single DNS query (MX or TXT)
 */
export interface DNSQueryResult {
    /** Type of DNS record queried */
    type: 'mx' | 'txt';
    /** Whether the query succeeded */
    success: boolean;
    /** DNS records returned (if successful) */
    records?: any[];
    /** Error information (if failed) */
    error?: Error;
    /** Query execution time in milliseconds */
    timing: number;
    /** Raw DNS response for debugging */
    rawResponse?: any;
}
/**
 * Result from concurrent DNS detection
 */
export interface ConcurrentDNSResult {
    /** Detected email provider (null if none found) */
    provider: EmailProvider | null;
    /** Method used for detection */
    detectionMethod: 'mx_record' | 'txt_record' | 'both' | 'proxy_detected' | null;
    /** Confidence score (0-1, higher = more confident) */
    confidence: number;
    /** Proxy service detected (if any) */
    proxyService?: string;
    /** Detailed timing information */
    timing: {
        mx: number;
        txt: number;
        total: number;
    };
    /** Debug information (if enabled) */
    debug?: {
        mxMatches: string[];
        txtMatches: string[];
        conflicts: boolean;
        queries: DNSQueryResult[];
        fallbackUsed: boolean;
    } | undefined;
}
/**
 * Concurrent DNS Detection Engine
 */
export declare class ConcurrentDNSDetector {
    private activeQueries;
    cleanup(): Promise<void>;
    private config;
    private providers;
    constructor(providers: EmailProvider[], config?: Partial<ConcurrentDNSConfig>);
    /**
     * Detect provider for a domain using concurrent DNS lookups
     */
    detectProvider(domain: string): Promise<ConcurrentDNSResult>;
    /**
     * Perform DNS queries in parallel using Promise.allSettled with smart optimization
     */
    private performParallelQueries;
    /**
     * Perform DNS queries sequentially (fallback mode)
     */
    private performSequentialQueries;
    /**
     * Query MX records with timeout
     */
    private queryMX;
    /**
     * Query TXT records with timeout
     */
    private queryTXT;
    /**
     * Find provider matches from DNS query results
     */
    private findProviderMatches;
    /**
     * Match a provider against DNS query results
     */
    private matchProvider;
    /**
     * Select the best provider match from multiple candidates
     */
    private selectBestMatch;
    /**
     * Check if MX result has potential matches (for sequential optimization)
     */
    private hasMXMatch;
    /**
     * Detect proxy services from DNS results
     */
    private detectProxy;
    /**
     * Calculate timing information from query results
     */
    private calculateTiming;
    /**
     * Wrap a promise with a timeout
     */
    private withTimeout;
}
/**
 * Factory function to create a concurrent DNS detector
 */
export declare function createConcurrentDNSDetector(providers: EmailProvider[], config?: Partial<ConcurrentDNSConfig>): ConcurrentDNSDetector;
/**
 * Utility function for quick concurrent DNS detection
 */
export declare function detectProviderConcurrent(domain: string, providers: EmailProvider[], config?: Partial<ConcurrentDNSConfig>): Promise<ConcurrentDNSResult>;
//# sourceMappingURL=concurrent-dns.d.ts.map