import { ProviderConfig, AnyRecord, RecordWithTtl, CaaRecord, MxRecord, NaptrRecord, SoaRecord, SrvRecord, TlsaRecord, ResolveWithTtlOptions, AbortOptions } from '../types.js'; import type { RustBinding } from '../rust/loader.js'; /** * Native DNS provider. Default backend is Node's c-ares-backed `node:dns/promises`. * The `'zynor/native'` entry injects the hickory-dns binding, which handles * every record type and reverse lookup. TTL-aware A/AAAA variants deliberately * stay on the Node path because that is the public TTL surface Zynor preserves. */ export declare class NativeProvider { private queueGeneration; private readonly queueGenerations; private config; private admission; /** Injected hickory binding, or null for the Node DNS path. Provided by the * `'zynor/native'` entry; never loaded here. */ private rustBinding; /** * Creates a new native DNS provider instance. * * @param config - Provider config (concurrency, rate limiting, enabled). * @param runtime - Internal: `rust` is the hickory binding injected by the * `'zynor/native'` entry. When present, MX/A/AAAA/etc. route through it; * when absent, everything uses `node:dns/promises`. Not part of the public surface. */ constructor(config?: ProviderConfig, runtime?: { rust?: RustBinding | null; }); /** * Updates the provider configuration. */ updateConfig(config: ProviderConfig): void; /** * Queue generations are immutable because PQueue's interval policy is not * live-mutable. A replacement waits for every operation submitted to its * predecessor, so old and new limits never run upstream work concurrently * and rapid updates cannot orphan an intermediate generation. */ private createQueueGeneration; private retireQueueGeneration; private resolveDrainedGeneration; get enabled(): boolean; get queueSize(): number; get concurrency(): number; get isFull(): boolean; /** Returns the injected hickory binding, or null for the Node DNS path. * No loading happens here — the `'zynor/native'` entry injects (or * refuses to construct, if the binary is missing). */ private rust; /** * Executes a function through the queue with abort/timeout support. */ private executeQueued; private executeQueuedWithSignal; private executeInQueueGeneration; /** * Run one bulk operation exclusively and return the dynamically admitted * fan-out. The grant is derived only after queue wait, so a rapid live * reconfiguration cannot strand an oversized request or use a stale limit. */ private executeExclusiveBatch; /** * Resolves A records for a hostname. TTL-aware variants stay on the Node path. */ resolve4(hostname: string): Promise; resolve4(hostname: string, options: ResolveWithTtlOptions): Promise; /** Resolves AAAA records for a hostname. TTL-aware variants stay on the Node path. */ resolve6(hostname: string): Promise; resolve6(hostname: string, options: ResolveWithTtlOptions): Promise; /** ANY records. Rust is adapted to node:dns's tagged-union shape. */ resolveAny(hostname: string, options?: AbortOptions): Promise; resolveCaa(hostname: string, options?: AbortOptions): Promise; resolveCname(hostname: string, options?: AbortOptions): Promise; resolveMx(hostname: string, options?: AbortOptions): Promise; resolveNaptr(hostname: string, options?: AbortOptions): Promise; resolveNs(hostname: string, options?: AbortOptions): Promise; resolvePtr(hostname: string, options?: AbortOptions): Promise; /** SOA. Rust returns `RustSoaRecord | null`; Node's resolver throws on missing. * Bridge: if Rust returns null, throw to match the Node contract. */ resolveSoa(hostname: string, options?: AbortOptions): Promise; resolveSrv(hostname: string, options?: AbortOptions): Promise; resolveTlsa(hostname: string, options?: AbortOptions): Promise; resolveTxt(hostname: string, options?: AbortOptions): Promise; reverse(ip: string, options?: AbortOptions): Promise; /** * Generic resolve method. Dispatches to the typed methods so that the * injected Rust path is honored consistently — `resolve(host, 'MX')` * goes through hickory just like `resolveMx` when using `'zynor/native'`. */ resolve(hostname: string): Promise; resolve(hostname: string, rrtype: 'A'): Promise; resolve(hostname: string, rrtype: 'AAAA'): Promise; resolve(hostname: string, rrtype: 'ANY'): Promise; resolve(hostname: string, rrtype: 'CAA'): Promise; resolve(hostname: string, rrtype: 'CNAME'): Promise; resolve(hostname: string, rrtype: 'MX'): Promise; resolve(hostname: string, rrtype: 'NAPTR'): Promise; resolve(hostname: string, rrtype: 'NS'): Promise; resolve(hostname: string, rrtype: 'PTR'): Promise; resolve(hostname: string, rrtype: 'SOA'): Promise; resolve(hostname: string, rrtype: 'SRV'): Promise; resolve(hostname: string, rrtype: 'TLSA'): Promise; resolve(hostname: string, rrtype: 'TXT'): Promise; }