UNPKG

@dynatrace/js-runtime

Version:

This package provides the Dynatrace JavaScript runtime used by the [Dynatrace App Toolkit](https://www.npmjs.com/package/dt-app).

864 lines (863 loc) 50.5 kB
/** * This module is not supported by the Dynatrace JavaScript Runtime and only * exists for its referenced types. * See the `Node.js Compatibility` section for more information. * @see https://dt-url.net/runtime-apis */ // DT-disabled // /** // DT-disabled // * The `node:dns` module enables name resolution. For example, use it to look up IP // DT-disabled // * addresses of host names. // DT-disabled // * // DT-disabled // * Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the // DT-disabled // * DNS protocol for lookups. {@link lookup} uses the operating system // DT-disabled // * facilities to perform name resolution. It may not need to perform any network // DT-disabled // * communication. To perform name resolution the way other applications on the same // DT-disabled // * system do, use {@link lookup}. // DT-disabled // * // DT-disabled // * ```js // DT-disabled // * import dns from 'node:dns'; // DT-disabled // * // DT-disabled // * dns.lookup('example.org', (err, address, family) => { // DT-disabled // * console.log('address: %j family: IPv%s', address, family); // DT-disabled // * }); // DT-disabled // * // address: "93.184.216.34" family: IPv4 // DT-disabled // * ``` // DT-disabled // * // DT-disabled // * All other functions in the `node:dns` module connect to an actual DNS server to // DT-disabled // * perform name resolution. They will always use the network to perform DNS // DT-disabled // * queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform // DT-disabled // * DNS queries, bypassing other name-resolution facilities. // DT-disabled // * // DT-disabled // * ```js // DT-disabled // * import dns from 'node:dns'; // DT-disabled // * // DT-disabled // * dns.resolve4('archive.org', (err, addresses) => { // DT-disabled // * if (err) throw err; // DT-disabled // * // DT-disabled // * console.log(`addresses: ${JSON.stringify(addresses)}`); // DT-disabled // * // DT-disabled // * addresses.forEach((a) => { // DT-disabled // * dns.reverse(a, (err, hostnames) => { // DT-disabled // * if (err) { // DT-disabled // * throw err; // DT-disabled // * } // DT-disabled // * console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`); // DT-disabled // * }); // DT-disabled // * }); // DT-disabled // * }); // DT-disabled // * ``` // DT-disabled // * // DT-disabled // * See the [Implementation considerations section](https://nodejs.org/docs/latest-v22.x/api/dns.html#implementation-considerations) for more information. // DT-disabled // * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/dns.js) // DT-disabled // */ declare module "dns" { // DT-disabled // import * as dnsPromises from "node:dns/promises"; // DT-disabled // // Supported getaddrinfo flags. // DT-disabled // /** // DT-disabled // * Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are // DT-disabled // * only returned if the current system has at least one IPv4 address configured. // DT-disabled // */ // DT-disabled // export const ADDRCONFIG: number; // DT-disabled // /** // DT-disabled // * If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported // DT-disabled // * on some operating systems (e.g. FreeBSD 10.1). // DT-disabled // */ // DT-disabled // export const V4MAPPED: number; // DT-disabled // /** // DT-disabled // * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as // DT-disabled // * well as IPv4 mapped IPv6 addresses. // DT-disabled // */ // DT-disabled // export const ALL: number; export interface LookupOptions { /** * The record family. Must be `4`, `6`, or `0`. For backward compatibility reasons, `'IPv4'` and `'IPv6'` are interpreted * as `4` and `6` respectively. The value 0 indicates that either an IPv4 or IPv6 address is returned. If the value `0` is used * with `{ all: true } (see below)`, both IPv4 and IPv6 addresses are returned. * @default 0 */ family?: number | "IPv4" | "IPv6" | undefined; /** * One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v22.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be * passed by bitwise `OR`ing their values. */ hints?: number | undefined; /** * When `true`, the callback returns all resolved addresses in an array. Otherwise, returns a single address. * @default false */ all?: boolean | undefined; /** * When `verbatim`, the resolved addresses are return unsorted. When `ipv4first`, the resolved addresses are sorted * by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6 * addresses before IPv4 addresses. Default value is configurable using * {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--dns-result-orderorder). * @default `verbatim` (addresses are not reordered) * @since v22.1.0 */ order?: "ipv4first" | "ipv6first" | "verbatim" | undefined; /** * When `true`, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When `false`, IPv4 * addresses are placed before IPv6 addresses. This option will be deprecated in favor of `order`. When both are specified, * `order` has higher precedence. New code should only use `order`. Default value is configurable using {@link setDefaultResultOrder} * @default true (addresses are not reordered) * @deprecated Please use `order` option */ verbatim?: boolean | undefined; } export interface LookupOneOptions extends LookupOptions { all?: false | undefined; } export interface LookupAllOptions extends LookupOptions { all: true; } export interface LookupAddress { /** * A string representation of an IPv4 or IPv6 address. */ address: string; /** * `4` or `6`, denoting the family of `address`, or `0` if the address is not an IPv4 or IPv6 address. `0` is a likely indicator of a * bug in the name resolution service used by the operating system. */ family: number; } // DT-disabled // /** // DT-disabled // * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or // DT-disabled // * AAAA (IPv6) record. All `option` properties are optional. If `options` is an // DT-disabled // * integer, then it must be `4` or `6` – if `options` is `0` or not provided, then // DT-disabled // * IPv4 and IPv6 addresses are both returned if found. // DT-disabled // * // DT-disabled // * With the `all` option set to `true`, the arguments for `callback` change to `(err, addresses)`, with `addresses` being an array of objects with the // DT-disabled // * properties `address` and `family`. // DT-disabled // * // DT-disabled // * On error, `err` is an `Error` object, where `err.code` is the error code. // DT-disabled // * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when // DT-disabled // * the host name does not exist but also when the lookup fails in other ways // DT-disabled // * such as no available file descriptors. // DT-disabled // * // DT-disabled // * `dns.lookup()` does not necessarily have anything to do with the DNS protocol. // DT-disabled // * The implementation uses an operating system facility that can associate names // DT-disabled // * with addresses and vice versa. This implementation can have subtle but // DT-disabled // * important consequences on the behavior of any Node.js program. Please take some // DT-disabled // * time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v22.x/api/dns.html#implementation-considerations) // DT-disabled // * before using `dns.lookup()`. // DT-disabled // * // DT-disabled // * Example usage: // DT-disabled // * // DT-disabled // * ```js // DT-disabled // * import dns from 'node:dns'; // DT-disabled // * const options = { // DT-disabled // * family: 6, // DT-disabled // * hints: dns.ADDRCONFIG | dns.V4MAPPED, // DT-disabled // * }; // DT-disabled // * dns.lookup('example.com', options, (err, address, family) => // DT-disabled // * console.log('address: %j family: IPv%s', address, family)); // DT-disabled // * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6 // DT-disabled // * // DT-disabled // * // When options.all is true, the result will be an Array. // DT-disabled // * options.all = true; // DT-disabled // * dns.lookup('example.com', options, (err, addresses) => // DT-disabled // * console.log('addresses: %j', addresses)); // DT-disabled // * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}] // DT-disabled // * ``` // DT-disabled // * // DT-disabled // * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v22.x/api/util.html#utilpromisifyoriginal) ed // DT-disabled // * version, and `all` is not set to `true`, it returns a `Promise` for an `Object` with `address` and `family` properties. // DT-disabled // * @since v0.1.90 // DT-disabled // */ // DT-disabled // export function lookup( // DT-disabled // hostname: string, // DT-disabled // family: number, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, // DT-disabled // ): void; // DT-disabled // export function lookup( // DT-disabled // hostname: string, // DT-disabled // options: LookupOneOptions, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, // DT-disabled // ): void; // DT-disabled // export function lookup( // DT-disabled // hostname: string, // DT-disabled // options: LookupAllOptions, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void, // DT-disabled // ): void; // DT-disabled // export function lookup( // DT-disabled // hostname: string, // DT-disabled // options: LookupOptions, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void, // DT-disabled // ): void; // DT-disabled // export function lookup( // DT-disabled // hostname: string, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, // DT-disabled // ): void; // DT-disabled // export namespace lookup { // DT-disabled // function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>; // DT-disabled // function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>; // DT-disabled // function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>; // DT-disabled // } // DT-disabled // /** // DT-disabled // * Resolves the given `address` and `port` into a host name and service using // DT-disabled // * the operating system's underlying `getnameinfo` implementation. // DT-disabled // * // DT-disabled // * If `address` is not a valid IP address, a `TypeError` will be thrown. // DT-disabled // * The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown. // DT-disabled // * // DT-disabled // * On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object, // DT-disabled // * where `err.code` is the error code. // DT-disabled // * // DT-disabled // * ```js // DT-disabled // * import dns from 'node:dns'; // DT-disabled // * dns.lookupService('127.0.0.1', 22, (err, hostname, service) => { // DT-disabled // * console.log(hostname, service); // DT-disabled // * // Prints: localhost ssh // DT-disabled // * }); // DT-disabled // * ``` // DT-disabled // * // DT-disabled // * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v22.x/api/util.html#utilpromisifyoriginal) ed // DT-disabled // * version, it returns a `Promise` for an `Object` with `hostname` and `service` properties. // DT-disabled // * @since v0.11.14 // DT-disabled // */ // DT-disabled // export function lookupService( // DT-disabled // address: string, // DT-disabled // port: number, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void, // DT-disabled // ): void; // DT-disabled // export namespace lookupService { // DT-disabled // function __promisify__( // DT-disabled // address: string, // DT-disabled // port: number, // DT-disabled // ): Promise<{ // DT-disabled // hostname: string; // DT-disabled // service: string; // DT-disabled // }>; // DT-disabled // } // DT-disabled // export interface ResolveOptions { // DT-disabled // ttl: boolean; // DT-disabled // } // DT-disabled // export interface ResolveWithTtlOptions extends ResolveOptions { // DT-disabled // ttl: true; // DT-disabled // } // DT-disabled // export interface RecordWithTtl { // DT-disabled // address: string; // DT-disabled // ttl: number; // DT-disabled // } // DT-disabled // /** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */ // DT-disabled // export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord; // DT-disabled // export interface AnyARecord extends RecordWithTtl { // DT-disabled // type: "A"; // DT-disabled // } // DT-disabled // export interface AnyAaaaRecord extends RecordWithTtl { // DT-disabled // type: "AAAA"; // DT-disabled // } // DT-disabled // export interface CaaRecord { // DT-disabled // critical: number; // DT-disabled // issue?: string | undefined; // DT-disabled // issuewild?: string | undefined; // DT-disabled // iodef?: string | undefined; // DT-disabled // contactemail?: string | undefined; // DT-disabled // contactphone?: string | undefined; // DT-disabled // } // DT-disabled // export interface MxRecord { // DT-disabled // priority: number; // DT-disabled // exchange: string; // DT-disabled // } // DT-disabled // export interface AnyMxRecord extends MxRecord { // DT-disabled // type: "MX"; // DT-disabled // } // DT-disabled // export interface NaptrRecord { // DT-disabled // flags: string; // DT-disabled // service: string; // DT-disabled // regexp: string; // DT-disabled // replacement: string; // DT-disabled // order: number; // DT-disabled // preference: number; // DT-disabled // } // DT-disabled // export interface AnyNaptrRecord extends NaptrRecord { // DT-disabled // type: "NAPTR"; // DT-disabled // } // DT-disabled // export interface SoaRecord { // DT-disabled // nsname: string; // DT-disabled // hostmaster: string; // DT-disabled // serial: number; // DT-disabled // refresh: number; // DT-disabled // retry: number; // DT-disabled // expire: number; // DT-disabled // minttl: number; // DT-disabled // } // DT-disabled // export interface AnySoaRecord extends SoaRecord { // DT-disabled // type: "SOA"; // DT-disabled // } // DT-disabled // export interface SrvRecord { // DT-disabled // priority: number; // DT-disabled // weight: number; // DT-disabled // port: number; // DT-disabled // name: string; // DT-disabled // } // DT-disabled // export interface AnySrvRecord extends SrvRecord { // DT-disabled // type: "SRV"; // DT-disabled // } // DT-disabled // export interface AnyTxtRecord { // DT-disabled // type: "TXT"; // DT-disabled // entries: string[]; // DT-disabled // } // DT-disabled // export interface AnyNsRecord { // DT-disabled // type: "NS"; // DT-disabled // value: string; // DT-disabled // } // DT-disabled // export interface AnyPtrRecord { // DT-disabled // type: "PTR"; // DT-disabled // value: string; // DT-disabled // } // DT-disabled // export interface AnyCnameRecord { // DT-disabled // type: "CNAME"; // DT-disabled // value: string; // DT-disabled // } // DT-disabled // export type AnyRecord = // DT-disabled // | AnyARecord // DT-disabled // | AnyAaaaRecord // DT-disabled // | AnyCnameRecord // DT-disabled // | AnyMxRecord // DT-disabled // | AnyNaptrRecord // DT-disabled // | AnyNsRecord // DT-disabled // | AnyPtrRecord // DT-disabled // | AnySoaRecord // DT-disabled // | AnySrvRecord // DT-disabled // | AnyTxtRecord; // DT-disabled // /** // DT-disabled // * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array // DT-disabled // * of the resource records. The `callback` function has arguments `(err, records)`. When successful, `records` will be an array of resource // DT-disabled // * records. The type and structure of individual results varies based on `rrtype`: // DT-disabled // * // DT-disabled // * <omitted> // DT-disabled // * // DT-disabled // * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object, // DT-disabled // * where `err.code` is one of the `DNS error codes`. // DT-disabled // * @since v0.1.27 // DT-disabled // * @param hostname Host name to resolve. // DT-disabled // * @param [rrtype='A'] Resource record type. // DT-disabled // */ // DT-disabled // export function resolve( // DT-disabled // hostname: string, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, // DT-disabled // ): void; // DT-disabled // export function resolve( // DT-disabled // hostname: string, // DT-disabled // rrtype: "A", // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, // DT-disabled // ): void; // DT-disabled // export function resolve( // DT-disabled // hostname: string, // DT-disabled // rrtype: "AAAA", // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, // DT-disabled // ): void; // DT-disabled // export function resolve( // DT-disabled // hostname: string, // DT-disabled // rrtype: "ANY", // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void, // DT-disabled // ): void; // DT-disabled // export function resolve( // DT-disabled // hostname: string, // DT-disabled // rrtype: "CNAME", // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, // DT-disabled // ): void; // DT-disabled // export function resolve( // DT-disabled // hostname: string, // DT-disabled // rrtype: "MX", // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void, // DT-disabled // ): void; // DT-disabled // export function resolve( // DT-disabled // hostname: string, // DT-disabled // rrtype: "NAPTR", // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void, // DT-disabled // ): void; // DT-disabled // export function resolve( // DT-disabled // hostname: string, // DT-disabled // rrtype: "NS", // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, // DT-disabled // ): void; // DT-disabled // export function resolve( // DT-disabled // hostname: string, // DT-disabled // rrtype: "PTR", // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, // DT-disabled // ): void; // DT-disabled // export function resolve( // DT-disabled // hostname: string, // DT-disabled // rrtype: "SOA", // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void, // DT-disabled // ): void; // DT-disabled // export function resolve( // DT-disabled // hostname: string, // DT-disabled // rrtype: "SRV", // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void, // DT-disabled // ): void; // DT-disabled // export function resolve( // DT-disabled // hostname: string, // DT-disabled // rrtype: "TXT", // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void, // DT-disabled // ): void; // DT-disabled // export function resolve( // DT-disabled // hostname: string, // DT-disabled // rrtype: string, // DT-disabled // callback: ( // DT-disabled // err: NodeJS.ErrnoException | null, // DT-disabled // addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[], // DT-disabled // ) => void, // DT-disabled // ): void; // DT-disabled // export namespace resolve { // DT-disabled // function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>; // DT-disabled // function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>; // DT-disabled // function __promisify__(hostname: string, rrtype: "MX"): Promise<MxRecord[]>; // DT-disabled // function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>; // DT-disabled // function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>; // DT-disabled // function __promisify__(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>; // DT-disabled // function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>; // DT-disabled // function __promisify__( // DT-disabled // hostname: string, // DT-disabled // rrtype: string, // DT-disabled // ): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>; // DT-disabled // } // DT-disabled // /** // DT-disabled // * Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the `hostname`. The `addresses` argument passed to the `callback` function // DT-disabled // * will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`). // DT-disabled // * @since v0.1.16 // DT-disabled // * @param hostname Host name to resolve. // DT-disabled // */ // DT-disabled // export function resolve4( // DT-disabled // hostname: string, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, // DT-disabled // ): void; // DT-disabled // export function resolve4( // DT-disabled // hostname: string, // DT-disabled // options: ResolveWithTtlOptions, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void, // DT-disabled // ): void; // DT-disabled // export function resolve4( // DT-disabled // hostname: string, // DT-disabled // options: ResolveOptions, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void, // DT-disabled // ): void; // DT-disabled // export namespace resolve4 { // DT-disabled // function __promisify__(hostname: string): Promise<string[]>; // DT-disabled // function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>; // DT-disabled // function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>; // DT-disabled // } // DT-disabled // /** // DT-disabled // * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. The `addresses` argument passed to the `callback` function // DT-disabled // * will contain an array of IPv6 addresses. // DT-disabled // * @since v0.1.16 // DT-disabled // * @param hostname Host name to resolve. // DT-disabled // */ // DT-disabled // export function resolve6( // DT-disabled // hostname: string, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, // DT-disabled // ): void; // DT-disabled // export function resolve6( // DT-disabled // hostname: string, // DT-disabled // options: ResolveWithTtlOptions, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void, // DT-disabled // ): void; // DT-disabled // export function resolve6( // DT-disabled // hostname: string, // DT-disabled // options: ResolveOptions, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void, // DT-disabled // ): void; // DT-disabled // export namespace resolve6 { // DT-disabled // function __promisify__(hostname: string): Promise<string[]>; // DT-disabled // function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>; // DT-disabled // function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>; // DT-disabled // } // DT-disabled // /** // DT-disabled // * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The `addresses` argument passed to the `callback` function // DT-disabled // * will contain an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`). // DT-disabled // * @since v0.3.2 // DT-disabled // */ // DT-disabled // export function resolveCname( // DT-disabled // hostname: string, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, // DT-disabled // ): void; // DT-disabled // export namespace resolveCname { // DT-disabled // function __promisify__(hostname: string): Promise<string[]>; // DT-disabled // } // DT-disabled // /** // DT-disabled // * Uses the DNS protocol to resolve `CAA` records for the `hostname`. The `addresses` argument passed to the `callback` function // DT-disabled // * will contain an array of certification authority authorization records // DT-disabled // * available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`). // DT-disabled // * @since v15.0.0, v14.17.0 // DT-disabled // */ // DT-disabled // export function resolveCaa( // DT-disabled // hostname: string, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void, // DT-disabled // ): void; // DT-disabled // export namespace resolveCaa { // DT-disabled // function __promisify__(hostname: string): Promise<CaaRecord[]>; // DT-disabled // } // DT-disabled // /** // DT-disabled // * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. The `addresses` argument passed to the `callback` function will // DT-disabled // * contain an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`). // DT-disabled // * @since v0.1.27 // DT-disabled // */ // DT-disabled // export function resolveMx( // DT-disabled // hostname: string, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void, // DT-disabled // ): void; // DT-disabled // export namespace resolveMx { // DT-disabled // function __promisify__(hostname: string): Promise<MxRecord[]>; // DT-disabled // } // DT-disabled // /** // DT-disabled // * Uses the DNS protocol to resolve regular expression-based records (`NAPTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will contain an array of // DT-disabled // * objects with the following properties: // DT-disabled // * // DT-disabled // * * `flags` // DT-disabled // * * `service` // DT-disabled // * * `regexp` // DT-disabled // * * `replacement` // DT-disabled // * * `order` // DT-disabled // * * `preference` // DT-disabled // * // DT-disabled // * ```js // DT-disabled // * { // DT-disabled // * flags: 's', // DT-disabled // * service: 'SIP+D2U', // DT-disabled // * regexp: '', // DT-disabled // * replacement: '_sip._udp.example.com', // DT-disabled // * order: 30, // DT-disabled // * preference: 100 // DT-disabled // * } // DT-disabled // * ``` // DT-disabled // * @since v0.9.12 // DT-disabled // */ // DT-disabled // export function resolveNaptr( // DT-disabled // hostname: string, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void, // DT-disabled // ): void; // DT-disabled // export namespace resolveNaptr { // DT-disabled // function __promisify__(hostname: string): Promise<NaptrRecord[]>; // DT-disabled // } // DT-disabled // /** // DT-disabled // * Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. The `addresses` argument passed to the `callback` function will // DT-disabled // * contain an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`). // DT-disabled // * @since v0.1.90 // DT-disabled // */ // DT-disabled // export function resolveNs( // DT-disabled // hostname: string, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, // DT-disabled // ): void; // DT-disabled // export namespace resolveNs { // DT-disabled // function __promisify__(hostname: string): Promise<string[]>; // DT-disabled // } // DT-disabled // /** // DT-disabled // * Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will // DT-disabled // * be an array of strings containing the reply records. // DT-disabled // * @since v6.0.0 // DT-disabled // */ // DT-disabled // export function resolvePtr( // DT-disabled // hostname: string, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, // DT-disabled // ): void; // DT-disabled // export namespace resolvePtr { // DT-disabled // function __promisify__(hostname: string): Promise<string[]>; // DT-disabled // } // DT-disabled // /** // DT-disabled // * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for // DT-disabled // * the `hostname`. The `address` argument passed to the `callback` function will // DT-disabled // * be an object with the following properties: // DT-disabled // * // DT-disabled // * * `nsname` // DT-disabled // * * `hostmaster` // DT-disabled // * * `serial` // DT-disabled // * * `refresh` // DT-disabled // * * `retry` // DT-disabled // * * `expire` // DT-disabled // * * `minttl` // DT-disabled // * // DT-disabled // * ```js // DT-disabled // * { // DT-disabled // * nsname: 'ns.example.com', // DT-disabled // * hostmaster: 'root.example.com', // DT-disabled // * serial: 2013101809, // DT-disabled // * refresh: 10000, // DT-disabled // * retry: 2400, // DT-disabled // * expire: 604800, // DT-disabled // * minttl: 3600 // DT-disabled // * } // DT-disabled // * ``` // DT-disabled // * @since v0.11.10 // DT-disabled // */ // DT-disabled // export function resolveSoa( // DT-disabled // hostname: string, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void, // DT-disabled // ): void; // DT-disabled // export namespace resolveSoa { // DT-disabled // function __promisify__(hostname: string): Promise<SoaRecord>; // DT-disabled // } // DT-disabled // /** // DT-disabled // * Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. The `addresses` argument passed to the `callback` function will // DT-disabled // * be an array of objects with the following properties: // DT-disabled // * // DT-disabled // * * `priority` // DT-disabled // * * `weight` // DT-disabled // * * `port` // DT-disabled // * * `name` // DT-disabled // * // DT-disabled // * ```js // DT-disabled // * { // DT-disabled // * priority: 10, // DT-disabled // * weight: 5, // DT-disabled // * port: 21223, // DT-disabled // * name: 'service.example.com' // DT-disabled // * } // DT-disabled // * ``` // DT-disabled // * @since v0.1.27 // DT-disabled // */ // DT-disabled // export function resolveSrv( // DT-disabled // hostname: string, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void, // DT-disabled // ): void; // DT-disabled // export namespace resolveSrv { // DT-disabled // function __promisify__(hostname: string): Promise<SrvRecord[]>; // DT-disabled // } // DT-disabled // /** // DT-disabled // * Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. The `records` argument passed to the `callback` function is a // DT-disabled // * two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of // DT-disabled // * one record. Depending on the use case, these could be either joined together or // DT-disabled // * treated separately. // DT-disabled // * @since v0.1.27 // DT-disabled // */ // DT-disabled // export function resolveTxt( // DT-disabled // hostname: string, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void, // DT-disabled // ): void; // DT-disabled // export namespace resolveTxt { // DT-disabled // function __promisify__(hostname: string): Promise<string[][]>; // DT-disabled // } // DT-disabled // /** // DT-disabled // * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). // DT-disabled // * The `ret` argument passed to the `callback` function will be an array containing // DT-disabled // * various types of records. Each object has a property `type` that indicates the // DT-disabled // * type of the current record. And depending on the `type`, additional properties // DT-disabled // * will be present on the object: // DT-disabled // * // DT-disabled // * <omitted> // DT-disabled // * // DT-disabled // * Here is an example of the `ret` object passed to the callback: // DT-disabled // * // DT-disabled // * ```js // DT-disabled // * [ { type: 'A', address: '127.0.0.1', ttl: 299 }, // DT-disabled // * { type: 'CNAME', value: 'example.com' }, // DT-disabled // * { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, // DT-disabled // * { type: 'NS', value: 'ns1.example.com' }, // DT-disabled // * { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, // DT-disabled // * { type: 'SOA', // DT-disabled // * nsname: 'ns1.example.com', // DT-disabled // * hostmaster: 'admin.example.com', // DT-disabled // * serial: 156696742, // DT-disabled // * refresh: 900, // DT-disabled // * retry: 900, // DT-disabled // * expire: 1800, // DT-disabled // * minttl: 60 } ] // DT-disabled // * ``` // DT-disabled // * // DT-disabled // * DNS server operators may choose not to respond to `ANY` queries. It may be better to call individual methods like {@link resolve4}, {@link resolveMx}, and so on. For more details, see // DT-disabled // * [RFC 8482](https://tools.ietf.org/html/rfc8482). // DT-disabled // */ // DT-disabled // export function resolveAny( // DT-disabled // hostname: string, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void, // DT-disabled // ): void; // DT-disabled // export namespace resolveAny { // DT-disabled // function __promisify__(hostname: string): Promise<AnyRecord[]>; // DT-disabled // } // DT-disabled // /** // DT-disabled // * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an // DT-disabled // * array of host names. // DT-disabled // * // DT-disabled // * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object, where `err.code` is // DT-disabled // * one of the [DNS error codes](https://nodejs.org/docs/latest-v22.x/api/dns.html#error-codes). // DT-disabled // * @since v0.1.16 // DT-disabled // */ // DT-disabled // export function reverse( // DT-disabled // ip: string, // DT-disabled // callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void, // DT-disabled // ): void; // DT-disabled // /** // DT-disabled // * Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnspromiseslookuphostname-options). // DT-disabled // * The value could be: // DT-disabled // * // DT-disabled // * * `ipv4first`: for `order` defaulting to `ipv4first`. // DT-disabled // * * `ipv6first`: for `order` defaulting to `ipv6first`. // DT-disabled // * * `verbatim`: for `order` defaulting to `verbatim`. // DT-disabled // * @since v18.17.0 // DT-disabled // */ // DT-disabled // export function getDefaultResultOrder(): "ipv4first" | "ipv6first" | "verbatim"; // DT-disabled // /** // DT-disabled // * Sets the IP address and port of servers to be used when performing DNS // DT-disabled // * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted // DT-disabled // * addresses. If the port is the IANA default DNS port (53) it can be omitted. // DT-disabled // * // DT-disabled // * ```js // DT-disabled // * dns.setServers([ // DT-disabled // * '4.4.4.4', // DT-disabled // * '[2001:4860:4860::8888]', // DT-disabled // * '4.4.4.4:1053', // DT-disabled // * '[2001:4860:4860::8888]:1053', // DT-disabled // * ]); // DT-disabled // * ``` // DT-disabled // * // DT-disabled // * An error will be thrown if an invalid address is provided. // DT-disabled // * // DT-disabled // * The `dns.setServers()` method must not be called while a DNS query is in // DT-disabled // * progress. // DT-disabled // * // DT-disabled // * The {@link setServers} method affects only {@link resolve}, `dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}). // DT-disabled // * // DT-disabled // * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html). // DT-disabled // * That is, if attempting to resolve with the first server provided results in a `NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with // DT-disabled // * subsequent servers provided. Fallback DNS servers will only be used if the // DT-disabled // * earlier ones time out or result in some other error. // DT-disabled // * @since v0.11.3 // DT-disabled // * @param servers array of [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952#section-6) formatted addresses // DT-disabled // */ // DT-disabled // export function setServers(servers: readonly string[]): void; // DT-disabled // /** // DT-disabled // * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6), // DT-disabled // * that are currently configured for DNS resolution. A string will include a port // DT-disabled // * section if a custom port is used. // DT-disabled // * // DT-disabled // * ```js // DT-disabled // * [ // DT-disabled // * '4.4.4.4', // DT-disabled // * '2001:4860:4860::8888', // DT-disabled // * '4.4.4.4:1053', // DT-disabled // * '[2001:4860:4860::8888]:1053', // DT-disabled // * ] // DT-disabled // * ``` // DT-disabled // * @since v0.11.3 // DT-disabled // */ // DT-disabled // export function getServers(): string[]; // DT-disabled // /** // DT-disabled // * Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnspromiseslookuphostname-options). // DT-disabled // * The value could be: // DT-disabled // * // DT-disabled // * * `ipv4first`: sets default `order` to `ipv4first`. // DT-disabled // * * `ipv6first`: sets default `order` to `ipv6first`. // DT-disabled // * * `verbatim`: sets default `order` to `verbatim`. // DT-disabled // * // DT-disabled // * The default is `verbatim` and {@link setDefaultResultOrder} have higher // DT-disabled // * priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--dns-result-orderorder). When using // DT-disabled // * [worker threads](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main // DT-disabled // * thread won't affect the default dns orders in workers. // DT-disabled // * @since v16.4.0, v14.18.0 // DT-disabled // * @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`. // DT-disabled // */ // DT-disabled // export function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void; // DT-disabled // // Error codes // DT-disabled // export const NODATA: "ENODATA"; // DT-disabled // export const FORMERR: "EFORMERR"; // DT-disabled // export const SERVFAIL: "ESERVFAIL"; // DT-disabled // export const NOTFOUND: "ENOTFOUND"; // DT-disabled // export const NOTIMP: "ENOTIMP"; // DT-disabled // export const REFUSED: "EREFUSED"; // DT-disabled // export const BADQUERY: "EBADQUERY"; // DT-disabled // export const BADNAME: "EBADNAME"; // DT-disabled // export const BADFAMILY: "EBADFAMILY"; // DT-disabled // export const BADRESP: "EBADRESP"; // DT-disabled // export const CONNREFUSED: "ECONNREFUSED"; // DT-disabled // export const TIMEOUT: "ETIMEOUT"; // DT-disabled // export const EOF: "EOF"; // DT-disabled // export const FILE: "EFILE"; // DT-disabled // export const NOMEM: "ENOMEM"; // DT-disabled // export const DESTRUCTION: "EDESTRUCTION"; // DT-disabled // export const BADSTR: "EBADSTR"; // DT-disabled // export const BADFLAGS: "EBADFLAGS"; // DT-disabled // export const NONAME: "ENONAME"; // DT-disabled // export const BADHINTS: "EBADHINTS"; // DT-disabled // export const NOTINITIALIZED: "ENOTINITIALIZED"; // DT-disabled // export const LOADIPHLPAPI: "ELOADIPHLPAPI"; // DT-disabled // export const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS"; // DT-disabled // export const CANCELLED: "ECANCELLED"; // DT-disabled // export interface ResolverOptions { // DT-disabled // /** // DT-disabled // * Query timeout in milliseconds, or `-1` to use the default timeout. // DT-disabled // */ // DT-disabled // timeout?: number | undefined; // DT-disabled // /** // DT-disabled // * The number of tries the resolver will try contacting each name server before giving up. // DT-disabled // * @default 4 // DT-disabled // */ // DT-disabled // tries?: number; // DT-disabled // } // DT-disabled // /** // DT-disabled // * An independent resolver for DNS requests. // DT-disabled // * // DT-disabled // * Creating a new resolver uses the default server settings. Setting // DT-disabled // * the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnssetserversservers) does not affect // DT-disabled // * other resolvers: // DT-disabled // * // DT-disabled // * ```js // DT-disabled // * import { Resolver } from 'node:dns'; // DT-disabled // * const resolver = new Resolver(); // DT-disabled // * resolver.setServers(['4.4.4.4']); // DT-disabled // * // DT-disabled // * // This request will use the server at 4.4.4.4, independent of global settings. // DT-disabled // * resolver.resolve4('example.org', (err, addresses) => { // DT-disabled // * // ... // DT-disabled // * }); // DT-disabled // * ``` // DT-disabled // * // DT-disabled // * The following methods from the `node:dns` module are available: // DT-disabled // * // DT-disabled // * * `resolver.getServers()` // DT-disabled // * * `resolver.resolve()` // DT-disabled // * * `resolver.resolve4()` // DT-disabled // * * `resolver.resolve6()` // DT-disabled // * * `resolver.resolveAny()` // DT-disabled // * * `resolver.resolveCaa()` // DT-disabled // * * `resolver.resolveCname()` // DT-disabled // * * `resolver.resolveMx()` // DT-disabled // * * `resolver.resolveNaptr()` // DT-disabled // * * `resolver.resolveNs()` // DT-disabled // * * `resolver.resolvePtr()` // DT-disabled // * * `resolver.resolveSoa()` // DT-disabled // * * `resolver.resolveSrv()` // DT-disabled // * * `resolver.resolveTxt()` // DT-disabled // * * `resolver.reverse()` // DT-disabled // * * `resolver.setServers()` // DT-disabled // * @since v8.3.0 // DT-disabled // */ // DT-disabled // export class Resolver { // DT-disabled // constructor(options?: ResolverOptions); // DT-disabled // /** // DT-disabled // * Cancel all outstanding DNS queries made by this resolver. The corresponding // DT-disabled // * callbacks will be called with an error with code `ECANCELLED`. // DT-disabled // * @since v8.3.0 // DT-disabled // */ // DT-disabled // cancel(): void; // DT-disabled // getServers: typeof getServers; // DT-disabled // resolve: typeof resolve; // DT-disabled // resolve4: typeof resolve4; // DT-disabled // resolve6: typeof resolve6; // DT-disabled // resolveAny: typeof resolveAny; // DT-disabled // resolveCaa: typeof resolveCaa; // DT-disabled // resolveCname: typeof resolveCname; // DT-disabled // resolveMx: typeof resolveMx; // DT-disabled // resolveNaptr: typeof resolveNaptr; // DT-disabled // resolveNs: typeof resolveNs; // DT-disabled // resolvePtr: typeof resolvePtr; // DT-disabled // resolveSoa: typeof resolveSoa; // DT-disabled // resolveSrv: typeof resolveSrv; // DT-disabled // resolveTxt: typeof resolveTxt; // DT-disabled // reverse: typeof reverse; // DT-disabled // /** // DT-disabled // * The resolver instance will send its requests from the specified IP address. // DT-disabled // * This allows programs to specify outbound interfaces when used on multi-homed // DT-disabled // * systems. // DT-disabled // * // DT-disabled // * If a v4 or v6 address is not specified, it is set to the default and the // DT-disabled // * operating system will choose a local address automatically. // DT-disabled // * // DT-disabled // * The resolver will use the v4 local address when making requests to IPv4 DNS // DT-disabled // * servers, and the v6 local address when making requests to IPv6 DNS servers. // DT-disabled // * The `rrtype` of resolution requests has no impact on the local address used. // DT-disabled // * @since v15.1.0, v14.17.0 // DT-disabled // * @param [ipv4='0.0.0.0'] A string representation of an IPv4 address. // DT-disabled // * @param [ipv6='::0'] A string representation of an IPv6 address. // DT-disabl