@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.
57 lines (56 loc) • 2.36 kB
TypeScript
import * as plugins from './plugins.js';
export type TDnsProvider = 'google' | 'cloudflare';
export declare const makeNodeProcessUseDnsProvider: (providerArg: TDnsProvider) => void;
export type TResolutionStrategy = 'doh' | 'udp' | 'system' | 'prefer-system' | 'prefer-udp';
export interface ISmartDnsConstructorOptions {
strategy?: TResolutionStrategy;
allowDohFallback?: boolean;
timeoutMs?: number;
}
/**
* Smartdns offers methods for working with DNS resolution.
* Supports system resolver, UDP wire-format, and DoH (DNS-over-HTTPS) via a Rust binary.
*/
export declare class Smartdns {
private strategy;
private allowDohFallback;
private timeoutMs;
private rustBridge;
dnsTypeMap: {
[key: string]: number;
};
constructor(optionsArg: ISmartDnsConstructorOptions);
private getRustBridge;
/**
* check a dns record until it has propagated
*/
checkUntilAvailable(recordNameArg: string, recordTypeArg: plugins.tsclass.network.TDnsRecordType, expectedValue: string, cyclesArg?: number, intervalArg?: number): Promise<boolean>;
/**
* get A Dns Record
*/
getRecordsA(recordNameArg: string): Promise<plugins.tsclass.network.IDnsRecord[]>;
/**
* get AAAA Record
*/
getRecordsAAAA(recordNameArg: string): Promise<plugins.tsclass.network.IDnsRecord[]>;
/**
* gets a txt record
*/
getRecordsTxt(recordNameArg: string): Promise<plugins.tsclass.network.IDnsRecord[]>;
getRecords(recordNameArg: string, recordTypeArg: plugins.tsclass.network.TDnsRecordType, retriesCounterArg?: number): Promise<plugins.tsclass.network.IDnsRecord[]>;
/**
* gets a record using nodejs dns resolver
*/
getRecordWithNodeDNS(recordNameArg: string, recordTypeArg: plugins.tsclass.network.TDnsRecordType): Promise<plugins.tsclass.network.IDnsRecord[]>;
getNameServers(domainNameArg: string): Promise<string[]>;
convertDnsTypeNameToTypeNumber(dnsTypeNameArg: string): number;
convertDnsTypeNumberToTypeName(dnsTypeNumberArg: number): plugins.tsclass.network.TDnsRecordType | null;
/**
* Convert a DNS type string from Rust (e.g. "A", "AAAA") to the canonical TDnsRecordType.
*/
private convertDnsTypeNameToCanonical;
/**
* Destroy the Rust client bridge and free resources.
*/
destroy(): void;
}