UNPKG

@push.rocks/smartdns

Version:

A robust TypeScript library providing advanced DNS management and resolution capabilities including support for DNSSEC, custom DNS servers, and integration with various DNS providers.

60 lines (59 loc) 1.4 kB
export type TClientDnsCommands = { resolve: { params: IResolveParams; result: IResolveResult; }; ping: { params: Record<string, never>; result: { pong: boolean; }; }; }; export interface IResolveParams { name: string; recordType: string; protocol: 'udp' | 'doh'; serverAddr?: string; dohUrl?: string; timeoutMs?: number; } export interface IClientDnsAnswer { name: string; type: string; ttl: number; value: string; } export interface IResolveResult { answers: IClientDnsAnswer[]; adFlag: boolean; rcode: number; } /** * Bridge to the Rust DNS client binary via smartrust IPC. */ export declare class RustDnsClientBridge { private bridge; private spawnPromise; constructor(); /** * Lazily spawn the Rust binary. Only spawns once, caches the promise. */ ensureSpawned(): Promise<void>; /** * Resolve a DNS query through the Rust binary. */ resolve(name: string, recordType: string, protocol: 'udp' | 'doh', serverAddr?: string, dohUrl?: string, timeoutMs?: number): Promise<IResolveResult>; /** * Ping the Rust binary for health check. */ ping(): Promise<boolean>; /** * Kill the Rust process. */ kill(): void; /** * Whether the bridge is running. */ get running(): boolean; }