{"$schema":"https://doc-kit.nodejs.org/schemas/api-doc/1.0.0.json","id":"dns","path":"/dns","type":"module","module":"dns","title":"DNS","introducedIn":"v0.10.0","sourceLink":{"path":"lib/dns.js","url":"https://github.com/nodejs/node/blob/HEAD/lib/dns.js"},"stability":{"index":"2","description":"Stable"},"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The `node:dns` module enables name resolution. For example, use it to look up IP\naddresses of host names.\n\nAlthough named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the\nDNS protocol for lookups. [`dns.lookup()`](#dnslookuphostname-options-callback) uses the operating system\nfacilities to perform name resolution. It may not need to perform any network\ncommunication. To perform name resolution the way other applications on the same\nsystem do, use [`dns.lookup()`](#dnslookuphostname-options-callback).\n\n```mjs\nimport dns from 'node:dns';\n\ndns.lookup('example.org', (err, address, family) => {\n  console.log('address: %j family: IPv%s', address, family);\n});\n// address: \"2606:2800:21f:cb07:6820:80da:af6b:8b2c\" family: IPv6\n```\n\n```cjs\nconst dns = require('node:dns');\n\ndns.lookup('example.org', (err, address, family) => {\n  console.log('address: %j family: IPv%s', address, family);\n});\n// address: \"2606:2800:21f:cb07:6820:80da:af6b:8b2c\" family: IPv6\n```\n\nAll other functions in the `node:dns` module connect to an actual DNS server to\nperform name resolution. They will always use the network to perform DNS\nqueries. These functions do not use the same set of configuration files used by\n[`dns.lookup()`](#dnslookuphostname-options-callback) (e.g. `/etc/hosts`). Use these functions to always perform\nDNS queries, bypassing other name-resolution facilities.\n\n```mjs\nimport dns from 'node:dns';\n\ndns.resolve4('archive.org', (err, addresses) => {\n  if (err) throw err;\n\n  console.log(`addresses: ${JSON.stringify(addresses)}`);\n\n  addresses.forEach((a) => {\n    dns.reverse(a, (err, hostnames) => {\n      if (err) {\n        throw err;\n      }\n      console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);\n    });\n  });\n});\n```\n\n```cjs\nconst dns = require('node:dns');\n\ndns.resolve4('archive.org', (err, addresses) => {\n  if (err) throw err;\n\n  console.log(`addresses: ${JSON.stringify(addresses)}`);\n\n  addresses.forEach((a) => {\n    dns.reverse(a, (err, hostnames) => {\n      if (err) {\n        throw err;\n      }\n      console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);\n    });\n  });\n});\n```\n\nSee the [Implementation considerations section](#implementation-considerations) for more information.","summary":"The `node:dns` module enables name resolution. For example, use it to look up IP addresses of host names.","examples":[{"language":"mjs","displayName":null,"code":"import dns from 'node:dns';\n\ndns.lookup('example.org', (err, address, family) => {\n  console.log('address: %j family: IPv%s', address, family);\n});\n// address: \"2606:2800:21f:cb07:6820:80da:af6b:8b2c\" family: IPv6"},{"language":"cjs","displayName":null,"code":"const dns = require('node:dns');\n\ndns.lookup('example.org', (err, address, family) => {\n  console.log('address: %j family: IPv%s', address, family);\n});\n// address: \"2606:2800:21f:cb07:6820:80da:af6b:8b2c\" family: IPv6"},{"language":"mjs","displayName":null,"code":"import dns from 'node:dns';\n\ndns.resolve4('archive.org', (err, addresses) => {\n  if (err) throw err;\n\n  console.log(`addresses: ${JSON.stringify(addresses)}`);\n\n  addresses.forEach((a) => {\n    dns.reverse(a, (err, hostnames) => {\n      if (err) {\n        throw err;\n      }\n      console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);\n    });\n  });\n});"},{"language":"cjs","displayName":null,"code":"const dns = require('node:dns');\n\ndns.resolve4('archive.org', (err, addresses) => {\n  if (err) throw err;\n\n  console.log(`addresses: ${JSON.stringify(addresses)}`);\n\n  addresses.forEach((a) => {\n    dns.reverse(a, (err, hostnames) => {\n      if (err) {\n        throw err;\n      }\n      console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);\n    });\n  });\n});"}],"children":[{"kind":"class","id":"class-dnsresolver","name":"Resolver","title":"Class: `dns.Resolver`","scope":"module","overloadOf":null,"stability":null,"added":["v8.3.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"An independent resolver for DNS requests.\n\nCreating a new resolver uses the default server settings. Setting\nthe servers used for a resolver using\n[`resolver.setServers()`](#dnssetserversservers) does not affect\nother resolvers:\n\n```mjs\nimport { Resolver } from 'node:dns';\nconst resolver = new Resolver();\nresolver.setServers(['4.4.4.4']);\n\n// This request will use the server at 4.4.4.4, independent of global settings.\nresolver.resolve4('example.org', (err, addresses) => {\n  // ...\n});\n```\n\n```cjs\nconst { Resolver } = require('node:dns');\nconst resolver = new Resolver();\nresolver.setServers(['4.4.4.4']);\n\n// This request will use the server at 4.4.4.4, independent of global settings.\nresolver.resolve4('example.org', (err, addresses) => {\n  // ...\n});\n```\n\nThe following methods from the `node:dns` module are available:\n\n* [`resolver.getServers()`](#dnsgetservers)\n* [`resolver.resolve()`](#dnsresolvehostname-rrtype-callback)\n* [`resolver.resolve4()`](#dnsresolve4hostname-options-callback)\n* [`resolver.resolve6()`](#dnsresolve6hostname-options-callback)\n* [`resolver.resolveAny()`](#dnsresolveanyhostname-callback)\n* [`resolver.resolveCaa()`](#dnsresolvecaahostname-callback)\n* [`resolver.resolveCname()`](#dnsresolvecnamehostname-callback)\n* [`resolver.resolveMx()`](#dnsresolvemxhostname-callback)\n* [`resolver.resolveNaptr()`](#dnsresolvenaptrhostname-callback)\n* [`resolver.resolveNs()`](#dnsresolvenshostname-callback)\n* [`resolver.resolvePtr()`](#dnsresolveptrhostname-callback)\n* [`resolver.resolveSoa()`](#dnsresolvesoahostname-callback)\n* [`resolver.resolveSrv()`](#dnsresolvesrvhostname-callback)\n* [`resolver.resolveTlsa()`](#dnsresolvetlsahostname-callback)\n* [`resolver.resolveTxt()`](#dnsresolvetxthostname-callback)\n* [`resolver.reverse()`](#dnsreverseip-callback)\n* [`resolver.setServers()`](#dnssetserversservers)","summary":"An independent resolver for DNS requests.","examples":[{"language":"mjs","displayName":null,"code":"import { Resolver } from 'node:dns';\nconst resolver = new Resolver();\nresolver.setServers(['4.4.4.4']);\n\n// This request will use the server at 4.4.4.4, independent of global settings.\nresolver.resolve4('example.org', (err, addresses) => {\n  // ...\n});"},{"language":"cjs","displayName":null,"code":"const { Resolver } = require('node:dns');\nconst resolver = new Resolver();\nresolver.setServers(['4.4.4.4']);\n\n// This request will use the server at 4.4.4.4, independent of global settings.\nresolver.resolve4('example.org', (err, addresses) => {\n  // ...\n});"}],"children":[{"kind":"method","id":"resolveroptions","name":"Resolver","title":"`Resolver([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v8.3.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v16.7.0","v14.18.0"],"prUrl":"https://github.com/nodejs/node/pull/39610","commit":null,"description":"The `options` object now accepts a `tries` option."},{"versions":["v12.18.3"],"prUrl":"https://github.com/nodejs/node/pull/33472","commit":null,"description":"The constructor now accepts an `options` object. The single supported option is `timeout`."}],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"timeout","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"Query timeout in milliseconds, or `-1` to use the\ndefault timeout.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"tries","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"The number of tries the resolver will try contacting\neach name server before giving up.","default":"4","optional":true,"rest":false,"properties":[]},{"name":"maxTimeout","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"The max retry timeout, in milliseconds.","default":"`0`, disabled","optional":true,"rest":false,"properties":[]}]}],"returns":null},"description":"Create a new resolver.","summary":"Create a new resolver.","examples":[],"children":[]},{"kind":"method","id":"resolvercancel","name":"cancel","title":"`resolver.cancel()`","scope":"module","overloadOf":null,"stability":null,"added":["v8.3.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Cancel all outstanding DNS queries made by this resolver. The corresponding\ncallbacks will be called with an error with code `ECANCELLED`.","summary":"Cancel all outstanding DNS queries made by this resolver. The corresponding callbacks will be called with an error with code `ECANCELLED`.","examples":[],"children":[]},{"kind":"method","id":"resolversetlocaladdressipv4-ipv6","name":"setLocalAddress","title":"`resolver.setLocalAddress([ipv4][, ipv6])`","scope":"module","overloadOf":null,"stability":null,"added":["v15.1.0","v14.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"ipv4","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A string representation of an IPv4 address.","default":"'0.0.0.0'","optional":true,"rest":false,"properties":[]},{"name":"ipv6","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A string representation of an IPv6 address.","default":"'::0'","optional":true,"rest":false,"properties":[]}],"returns":null},"description":"The resolver instance will send its requests from the specified IP address.\nThis allows programs to specify outbound interfaces when used on multi-homed\nsystems.\n\nIf a v4 or v6 address is not specified, it is set to the default and the\noperating system will choose a local address automatically.\n\nThe resolver will use the v4 local address when making requests to IPv4 DNS\nservers, and the v6 local address when making requests to IPv6 DNS servers.\nThe `rrtype` of resolution requests has no impact on the local address used.","summary":"The resolver instance will send its requests from the specified IP address. This allows programs to specify outbound interfaces when used on multi-homed systems.","examples":[],"children":[]}]},{"kind":"method","id":"dnsgetservers","name":"getServers","title":"`dns.getServers()`","scope":"module","overloadOf":null,"stability":null,"added":["v0.11.3"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":""}},"description":"Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),\nthat are currently configured for DNS resolution. A string will include a port\nsection if a custom port is used.\n\n```json\n[\n  \"8.8.8.8\",\n  \"2001:4860:4860::8888\",\n  \"8.8.8.8:1053\",\n  \"[2001:4860:4860::8888]:1053\",\n]\n```","summary":"Returns an array of IP address strings, formatted according to RFC 5952, that are currently configured for DNS resolution. A string will include a port section if a custom port is used.","examples":[{"language":"json","displayName":null,"code":"[\n  \"8.8.8.8\",\n  \"2001:4860:4860::8888\",\n  \"8.8.8.8:1053\",\n  \"[2001:4860:4860::8888]:1053\",\n]"}],"children":[]},{"kind":"method","id":"dnslookuphostname-options-callback","name":"lookup","title":"`dns.lookup(hostname[, options], callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.90"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v22.1.0","v20.13.0"],"prUrl":"https://github.com/nodejs/node/pull/52492","commit":null,"description":"The `verbatim` option is now deprecated in favor of the new `order` option."},{"versions":["v18.4.0"],"prUrl":"https://github.com/nodejs/node/pull/43054","commit":null,"description":"For compatibility with `node:net`, when passing an option object the `family` option can be the string `'IPv4'` or the string `'IPv6'`."},{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."},{"versions":["v17.0.0"],"prUrl":"https://github.com/nodejs/node/pull/39987","commit":null,"description":"The `verbatim` options defaults to `true` now."},{"versions":["v8.5.0"],"prUrl":"https://github.com/nodejs/node/pull/14731","commit":null,"description":"The `verbatim` option is supported now."},{"versions":["v1.2.0"],"prUrl":"https://github.com/nodejs/node/pull/744","commit":null,"description":"The `all` option is supported now."}],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"integer | Object","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":10,"end":16}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"family","type":{"text":"integer | string","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":10,"end":16}]},"description":"The record family. Must be `4`, `6`, or `0`. For\nbackward compatibility reasons,`'IPv4'` and `'IPv6'` are interpreted as `4`\nand `6` respectively. The value `0` indicates that either an IPv4 or IPv6\naddress is returned. If the value `0` is used with `{ all: true }` (see\nbelow), either one of or both IPv4 and IPv6 addresses are returned,\ndepending on the system's DNS resolver.","default":"0","optional":true,"rest":false,"properties":[]},{"name":"hints","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"One or more [supported `getaddrinfo` flags](#supported-getaddrinfo-flags). Multiple\nflags may be passed by bitwise `OR`ing their values.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"all","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"When `true`, the callback returns all resolved addresses in\nan array. Otherwise, returns a single address.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"order","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"When `verbatim`, the resolved addresses are returned\nunsorted. When `ipv4first`, the resolved addresses are sorted by placing\nIPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved\naddresses are sorted by placing IPv6 addresses before IPv4 addresses.","default":"verbatim` (addresses are not reordered). Default value is configurable using `dns.setDefaultResultOrder()` or `--dns-result-order","optional":true,"rest":false,"properties":[]},{"name":"verbatim","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"When `true`, the callback receives IPv4 and IPv6\naddresses in the order the DNS resolver returned them. When `false`,\nIPv4 addresses are placed before IPv6 addresses.\nThis option will be deprecated in favor of `order`. When both are specified,\n`order` has higher precedence. New code should only use `order`.","default":"true` (addresses are not reordered). Default value is configurable using `dns.setDefaultResultOrder()` or `--dns-result-order","optional":true,"rest":false,"properties":[]}]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"address","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A string representation of an IPv4 or IPv6 address.\nNot provided when `options.all` is `true`.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"family","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"`4` or `6`, denoting the family of `address`, or `0` if\nthe address is not an IPv4 or IPv6 address. `0` is a likely indicator of a\nbug in the name resolution service used by the operating system.\nNot provided when `options.all` is `true`.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"addresses","type":{"text":"Object[]","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"An array of address objects when `options.all` is\n`true`. Each object has the following properties:","default":null,"optional":false,"rest":false,"properties":[{"name":"address","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A string representation of an IPv4 or IPv6 address.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"family","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"`4` or `6`, denoting the family of `address`.","default":null,"optional":false,"rest":false,"properties":[]}]}]}],"returns":null},"description":"Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or\nAAAA (IPv6) record. All `option` properties are optional. If `options` is an\ninteger, then it must be `4` or `6` – if `options` is not provided, then\neither IPv4 or IPv6 addresses, or both, are returned if found.\n\nWith the `all` option set to `true`, the arguments for `callback` change to\n`(err, addresses)`, with `addresses` being an array of objects with the\nproperties `address` and `family`.\n\nOn error, `err` is an [`Error`](errors.html#class-error) object, where `err.code` is the error code.\nKeep in mind that `err.code` will be set to `'ENOTFOUND'` not only when\nthe host name does not exist but also when the lookup fails in other ways\nsuch as no available file descriptors.\n\n`dns.lookup()` does not necessarily have anything to do with the DNS protocol.\nThe implementation uses an operating system facility that can associate names\nwith addresses and vice versa. This implementation can have subtle but\nimportant consequences on the behavior of any Node.js program. Please take some\ntime to consult the [Implementation considerations section](#implementation-considerations) before using\n`dns.lookup()`.\n\nExample usage:\n\n```mjs\nimport dns from 'node:dns';\nconst options = {\n  family: 6,\n  hints: dns.ADDRCONFIG | dns.V4MAPPED,\n};\ndns.lookup('example.org', options, (err, address, family) =>\n  console.log('address: %j family: IPv%s', address, family));\n// address: \"2606:2800:21f:cb07:6820:80da:af6b:8b2c\" family: IPv6\n\n// When options.all is true, the result will be an Array.\noptions.all = true;\ndns.lookup('example.org', options, (err, addresses) =>\n  console.log('addresses: %j', addresses));\n// addresses: [{\"address\":\"2606:2800:21f:cb07:6820:80da:af6b:8b2c\",\"family\":6}]\n```\n\n```cjs\nconst dns = require('node:dns');\nconst options = {\n  family: 6,\n  hints: dns.ADDRCONFIG | dns.V4MAPPED,\n};\ndns.lookup('example.org', options, (err, address, family) =>\n  console.log('address: %j family: IPv%s', address, family));\n// address: \"2606:2800:21f:cb07:6820:80da:af6b:8b2c\" family: IPv6\n\n// When options.all is true, the result will be an Array.\noptions.all = true;\ndns.lookup('example.org', options, (err, addresses) =>\n  console.log('addresses: %j', addresses));\n// addresses: [{\"address\":\"2606:2800:21f:cb07:6820:80da:af6b:8b2c\",\"family\":6}]\n```\n\nIf this method is invoked as its [`util.promisify()`](util.html#utilpromisifyoriginal)ed version, and `all`\nis not set to `true`, it returns a `Promise` for an `Object` with `address` and\n`family` properties.","summary":"Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or AAAA (IPv6) record. All `option` properties are optional. If `options` is an integer, then it must be `4` or `6` – if `options` is not provided, then either IPv4 or IPv6 addresses, or both, are returned if found.","examples":[{"language":"mjs","displayName":null,"code":"import dns from 'node:dns';\nconst options = {\n  family: 6,\n  hints: dns.ADDRCONFIG | dns.V4MAPPED,\n};\ndns.lookup('example.org', options, (err, address, family) =>\n  console.log('address: %j family: IPv%s', address, family));\n// address: \"2606:2800:21f:cb07:6820:80da:af6b:8b2c\" family: IPv6\n\n// When options.all is true, the result will be an Array.\noptions.all = true;\ndns.lookup('example.org', options, (err, addresses) =>\n  console.log('addresses: %j', addresses));\n// addresses: [{\"address\":\"2606:2800:21f:cb07:6820:80da:af6b:8b2c\",\"family\":6}]"},{"language":"cjs","displayName":null,"code":"const dns = require('node:dns');\nconst options = {\n  family: 6,\n  hints: dns.ADDRCONFIG | dns.V4MAPPED,\n};\ndns.lookup('example.org', options, (err, address, family) =>\n  console.log('address: %j family: IPv%s', address, family));\n// address: \"2606:2800:21f:cb07:6820:80da:af6b:8b2c\" family: IPv6\n\n// When options.all is true, the result will be an Array.\noptions.all = true;\ndns.lookup('example.org', options, (err, addresses) =>\n  console.log('addresses: %j', addresses));\n// addresses: [{\"address\":\"2606:2800:21f:cb07:6820:80da:af6b:8b2c\",\"family\":6}]"}],"children":[{"kind":"section","id":"supported-getaddrinfo-flags","name":"Supported getaddrinfo flags","title":"Supported getaddrinfo flags","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v13.13.0","v12.17.0"],"prUrl":"https://github.com/nodejs/node/pull/32183","commit":null,"description":"Added support for the `dns.ALL` flag."}],"description":"The following flags can be passed as hints to [`dns.lookup()`](#dnslookuphostname-options-callback).\n\n* `dns.ADDRCONFIG`: Limits returned address types to the types of non-loopback\n  addresses configured on the system. For example, IPv4 addresses are only\n  returned if the current system has at least one IPv4 address configured.\n* `dns.V4MAPPED`: If the IPv6 family was specified, but no IPv6 addresses were\n  found, then return IPv4 mapped IPv6 addresses. It is not supported\n  on some operating systems (e.g. FreeBSD 10.1).\n* `dns.ALL`: If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as\n  well as IPv4 mapped IPv6 addresses.","summary":"The following flags can be passed as hints to `dns.lookup()`.","examples":[],"children":[]}]},{"kind":"method","id":"dnslookupserviceaddress-port-callback","name":"lookupService","title":"`dns.lookupService(address, port, callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.11.14"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."}],"signature":{"parameters":[{"name":"address","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"port","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"e.g. `example.com`","default":null,"optional":false,"rest":false,"properties":[]},{"name":"service","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"e.g. `http`","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Resolves the given `address` and `port` into a host name and service using\nthe operating system's underlying `getnameinfo` implementation.\n\nIf `address` is not a valid IP address, a `TypeError` will be thrown.\nThe `port` will be coerced to a number. If it is not a legal port, a `TypeError`\nwill be thrown.\n\nOn an error, `err` is an [`Error`](errors.html#class-error) object, where `err.code` is the error code.\n\n```mjs\nimport dns from 'node:dns';\ndns.lookupService('127.0.0.1', 22, (err, hostname, service) => {\n  console.log(hostname, service);\n  // Prints: localhost ssh\n});\n```\n\n```cjs\nconst dns = require('node:dns');\ndns.lookupService('127.0.0.1', 22, (err, hostname, service) => {\n  console.log(hostname, service);\n  // Prints: localhost ssh\n});\n```\n\nIf this method is invoked as its [`util.promisify()`](util.html#utilpromisifyoriginal)ed version, it returns a\n`Promise` for an `Object` with `hostname` and `service` properties.","summary":"Resolves the given `address` and `port` into a host name and service using the operating system's underlying `getnameinfo` implementation.","examples":[{"language":"mjs","displayName":null,"code":"import dns from 'node:dns';\ndns.lookupService('127.0.0.1', 22, (err, hostname, service) => {\n  console.log(hostname, service);\n  // Prints: localhost ssh\n});"},{"language":"cjs","displayName":null,"code":"const dns = require('node:dns');\ndns.lookupService('127.0.0.1', 22, (err, hostname, service) => {\n  console.log(hostname, service);\n  // Prints: localhost ssh\n});"}],"children":[]},{"kind":"method","id":"dnsresolvehostname-rrtype-callback","name":"resolve","title":"`dns.resolve(hostname[, rrtype], callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.27"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."}],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Host name to resolve.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"rrtype","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Resource record type.","default":"'A'","optional":true,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"records","type":{"text":"string[] | Object[] | Object","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":11,"end":17},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":22,"end":28}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array\nof the resource records. The `callback` function has arguments\n`(err, records)`. When successful, `records` will be an array of resource\nrecords. The type and structure of individual results varies based on `rrtype`:\n\n| `rrtype`  | `records` contains             | Result type | Shorthand method                                          |\n| --------- | ------------------------------ | ----------- | --------------------------------------------------------- |\n| `'A'`     | IPv4 addresses (default)       | {string}    | [`dns.resolve4()`](#dnsresolve4hostname-options-callback) |\n| `'AAAA'`  | IPv6 addresses                 | {string}    | [`dns.resolve6()`](#dnsresolve6hostname-options-callback) |\n| `'ANY'`   | any records                    | {Object}    | [`dns.resolveAny()`](#dnsresolveanyhostname-callback)     |\n| `'CAA'`   | CA authorization records       | {Object}    | [`dns.resolveCaa()`](#dnsresolvecaahostname-callback)     |\n| `'CNAME'` | canonical name records         | {string}    | [`dns.resolveCname()`](#dnsresolvecnamehostname-callback) |\n| `'MX'`    | mail exchange records          | {Object}    | [`dns.resolveMx()`](#dnsresolvemxhostname-callback)       |\n| `'NAPTR'` | name authority pointer records | {Object}    | [`dns.resolveNaptr()`](#dnsresolvenaptrhostname-callback) |\n| `'NS'`    | name server records            | {string}    | [`dns.resolveNs()`](#dnsresolvenshostname-callback)       |\n| `'PTR'`   | pointer records                | {string}    | [`dns.resolvePtr()`](#dnsresolveptrhostname-callback)     |\n| `'SOA'`   | start of authority records     | {Object}    | [`dns.resolveSoa()`](#dnsresolvesoahostname-callback)     |\n| `'SRV'`   | service records                | {Object}    | [`dns.resolveSrv()`](#dnsresolvesrvhostname-callback)     |\n| `'TLSA'`  | certificate associations       | {Object}    | [`dns.resolveTlsa()`](#dnsresolvetlsahostname-callback)   |\n| `'TXT'`   | text records                   | {string[]}  | [`dns.resolveTxt()`](#dnsresolvetxthostname-callback)     |\n\nOn error, `err` is an [`Error`](errors.html#class-error) object, where `err.code` is one of the\n[DNS error codes](#error-codes).","summary":"Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array of the resource records. The `callback` function has arguments `(err, records)`. When successful, `records` will be an array of resource records. The type and structure of individual results varies based on `rrtype`:","examples":[],"children":[]},{"kind":"method","id":"dnsresolve4hostname-options-callback","name":"resolve4","title":"`dns.resolve4(hostname[, options], callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.16"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."},{"versions":["v7.2.0"],"prUrl":"https://github.com/nodejs/node/pull/9296","commit":null,"description":"This method now supports passing `options`, specifically `options.ttl`."}],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Host name to resolve.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"ttl","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Retrieves the Time-To-Live value (TTL) of each record.\nWhen `true`, the callback receives an array of\n`{ address: '1.2.3.4', ttl: 60 }` objects rather than an array of strings,\nwith the TTL expressed in seconds.","default":null,"optional":false,"rest":false,"properties":[]}]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"addresses","type":{"text":"string[] | Object[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":11,"end":17}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve an IPv4 addresses (`A` records) for the\n`hostname`. The `addresses` argument passed to the `callback` function\nwill contain an array of IPv4 addresses (e.g.\n`['74.125.79.104', '74.125.79.105', '74.125.79.106']`).","summary":"Uses the DNS protocol to resolve an IPv4 addresses (`A` records) for the `hostname`. The `addresses` argument passed to the `callback` function will contain an array of IPv4 addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`).","examples":[],"children":[]},{"kind":"method","id":"dnsresolve6hostname-options-callback","name":"resolve6","title":"`dns.resolve6(hostname[, options], callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.16"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."},{"versions":["v7.2.0"],"prUrl":"https://github.com/nodejs/node/pull/9296","commit":null,"description":"This method now supports passing `options`, specifically `options.ttl`."}],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Host name to resolve.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"ttl","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Retrieve the Time-To-Live value (TTL) of each record.\nWhen `true`, the callback receives an array of\n`{ address: '0:1:2:3:4:5:6:7', ttl: 60 }` objects rather than an array of\nstrings, with the TTL expressed in seconds.","default":null,"optional":false,"rest":false,"properties":[]}]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"addresses","type":{"text":"string[] | Object[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":11,"end":17}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the\n`hostname`. The `addresses` argument passed to the `callback` function\nwill contain an array of IPv6 addresses.","summary":"Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. The `addresses` argument passed to the `callback` function will contain an array of IPv6 addresses.","examples":[],"children":[]},{"kind":"method","id":"dnsresolveanyhostname-callback","name":"resolveAny","title":"`dns.resolveAny(hostname, callback)`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."}],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"ret","type":{"text":"Object[]","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).\nThe `ret` argument passed to the `callback` function will be an array containing\nvarious types of records. Each object has a property `type` that indicates the\ntype of the current record. And depending on the `type`, additional properties\nwill be present on the object:\n\n| Type      | Properties                                                                                                                                                                      |\n| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `'A'`     | `address`/`ttl`                                                                                                                                                                 |\n| `'AAAA'`  | `address`/`ttl`                                                                                                                                                                 |\n| `'CAA'`   | Refer to [`dns.resolveCaa()`](#dnsresolvecaahostname-callback)                                                                                                                  |\n| `'CNAME'` | `value`                                                                                                                                                                         |\n| `'MX'`    | Refer to [`dns.resolveMx()`](#dnsresolvemxhostname-callback)                                                                                                                    |\n| `'NAPTR'` | Refer to [`dns.resolveNaptr()`](#dnsresolvenaptrhostname-callback)                                                                                                              |\n| `'NS'`    | `value`                                                                                                                                                                         |\n| `'PTR'`   | `value`                                                                                                                                                                         |\n| `'SOA'`   | Refer to [`dns.resolveSoa()`](#dnsresolvesoahostname-callback)                                                                                                                  |\n| `'SRV'`   | Refer to [`dns.resolveSrv()`](#dnsresolvesrvhostname-callback)                                                                                                                  |\n| `'TLSA'`  | Refer to [`dns.resolveTlsa()`](#dnsresolvetlsahostname-callback)                                                                                                                |\n| `'TXT'`   | This type of record contains an array property called `entries` which refers to [`dns.resolveTxt()`](#dnsresolvetxthostname-callback), e.g. `{ entries: ['...'], type: 'TXT' }` |\n\nHere is an example of the `ret` object passed to the callback:\n\n```js\n[ { type: 'A', address: '127.0.0.1', ttl: 299 },\n  { type: 'CNAME', value: 'example.com' },\n  { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },\n  { type: 'NS', value: 'ns1.example.com' },\n  { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },\n  { type: 'SOA',\n    nsname: 'ns1.example.com',\n    hostmaster: 'admin.example.com',\n    serial: 156696742,\n    refresh: 900,\n    retry: 900,\n    expire: 1800,\n    minttl: 60 } ];\n```\n\nDNS server operators may choose not to respond to `ANY`\nqueries. It may be better to call individual methods like [`dns.resolve4()`](#dnsresolve4hostname-options-callback),\n[`dns.resolveMx()`](#dnsresolvemxhostname-callback), and so on. For more details, see [RFC 8482](https://tools.ietf.org/html/rfc8482).","summary":"Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). The `ret` argument passed to the `callback` function will be an array containing various types of records. Each object has a property `type` that indicates the type of the current record. And depending on the `type`, additional properties will be present on the object:","examples":[{"language":"js","displayName":null,"code":"[ { type: 'A', address: '127.0.0.1', ttl: 299 },\n  { type: 'CNAME', value: 'example.com' },\n  { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },\n  { type: 'NS', value: 'ns1.example.com' },\n  { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },\n  { type: 'SOA',\n    nsname: 'ns1.example.com',\n    hostmaster: 'admin.example.com',\n    serial: 156696742,\n    refresh: 900,\n    retry: 900,\n    expire: 1800,\n    minttl: 60 } ];"}],"children":[]},{"kind":"method","id":"dnsresolvecnamehostname-callback","name":"resolveCname","title":"`dns.resolveCname(hostname, callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.3.2"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."}],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"addresses","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The\n`addresses` argument passed to the `callback` function\nwill contain an array of canonical name records available for the `hostname`\n(e.g. `['bar.example.com']`).","summary":"Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The `addresses` argument passed to the `callback` function will contain an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`).","examples":[],"children":[]},{"kind":"method","id":"dnsresolvecaahostname-callback","name":"resolveCaa","title":"`dns.resolveCaa(hostname, callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v15.0.0","v14.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."}],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"records","type":{"text":"Object[]","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve `CAA` records for the `hostname`. The\n`addresses` argument passed to the `callback` function\nwill contain an array of certification authority authorization records\navailable for the `hostname` (e.g. `[{critical: 0, iodef:\n'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`).","summary":"Uses the DNS protocol to resolve `CAA` records for the `hostname`. The `addresses` argument passed to the `callback` function will contain an array of certification authority authorization records available for the `hostname` (e.g. `[{critical: 0, iodef:'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`).","examples":[],"children":[]},{"kind":"method","id":"dnsresolvemxhostname-callback","name":"resolveMx","title":"`dns.resolveMx(hostname, callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.27"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."}],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"addresses","type":{"text":"Object[]","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve mail exchange records (`MX` records) for the\n`hostname`. The `addresses` argument passed to the `callback` function will\ncontain an array of objects containing both a `priority` and `exchange`\nproperty (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).","summary":"Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. The `addresses` argument passed to the `callback` function will contain an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).","examples":[],"children":[]},{"kind":"method","id":"dnsresolvenaptrhostname-callback","name":"resolveNaptr","title":"`dns.resolveNaptr(hostname, callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.9.12"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."}],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"addresses","type":{"text":"Object[]","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve regular expression-based records (`NAPTR`\nrecords) for the `hostname`. The `addresses` argument passed to the `callback`\nfunction will contain an array of objects with the following properties:\n\n* `flags`\n* `service`\n* `regexp`\n* `replacement`\n* `order`\n* `preference`\n\n```js\n({\n  flags: 's',\n  service: 'SIP+D2U',\n  regexp: '',\n  replacement: '_sip._udp.example.com',\n  order: 30,\n  preference: 100,\n});\n```","summary":"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 objects with the following properties:","examples":[{"language":"js","displayName":null,"code":"({\n  flags: 's',\n  service: 'SIP+D2U',\n  regexp: '',\n  replacement: '_sip._udp.example.com',\n  order: 30,\n  preference: 100,\n});"}],"children":[]},{"kind":"method","id":"dnsresolvenshostname-callback","name":"resolveNs","title":"`dns.resolveNs(hostname, callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.90"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."}],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"addresses","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve name server records (`NS` records) for the\n`hostname`. The `addresses` argument passed to the `callback` function will\ncontain an array of name server records available for `hostname`\n(e.g. `['ns1.example.com', 'ns2.example.com']`).","summary":"Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. The `addresses` argument passed to the `callback` function will contain an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`).","examples":[],"children":[]},{"kind":"method","id":"dnsresolveptrhostname-callback","name":"resolvePtr","title":"`dns.resolvePtr(hostname, callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v6.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."}],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"addresses","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve pointer records (`PTR` records) for the\n`hostname`. The `addresses` argument passed to the `callback` function will\nbe an array of strings containing the reply records.","summary":"Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will be an array of strings containing the reply records.","examples":[],"children":[]},{"kind":"method","id":"dnsresolvesoahostname-callback","name":"resolveSoa","title":"`dns.resolveSoa(hostname, callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.11.10"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."}],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"address","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve a start of authority record (`SOA` record) for\nthe `hostname`. The `address` argument passed to the `callback` function will\nbe an object with the following properties:\n\n* `nsname`\n* `hostmaster`\n* `serial`\n* `refresh`\n* `retry`\n* `expire`\n* `minttl`\n\n```js\n({\n  nsname: 'ns.example.com',\n  hostmaster: 'root.example.com',\n  serial: 2013101809,\n  refresh: 10000,\n  retry: 2400,\n  expire: 604800,\n  minttl: 3600,\n});\n```","summary":"Uses the DNS protocol to resolve a start of authority record (`SOA` record) for the `hostname`. The `address` argument passed to the `callback` function will be an object with the following properties:","examples":[{"language":"js","displayName":null,"code":"({\n  nsname: 'ns.example.com',\n  hostmaster: 'root.example.com',\n  serial: 2013101809,\n  refresh: 10000,\n  retry: 2400,\n  expire: 604800,\n  minttl: 3600,\n});"}],"children":[]},{"kind":"method","id":"dnsresolvesrvhostname-callback","name":"resolveSrv","title":"`dns.resolveSrv(hostname, callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.27"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."}],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"addresses","type":{"text":"Object[]","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve service records (`SRV` records) for the\n`hostname`. The `addresses` argument passed to the `callback` function will\nbe an array of objects with the following properties:\n\n* `priority`\n* `weight`\n* `port`\n* `name`\n\n```js\n({\n  priority: 10,\n  weight: 5,\n  port: 21223,\n  name: 'service.example.com',\n});\n```","summary":"Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. The `addresses` argument passed to the `callback` function will be an array of objects with the following properties:","examples":[{"language":"js","displayName":null,"code":"({\n  priority: 10,\n  weight: 5,\n  port: 21223,\n  name: 'service.example.com',\n});"}],"children":[]},{"kind":"method","id":"dnsresolvetlsahostname-callback","name":"resolveTlsa","title":"`dns.resolveTlsa(hostname, callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v23.9.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"records","type":{"text":"Object[]","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve certificate associations (`TLSA` records) for\nthe `hostname`. The `records` argument passed to the `callback` function is an\narray of objects with these properties:\n\n* `certUsage`\n* `selector`\n* `match`\n* `data`\n\n```js\n({\n  certUsage: 3,\n  selector: 1,\n  match: 1,\n  data: [ArrayBuffer],\n});\n```","summary":"Uses the DNS protocol to resolve certificate associations (`TLSA` records) for the `hostname`. The `records` argument passed to the `callback` function is an array of objects with these properties:","examples":[{"language":"js","displayName":null,"code":"({\n  certUsage: 3,\n  selector: 1,\n  match: 1,\n  data: [ArrayBuffer],\n});"}],"children":[]},{"kind":"method","id":"dnsresolvetxthostname-callback","name":"resolveTxt","title":"`dns.resolveTxt(hostname, callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.27"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."}],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"records","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve text queries (`TXT` records) for the\n`hostname`. The `records` argument passed to the `callback` function is a\ntwo-dimensional array of the text records available for `hostname` (e.g.\n`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of\none record. Depending on the use case, these could be either joined together or\ntreated separately.","summary":"Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. The `records` argument passed to the `callback` function is a 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 one record. Depending on the use case, these could be either joined together or treated separately.","examples":[],"children":[]},{"kind":"method","id":"dnsreverseip-callback","name":"reverse","title":"`dns.reverse(ip, callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.1.16"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"ip","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"err","type":{"text":"Error","links":[{"name":"Error","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error","start":0,"end":5}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"hostnames","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an\narray of host names.\n\nOn error, `err` is an [`Error`](errors.html#class-error) object, where `err.code` is\none of the [DNS error codes](#error-codes).","summary":"Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an array of host names.","examples":[],"children":[]},{"kind":"method","id":"dnssetdefaultresultorderorder","name":"setDefaultResultOrder","title":"`dns.setDefaultResultOrder(order)`","scope":"module","overloadOf":null,"stability":null,"added":["v16.4.0","v14.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v22.1.0","v20.13.0"],"prUrl":"https://github.com/nodejs/node/pull/52492","commit":null,"description":"The `ipv6first` value is supported now."},{"versions":["v17.0.0"],"prUrl":"https://github.com/nodejs/node/pull/39987","commit":null,"description":"Changed default value to `verbatim`."}],"signature":{"parameters":[{"name":"order","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Set the default value of `order` in [`dns.lookup()`](#dnslookuphostname-options-callback) and\n[`dnsPromises.lookup()`](#dnspromiseslookuphostname-options). The value could be:\n\n* `ipv4first`: sets default `order` to `ipv4first`.\n* `ipv6first`: sets default `order` to `ipv6first`.\n* `verbatim`: sets default `order` to `verbatim`.\n\nThe default is `verbatim` and [`dns.setDefaultResultOrder()`](#dnssetdefaultresultorderorder) have higher\npriority than [`--dns-result-order`](cli.html#--dns-result-orderorder). When using [worker threads](worker_threads.html),\n[`dns.setDefaultResultOrder()`](#dnssetdefaultresultorderorder) from the main thread won't affect the default\ndns orders in workers.","summary":"Set the default value of `order` in `dns.lookup()` and `dnsPromises.lookup()`. The value could be:","examples":[],"children":[]},{"kind":"method","id":"dnsgetdefaultresultorder","name":"getDefaultResultOrder","title":"`dns.getDefaultResultOrder()`","scope":"module","overloadOf":null,"stability":null,"added":["v20.1.0","v18.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v22.1.0","v20.13.0"],"prUrl":"https://github.com/nodejs/node/pull/52492","commit":null,"description":"The `ipv6first` value is supported now."}],"signature":{"parameters":[],"returns":null},"description":"Get the default value for `order` in [`dns.lookup()`](#dnslookuphostname-options-callback) and\n[`dnsPromises.lookup()`](#dnspromiseslookuphostname-options). The value could be:\n\n* `ipv4first`: for `order` defaulting to `ipv4first`.\n* `ipv6first`: for `order` defaulting to `ipv6first`.\n* `verbatim`: for `order` defaulting to `verbatim`.","summary":"Get the default value for `order` in `dns.lookup()` and `dnsPromises.lookup()`. The value could be:","examples":[],"children":[]},{"kind":"method","id":"dnssetserversservers","name":"setServers","title":"`dns.setServers(servers)`","scope":"module","overloadOf":null,"stability":null,"added":["v0.11.3"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"servers","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted addresses","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Sets the IP address and port of servers to be used when performing DNS\nresolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted\naddresses. If the port is the IANA default DNS port (53) it can be omitted.\n\n```js\ndns.setServers([\n  '8.8.8.8',\n  '[2001:4860:4860::8888]',\n  '8.8.8.8:1053',\n  '[2001:4860:4860::8888]:1053',\n]);\n```\n\nAn error will be thrown if an invalid address is provided.\n\nThe `dns.setServers()` method must not be called while a DNS query is in\nprogress.\n\nThe [`dns.setServers()`](#dnssetserversservers) method affects only [`dns.resolve()`](#dnsresolvehostname-rrtype-callback),\n`dns.resolve*()` and [`dns.reverse()`](#dnsreverseip-callback) (and specifically *not*\n[`dns.lookup()`](#dnslookuphostname-options-callback)).\n\nThis method works much like\n[resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).\nThat is, if attempting to resolve with the first server provided results in a\n`NOTFOUND` error, the `resolve()` method will *not* attempt to resolve with\nsubsequent servers provided. Fallback DNS servers will only be used if the\nearlier ones time out or result in some other error.","summary":"Sets the IP address and port of servers to be used when performing DNS resolution. The `servers` argument is an array of RFC 5952 formatted addresses. If the port is the IANA default DNS port (53) it can be omitted.","examples":[{"language":"js","displayName":null,"code":"dns.setServers([\n  '8.8.8.8',\n  '[2001:4860:4860::8888]',\n  '8.8.8.8:1053',\n  '[2001:4860:4860::8888]:1053',\n]);"}],"children":[]},{"kind":"section","id":"dns-promises-api","name":"DNS promises API","title":"DNS promises API","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v15.0.0"],"prUrl":"https://github.com/nodejs/node/pull/32953","commit":null,"description":"Exposed as `require('dns/promises')`."},{"versions":["v11.14.0","v10.17.0"],"prUrl":"https://github.com/nodejs/node/pull/26592","commit":null,"description":"This API is no longer experimental."}],"description":"The `dns.promises` API provides an alternative set of asynchronous DNS methods\nthat return `Promise` objects rather than using callbacks. The API is accessible\nvia `require('node:dns').promises` or `require('node:dns/promises')`.","summary":"The `dns.promises` API provides an alternative set of asynchronous DNS methods that return `Promise` objects rather than using callbacks. The API is accessible via `require('node:dns').promises` or `require('node:dns/promises')`.","examples":[],"children":[{"kind":"class","id":"class-dnspromisesresolver","name":"Resolver","title":"Class: `dnsPromises.Resolver`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"An independent resolver for DNS requests.\n\nCreating a new resolver uses the default server settings. Setting\nthe servers used for a resolver using\n[`resolver.setServers()`](#dnspromisessetserversservers) does not affect\nother resolvers:\n\n```mjs\nimport { Resolver } from 'node:dns/promises';\nconst resolver = new Resolver();\nresolver.setServers(['4.4.4.4']);\n\n// This request will use the server at 4.4.4.4, independent of global settings.\nconst addresses = await resolver.resolve4('example.org');\n```\n\n```cjs\nconst { Resolver } = require('node:dns').promises;\nconst resolver = new Resolver();\nresolver.setServers(['4.4.4.4']);\n\n// This request will use the server at 4.4.4.4, independent of global settings.\nresolver.resolve4('example.org').then((addresses) => {\n  // ...\n});\n\n// Alternatively, the same code can be written using async-await style.\n(async function() {\n  const addresses = await resolver.resolve4('example.org');\n})();\n```\n\nThe following methods from the `dnsPromises` API are available:\n\n* [`resolver.getServers()`](#dnspromisesgetservers)\n* [`resolver.resolve()`](#dnspromisesresolvehostname-rrtype)\n* [`resolver.resolve4()`](#dnspromisesresolve4hostname-options)\n* [`resolver.resolve6()`](#dnspromisesresolve6hostname-options)\n* [`resolver.resolveAny()`](#dnspromisesresolveanyhostname)\n* [`resolver.resolveCaa()`](#dnspromisesresolvecaahostname)\n* [`resolver.resolveCname()`](#dnspromisesresolvecnamehostname)\n* [`resolver.resolveMx()`](#dnspromisesresolvemxhostname)\n* [`resolver.resolveNaptr()`](#dnspromisesresolvenaptrhostname)\n* [`resolver.resolveNs()`](#dnspromisesresolvenshostname)\n* [`resolver.resolvePtr()`](#dnspromisesresolveptrhostname)\n* [`resolver.resolveSoa()`](#dnspromisesresolvesoahostname)\n* [`resolver.resolveSrv()`](#dnspromisesresolvesrvhostname)\n* [`resolver.resolveTlsa()`](#dnspromisesresolvetlsahostname)\n* [`resolver.resolveTxt()`](#dnspromisesresolvetxthostname)\n* [`resolver.reverse()`](#dnspromisesreverseip)\n* [`resolver.setServers()`](#dnspromisessetserversservers)","summary":"An independent resolver for DNS requests.","examples":[{"language":"mjs","displayName":null,"code":"import { Resolver } from 'node:dns/promises';\nconst resolver = new Resolver();\nresolver.setServers(['4.4.4.4']);\n\n// This request will use the server at 4.4.4.4, independent of global settings.\nconst addresses = await resolver.resolve4('example.org');"},{"language":"cjs","displayName":null,"code":"const { Resolver } = require('node:dns').promises;\nconst resolver = new Resolver();\nresolver.setServers(['4.4.4.4']);\n\n// This request will use the server at 4.4.4.4, independent of global settings.\nresolver.resolve4('example.org').then((addresses) => {\n  // ...\n});\n\n// Alternatively, the same code can be written using async-await style.\n(async function() {\n  const addresses = await resolver.resolve4('example.org');\n})();"}],"children":[]},{"kind":"method","id":"resolvercancel-1","name":"cancel","title":"`resolver.cancel()`","scope":"module","overloadOf":null,"stability":null,"added":["v15.3.0","v14.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Cancel all outstanding DNS queries made by this resolver. The corresponding\npromises will be rejected with an error with the code `ECANCELLED`.","summary":"Cancel all outstanding DNS queries made by this resolver. The corresponding promises will be rejected with an error with the code `ECANCELLED`.","examples":[],"children":[]},{"kind":"method","id":"dnspromisesgetservers","name":"getServers","title":"`dnsPromises.getServers()`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":""}},"description":"Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),\nthat are currently configured for DNS resolution. A string will include a port\nsection if a custom port is used.\n\n```json\n[\n  \"8.8.8.8\",\n  \"2001:4860:4860::8888\",\n  \"8.8.8.8:1053\",\n  \"[2001:4860:4860::8888]:1053\"\n]\n```","summary":"Returns an array of IP address strings, formatted according to RFC 5952, that are currently configured for DNS resolution. A string will include a port section if a custom port is used.","examples":[{"language":"json","displayName":null,"code":"[\n  \"8.8.8.8\",\n  \"2001:4860:4860::8888\",\n  \"8.8.8.8:1053\",\n  \"[2001:4860:4860::8888]:1053\"\n]"}],"children":[]},{"kind":"method","id":"dnspromiseslookuphostname-options","name":"lookup","title":"`dnsPromises.lookup(hostname[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v22.1.0","v20.13.0"],"prUrl":"https://github.com/nodejs/node/pull/52492","commit":null,"description":"The `verbatim` option is now deprecated in favor of the new `order` option."}],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"integer | Object","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":10,"end":16}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"family","type":{"text":"integer","links":[{"name":"integer","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":7}]},"description":"The record family. Must be `4`, `6`, or `0`. The value\n`0` indicates that either an IPv4 or IPv6 address is returned. If the\nvalue `0` is used with `{ all: true }` (see below), either one of or both\nIPv4 and IPv6 addresses are returned, depending on the system's DNS\nresolver.","default":"0","optional":true,"rest":false,"properties":[]},{"name":"hints","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"One or more [supported `getaddrinfo` flags](#supported-getaddrinfo-flags). Multiple\nflags may be passed by bitwise `OR`ing their values.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"all","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"When `true`, the `Promise` is resolved with all addresses in\nan array. Otherwise, returns a single address.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"order","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"When `verbatim`, the `Promise` is resolved with IPv4 and\nIPv6 addresses in the order the DNS resolver returned them. When `ipv4first`,\nIPv4 addresses are placed before IPv6 addresses. When `ipv6first`,\nIPv6 addresses are placed before IPv4 addresses.","default":"verbatim` (addresses are not reordered). Default value is configurable using `dns.setDefaultResultOrder()` or `--dns-result-order`. New code should use `{ order: 'verbatim' }","optional":true,"rest":false,"properties":[]},{"name":"verbatim","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"When `true`, the `Promise` is resolved with IPv4 and\nIPv6 addresses in the order the DNS resolver returned them. When `false`,\nIPv4 addresses are placed before IPv6 addresses.\nThis option will be deprecated in favor of `order`. When both are specified,\n`order` has higher precedence. New code should only use `order`.","default":"true` (addresses are not reordered). Default value is configurable using `dns.setDefaultResultOrder()` or `--dns-result-order","optional":true,"rest":false,"properties":[]}]}],"returns":null},"description":"Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or\nAAAA (IPv6) record. All `option` properties are optional. If `options` is an\ninteger, then it must be `4` or `6` – if `options` is not provided, then\neither IPv4 or IPv6 addresses, or both, are returned if found.\n\nWith the `all` option set to `true`, the `Promise` is resolved with `addresses`\nbeing an array of objects with the properties `address` and `family`.\n\nOn error, the `Promise` is rejected with an [`Error`](errors.html#class-error) object, where `err.code`\nis the error code.\nKeep in mind that `err.code` will be set to `'ENOTFOUND'` not only when\nthe host name does not exist but also when the lookup fails in other ways\nsuch as no available file descriptors.\n\n[`dnsPromises.lookup()`](#dnspromiseslookuphostname-options) does not necessarily have anything to do with the DNS\nprotocol. The implementation uses an operating system facility that can\nassociate names with addresses and vice versa. This implementation can have\nsubtle but important consequences on the behavior of any Node.js program. Please\ntake some time to consult the [Implementation considerations section](#implementation-considerations) before\nusing `dnsPromises.lookup()`.\n\nExample usage:\n\n```mjs\nimport dns from 'node:dns';\nconst dnsPromises = dns.promises;\nconst options = {\n  family: 6,\n  hints: dns.ADDRCONFIG | dns.V4MAPPED,\n};\n\nawait dnsPromises.lookup('example.org', options).then((result) => {\n  console.log('address: %j family: IPv%s', result.address, result.family);\n  // address: \"2606:2800:21f:cb07:6820:80da:af6b:8b2c\" family: IPv6\n});\n\n// When options.all is true, the result will be an Array.\noptions.all = true;\nawait dnsPromises.lookup('example.org', options).then((result) => {\n  console.log('addresses: %j', result);\n  // addresses: [{\"address\":\"2606:2800:21f:cb07:6820:80da:af6b:8b2c\",\"family\":6}]\n});\n```\n\n```cjs\nconst dns = require('node:dns');\nconst dnsPromises = dns.promises;\nconst options = {\n  family: 6,\n  hints: dns.ADDRCONFIG | dns.V4MAPPED,\n};\n\ndnsPromises.lookup('example.org', options).then((result) => {\n  console.log('address: %j family: IPv%s', result.address, result.family);\n  // address: \"2606:2800:21f:cb07:6820:80da:af6b:8b2c\" family: IPv6\n});\n\n// When options.all is true, the result will be an Array.\noptions.all = true;\ndnsPromises.lookup('example.org', options).then((result) => {\n  console.log('addresses: %j', result);\n  // addresses: [{\"address\":\"2606:2800:21f:cb07:6820:80da:af6b:8b2c\",\"family\":6}]\n});\n```","summary":"Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or AAAA (IPv6) record. All `option` properties are optional. If `options` is an integer, then it must be `4` or `6` – if `options` is not provided, then either IPv4 or IPv6 addresses, or both, are returned if found.","examples":[{"language":"mjs","displayName":null,"code":"import dns from 'node:dns';\nconst dnsPromises = dns.promises;\nconst options = {\n  family: 6,\n  hints: dns.ADDRCONFIG | dns.V4MAPPED,\n};\n\nawait dnsPromises.lookup('example.org', options).then((result) => {\n  console.log('address: %j family: IPv%s', result.address, result.family);\n  // address: \"2606:2800:21f:cb07:6820:80da:af6b:8b2c\" family: IPv6\n});\n\n// When options.all is true, the result will be an Array.\noptions.all = true;\nawait dnsPromises.lookup('example.org', options).then((result) => {\n  console.log('addresses: %j', result);\n  // addresses: [{\"address\":\"2606:2800:21f:cb07:6820:80da:af6b:8b2c\",\"family\":6}]\n});"},{"language":"cjs","displayName":null,"code":"const dns = require('node:dns');\nconst dnsPromises = dns.promises;\nconst options = {\n  family: 6,\n  hints: dns.ADDRCONFIG | dns.V4MAPPED,\n};\n\ndnsPromises.lookup('example.org', options).then((result) => {\n  console.log('address: %j family: IPv%s', result.address, result.family);\n  // address: \"2606:2800:21f:cb07:6820:80da:af6b:8b2c\" family: IPv6\n});\n\n// When options.all is true, the result will be an Array.\noptions.all = true;\ndnsPromises.lookup('example.org', options).then((result) => {\n  console.log('addresses: %j', result);\n  // addresses: [{\"address\":\"2606:2800:21f:cb07:6820:80da:af6b:8b2c\",\"family\":6}]\n});"}],"children":[]},{"kind":"method","id":"dnspromiseslookupserviceaddress-port","name":"lookupService","title":"`dnsPromises.lookupService(address, port)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"address","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"port","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Resolves the given `address` and `port` into a host name and service using\nthe operating system's underlying `getnameinfo` implementation.\n\nIf `address` is not a valid IP address, a `TypeError` will be thrown.\nThe `port` will be coerced to a number. If it is not a legal port, a `TypeError`\nwill be thrown.\n\nOn error, the `Promise` is rejected with an [`Error`](errors.html#class-error) object, where `err.code`\nis the error code.\n\n```mjs\nimport dnsPromises from 'node:dns/promises';\nconst result = await dnsPromises.lookupService('127.0.0.1', 22);\n\nconsole.log(result.hostname, result.service); // Prints: localhost ssh\n```\n\n```cjs\nconst dnsPromises = require('node:dns').promises;\ndnsPromises.lookupService('127.0.0.1', 22).then((result) => {\n  console.log(result.hostname, result.service);\n  // Prints: localhost ssh\n});\n```","summary":"Resolves the given `address` and `port` into a host name and service using the operating system's underlying `getnameinfo` implementation.","examples":[{"language":"mjs","displayName":null,"code":"import dnsPromises from 'node:dns/promises';\nconst result = await dnsPromises.lookupService('127.0.0.1', 22);\n\nconsole.log(result.hostname, result.service); // Prints: localhost ssh"},{"language":"cjs","displayName":null,"code":"const dnsPromises = require('node:dns').promises;\ndnsPromises.lookupService('127.0.0.1', 22).then((result) => {\n  console.log(result.hostname, result.service);\n  // Prints: localhost ssh\n});"}],"children":[]},{"kind":"method","id":"dnspromisesresolvehostname-rrtype","name":"resolve","title":"`dnsPromises.resolve(hostname[, rrtype])`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Host name to resolve.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"rrtype","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Resource record type.","default":"'A'","optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array\nof the resource records. When successful, the `Promise` is resolved with an\narray of resource records. The type and structure of individual results vary\nbased on `rrtype`:\n\n| `rrtype`  | `records` contains             | Result type | Shorthand method                                                 |\n| --------- | ------------------------------ | ----------- | ---------------------------------------------------------------- |\n| `'A'`     | IPv4 addresses (default)       | {string}    | [`dnsPromises.resolve4()`](#dnspromisesresolve4hostname-options) |\n| `'AAAA'`  | IPv6 addresses                 | {string}    | [`dnsPromises.resolve6()`](#dnspromisesresolve6hostname-options) |\n| `'ANY'`   | any records                    | {Object}    | [`dnsPromises.resolveAny()`](#dnspromisesresolveanyhostname)     |\n| `'CAA'`   | CA authorization records       | {Object}    | [`dnsPromises.resolveCaa()`](#dnspromisesresolvecaahostname)     |\n| `'CNAME'` | canonical name records         | {string}    | [`dnsPromises.resolveCname()`](#dnspromisesresolvecnamehostname) |\n| `'MX'`    | mail exchange records          | {Object}    | [`dnsPromises.resolveMx()`](#dnspromisesresolvemxhostname)       |\n| `'NAPTR'` | name authority pointer records | {Object}    | [`dnsPromises.resolveNaptr()`](#dnspromisesresolvenaptrhostname) |\n| `'NS'`    | name server records            | {string}    | [`dnsPromises.resolveNs()`](#dnspromisesresolvenshostname)       |\n| `'PTR'`   | pointer records                | {string}    | [`dnsPromises.resolvePtr()`](#dnspromisesresolveptrhostname)     |\n| `'SOA'`   | start of authority records     | {Object}    | [`dnsPromises.resolveSoa()`](#dnspromisesresolvesoahostname)     |\n| `'SRV'`   | service records                | {Object}    | [`dnsPromises.resolveSrv()`](#dnspromisesresolvesrvhostname)     |\n| `'TLSA'`  | certificate associations       | {Object}    | [`dnsPromises.resolveTlsa()`](#dnspromisesresolvetlsahostname)   |\n| `'TXT'`   | text records                   | {string[]}  | [`dnsPromises.resolveTxt()`](#dnspromisesresolvetxthostname)     |\n\nOn error, the `Promise` is rejected with an [`Error`](errors.html#class-error) object, where `err.code`\nis one of the [DNS error codes](#error-codes).","summary":"Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array of the resource records. When successful, the `Promise` is resolved with an array of resource records. The type and structure of individual results vary based on `rrtype`:","examples":[],"children":[]},{"kind":"method","id":"dnspromisesresolve4hostname-options","name":"resolve4","title":"`dnsPromises.resolve4(hostname[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Host name to resolve.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"ttl","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Retrieve the Time-To-Live value (TTL) of each record.\nWhen `true`, the `Promise` is resolved with an array of\n`{ address: '1.2.3.4', ttl: 60 }` objects rather than an array of strings,\nwith the TTL expressed in seconds.","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the\n`hostname`. On success, the `Promise` is resolved with an array of IPv4\naddresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`).","summary":"Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv4 addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`).","examples":[],"children":[]},{"kind":"method","id":"dnspromisesresolve6hostname-options","name":"resolve6","title":"`dnsPromises.resolve6(hostname[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Host name to resolve.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"ttl","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Retrieve the Time-To-Live value (TTL) of each record.\nWhen `true`, the `Promise` is resolved with an array of\n`{ address: '0:1:2:3:4:5:6:7', ttl: 60 }` objects rather than an array of\nstrings, with the TTL expressed in seconds.","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the\n`hostname`. On success, the `Promise` is resolved with an array of IPv6\naddresses.","summary":"Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv6 addresses.","examples":[],"children":[]},{"kind":"method","id":"dnspromisesresolveanyhostname","name":"resolveAny","title":"`dnsPromises.resolveAny(hostname)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).\nOn success, the `Promise` is resolved with an array containing various types of\nrecords. Each object has a property `type` that indicates the type of the\ncurrent record. And depending on the `type`, additional properties will be\npresent on the object:\n\n| Type      | Properties                                                                                                                                                                             |\n| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `'A'`     | `address`/`ttl`                                                                                                                                                                        |\n| `'AAAA'`  | `address`/`ttl`                                                                                                                                                                        |\n| `'CAA'`   | Refer to [`dnsPromises.resolveCaa()`](#dnspromisesresolvecaahostname)                                                                                                                  |\n| `'CNAME'` | `value`                                                                                                                                                                                |\n| `'MX'`    | Refer to [`dnsPromises.resolveMx()`](#dnspromisesresolvemxhostname)                                                                                                                    |\n| `'NAPTR'` | Refer to [`dnsPromises.resolveNaptr()`](#dnspromisesresolvenaptrhostname)                                                                                                              |\n| `'NS'`    | `value`                                                                                                                                                                                |\n| `'PTR'`   | `value`                                                                                                                                                                                |\n| `'SOA'`   | Refer to [`dnsPromises.resolveSoa()`](#dnspromisesresolvesoahostname)                                                                                                                  |\n| `'SRV'`   | Refer to [`dnsPromises.resolveSrv()`](#dnspromisesresolvesrvhostname)                                                                                                                  |\n| `'TLSA'`  | Refer to [`dnsPromises.resolveTlsa()`](#dnspromisesresolvetlsahostname)                                                                                                                |\n| `'TXT'`   | This type of record contains an array property called `entries` which refers to [`dnsPromises.resolveTxt()`](#dnspromisesresolvetxthostname), e.g. `{ entries: ['...'], type: 'TXT' }` |\n\nHere is an example of the result object:\n\n```js\n[ { type: 'A', address: '127.0.0.1', ttl: 299 },\n  { type: 'CNAME', value: 'example.com' },\n  { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },\n  { type: 'NS', value: 'ns1.example.com' },\n  { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },\n  { type: 'SOA',\n    nsname: 'ns1.example.com',\n    hostmaster: 'admin.example.com',\n    serial: 156696742,\n    refresh: 900,\n    retry: 900,\n    expire: 1800,\n    minttl: 60 } ];\n```","summary":"Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). On success, the `Promise` is resolved with an array containing various types of records. Each object has a property `type` that indicates the type of the current record. And depending on the `type`, additional properties will be present on the object:","examples":[{"language":"js","displayName":null,"code":"[ { type: 'A', address: '127.0.0.1', ttl: 299 },\n  { type: 'CNAME', value: 'example.com' },\n  { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },\n  { type: 'NS', value: 'ns1.example.com' },\n  { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },\n  { type: 'SOA',\n    nsname: 'ns1.example.com',\n    hostmaster: 'admin.example.com',\n    serial: 156696742,\n    refresh: 900,\n    retry: 900,\n    expire: 1800,\n    minttl: 60 } ];"}],"children":[]},{"kind":"method","id":"dnspromisesresolvecaahostname","name":"resolveCaa","title":"`dnsPromises.resolveCaa(hostname)`","scope":"module","overloadOf":null,"stability":null,"added":["v15.0.0","v14.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success,\nthe `Promise` is resolved with an array of objects containing available\ncertification authority authorization records available for the `hostname`\n(e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue:\n'pki.example.com'}]`).","summary":"Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success, the `Promise` is resolved with an array of objects containing available certification authority authorization records available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue:'pki.example.com'}]`).","examples":[],"children":[]},{"kind":"method","id":"dnspromisesresolvecnamehostname","name":"resolveCname","title":"`dnsPromises.resolveCname(hostname)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Uses the DNS protocol to resolve `CNAME` records for the `hostname`. On success,\nthe `Promise` is resolved with an array of canonical name records available for\nthe `hostname` (e.g. `['bar.example.com']`).","summary":"Uses the DNS protocol to resolve `CNAME` records for the `hostname`. On success, the `Promise` is resolved with an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`).","examples":[],"children":[]},{"kind":"method","id":"dnspromisesresolvemxhostname","name":"resolveMx","title":"`dnsPromises.resolveMx(hostname)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Uses the DNS protocol to resolve mail exchange records (`MX` records) for the\n`hostname`. On success, the `Promise` is resolved with an array of objects\ncontaining both a `priority` and `exchange` property (e.g.\n`[{priority: 10, exchange: 'mx.example.com'}, ...]`).","summary":"Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).","examples":[],"children":[]},{"kind":"method","id":"dnspromisesresolvenaptrhostname","name":"resolveNaptr","title":"`dnsPromises.resolveNaptr(hostname)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Uses the DNS protocol to resolve regular expression-based records (`NAPTR`\nrecords) for the `hostname`. On success, the `Promise` is resolved with an array\nof objects with the following properties:\n\n* `flags`\n* `service`\n* `regexp`\n* `replacement`\n* `order`\n* `preference`\n\n```js\n({\n  flags: 's',\n  service: 'SIP+D2U',\n  regexp: '',\n  replacement: '_sip._udp.example.com',\n  order: 30,\n  preference: 100,\n});\n```","summary":"Uses the DNS protocol to resolve regular expression-based records (`NAPTR` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects with the following properties:","examples":[{"language":"js","displayName":null,"code":"({\n  flags: 's',\n  service: 'SIP+D2U',\n  regexp: '',\n  replacement: '_sip._udp.example.com',\n  order: 30,\n  preference: 100,\n});"}],"children":[]},{"kind":"method","id":"dnspromisesresolvenshostname","name":"resolveNs","title":"`dnsPromises.resolveNs(hostname)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Uses the DNS protocol to resolve name server records (`NS` records) for the\n`hostname`. On success, the `Promise` is resolved with an array of name server\nrecords available for `hostname` (e.g.\n`['ns1.example.com', 'ns2.example.com']`).","summary":"Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. On success, the `Promise` is resolved with an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`).","examples":[],"children":[]},{"kind":"method","id":"dnspromisesresolveptrhostname","name":"resolvePtr","title":"`dnsPromises.resolvePtr(hostname)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Uses the DNS protocol to resolve pointer records (`PTR` records) for the\n`hostname`. On success, the `Promise` is resolved with an array of strings\ncontaining the reply records.","summary":"Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. On success, the `Promise` is resolved with an array of strings containing the reply records.","examples":[],"children":[]},{"kind":"method","id":"dnspromisesresolvesoahostname","name":"resolveSoa","title":"`dnsPromises.resolveSoa(hostname)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Uses the DNS protocol to resolve a start of authority record (`SOA` record) for\nthe `hostname`. On success, the `Promise` is resolved with an object with the\nfollowing properties:\n\n* `nsname`\n* `hostmaster`\n* `serial`\n* `refresh`\n* `retry`\n* `expire`\n* `minttl`\n\n```js\n({\n  nsname: 'ns.example.com',\n  hostmaster: 'root.example.com',\n  serial: 2013101809,\n  refresh: 10000,\n  retry: 2400,\n  expire: 604800,\n  minttl: 3600,\n});\n```","summary":"Uses the DNS protocol to resolve a start of authority record (`SOA` record) for the `hostname`. On success, the `Promise` is resolved with an object with the following properties:","examples":[{"language":"js","displayName":null,"code":"({\n  nsname: 'ns.example.com',\n  hostmaster: 'root.example.com',\n  serial: 2013101809,\n  refresh: 10000,\n  retry: 2400,\n  expire: 604800,\n  minttl: 3600,\n});"}],"children":[]},{"kind":"method","id":"dnspromisesresolvesrvhostname","name":"resolveSrv","title":"`dnsPromises.resolveSrv(hostname)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Uses the DNS protocol to resolve service records (`SRV` records) for the\n`hostname`. On success, the `Promise` is resolved with an array of objects with\nthe following properties:\n\n* `priority`\n* `weight`\n* `port`\n* `name`\n\n```js\n({\n  priority: 10,\n  weight: 5,\n  port: 21223,\n  name: 'service.example.com',\n});\n```","summary":"Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects with the following properties:","examples":[{"language":"js","displayName":null,"code":"({\n  priority: 10,\n  weight: 5,\n  port: 21223,\n  name: 'service.example.com',\n});"}],"children":[]},{"kind":"method","id":"dnspromisesresolvetlsahostname","name":"resolveTlsa","title":"`dnsPromises.resolveTlsa(hostname)`","scope":"module","overloadOf":null,"stability":null,"added":["v23.9.0","v22.15.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Uses the DNS protocol to resolve certificate associations (`TLSA` records) for\nthe `hostname`. On success, the `Promise` is resolved with an array of objects\nwith these properties:\n\n* `certUsage`\n* `selector`\n* `match`\n* `data`\n\n```js\n({\n  certUsage: 3,\n  selector: 1,\n  match: 1,\n  data: [ArrayBuffer],\n});\n```","summary":"Uses the DNS protocol to resolve certificate associations (`TLSA` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects with these properties:","examples":[{"language":"js","displayName":null,"code":"({\n  certUsage: 3,\n  selector: 1,\n  match: 1,\n  data: [ArrayBuffer],\n});"}],"children":[]},{"kind":"method","id":"dnspromisesresolvetxthostname","name":"resolveTxt","title":"`dnsPromises.resolveTxt(hostname)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"hostname","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Uses the DNS protocol to resolve text queries (`TXT` records) for the\n`hostname`. On success, the `Promise` is resolved with a two-dimensional array\nof the text records available for `hostname` (e.g.\n`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of\none record. Depending on the use case, these could be either joined together or\ntreated separately.","summary":"Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. On success, the `Promise` is resolved with a 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 one record. Depending on the use case, these could be either joined together or treated separately.","examples":[],"children":[]},{"kind":"method","id":"dnspromisesreverseip","name":"reverse","title":"`dnsPromises.reverse(ip)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"ip","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an\narray of host names.\n\nOn error, the `Promise` is rejected with an [`Error`](errors.html#class-error) object, where `err.code`\nis one of the [DNS error codes](#error-codes).","summary":"Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an array of host names.","examples":[],"children":[]},{"kind":"method","id":"dnspromisessetdefaultresultorderorder","name":"setDefaultResultOrder","title":"`dnsPromises.setDefaultResultOrder(order)`","scope":"module","overloadOf":null,"stability":null,"added":["v16.4.0","v14.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v22.1.0","v20.13.0"],"prUrl":"https://github.com/nodejs/node/pull/52492","commit":null,"description":"The `ipv6first` value is supported now."},{"versions":["v17.0.0"],"prUrl":"https://github.com/nodejs/node/pull/39987","commit":null,"description":"Changed default value to `verbatim`."}],"signature":{"parameters":[{"name":"order","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Set the default value of `order` in [`dns.lookup()`](#dnslookuphostname-options-callback) and\n[`dnsPromises.lookup()`](#dnspromiseslookuphostname-options). The value could be:\n\n* `ipv4first`: sets default `order` to `ipv4first`.\n* `ipv6first`: sets default `order` to `ipv6first`.\n* `verbatim`: sets default `order` to `verbatim`.\n\nThe default is `verbatim` and [`dnsPromises.setDefaultResultOrder()`](#dnspromisessetdefaultresultorderorder) have\nhigher priority than [`--dns-result-order`](cli.html#--dns-result-orderorder). When using [worker threads](worker_threads.html),\n[`dnsPromises.setDefaultResultOrder()`](#dnspromisessetdefaultresultorderorder) from the main thread won't affect the\ndefault dns orders in workers.","summary":"Set the default value of `order` in `dns.lookup()` and `dnsPromises.lookup()`. The value could be:","examples":[],"children":[]},{"kind":"method","id":"dnspromisesgetdefaultresultorder","name":"getDefaultResultOrder","title":"`dnsPromises.getDefaultResultOrder()`","scope":"module","overloadOf":null,"stability":null,"added":["v20.1.0","v18.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Get the value of `dnsOrder`.","summary":"Get the value of `dnsOrder`.","examples":[],"children":[]},{"kind":"method","id":"dnspromisessetserversservers","name":"setServers","title":"`dnsPromises.setServers(servers)`","scope":"module","overloadOf":null,"stability":null,"added":["v10.6.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"servers","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted addresses","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Sets the IP address and port of servers to be used when performing DNS\nresolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted\naddresses. If the port is the IANA default DNS port (53) it can be omitted.\n\n```js\ndnsPromises.setServers([\n  '8.8.8.8',\n  '[2001:4860:4860::8888]',\n  '8.8.8.8:1053',\n  '[2001:4860:4860::8888]:1053',\n]);\n```\n\nAn error will be thrown if an invalid address is provided.\n\nThe `dnsPromises.setServers()` method must not be called while a DNS query is in\nprogress.\n\nThis method works much like\n[resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).\nThat is, if attempting to resolve with the first server provided results in a\n`NOTFOUND` error, the `resolve()` method will *not* attempt to resolve with\nsubsequent servers provided. Fallback DNS servers will only be used if the\nearlier ones time out or result in some other error.","summary":"Sets the IP address and port of servers to be used when performing DNS resolution. The `servers` argument is an array of RFC 5952 formatted addresses. If the port is the IANA default DNS port (53) it can be omitted.","examples":[{"language":"js","displayName":null,"code":"dnsPromises.setServers([\n  '8.8.8.8',\n  '[2001:4860:4860::8888]',\n  '8.8.8.8:1053',\n  '[2001:4860:4860::8888]:1053',\n]);"}],"children":[]}]},{"kind":"section","id":"error-codes","name":"Error codes","title":"Error codes","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Each DNS query can return one of the following error codes:\n\n* `dns.NODATA`: DNS server returned an answer with no data.\n* `dns.FORMERR`: DNS server claims query was misformatted.\n* `dns.SERVFAIL`: DNS server returned general failure.\n* `dns.NOTFOUND`: Domain name not found.\n* `dns.NOTIMP`: DNS server does not implement the requested operation.\n* `dns.REFUSED`: DNS server refused query.\n* `dns.BADQUERY`: Misformatted DNS query.\n* `dns.BADNAME`: Misformatted host name.\n* `dns.BADFAMILY`: Unsupported address family.\n* `dns.BADRESP`: Misformatted DNS reply.\n* `dns.CONNREFUSED`: Could not contact DNS servers.\n* `dns.TIMEOUT`: Timeout while contacting DNS servers.\n* `dns.EOF`: End of file.\n* `dns.FILE`: Error reading file.\n* `dns.NOMEM`: Out of memory.\n* `dns.DESTRUCTION`: Channel is being destroyed.\n* `dns.BADSTR`: Misformatted string.\n* `dns.BADFLAGS`: Illegal flags specified.\n* `dns.NONAME`: Given host name is not numeric.\n* `dns.BADHINTS`: Illegal hints flags specified.\n* `dns.NOTINITIALIZED`: c-ares library initialization not yet performed.\n* `dns.LOADIPHLPAPI`: Error loading `iphlpapi.dll`.\n* `dns.ADDRGETNETWORKPARAMS`: Could not find `GetNetworkParams` function.\n* `dns.CANCELLED`: DNS query cancelled.\n\nThe `dnsPromises` API also exports the above error codes, e.g., `dnsPromises.NODATA`.","summary":"Each DNS query can return one of the following error codes:","examples":[],"children":[]},{"kind":"section","id":"implementation-considerations","name":"Implementation considerations","title":"Implementation considerations","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Although [`dns.lookup()`](#dnslookuphostname-options-callback) and the various `dns.resolve*()/dns.reverse()`\nfunctions have the same goal of associating a network name with a network\naddress (or vice versa), their behavior is quite different. These differences\ncan have subtle but significant consequences on the behavior of Node.js\nprograms.","summary":"Although `dns.lookup()` and the various `dns.resolve*()/dns.reverse()` functions have the same goal of associating a network name with a network address (or vice versa), their behavior is quite different. These differences can have subtle but significant consequences on the behavior of Node.js programs.","examples":[],"children":[{"kind":"method","id":"dnslookup","name":"lookup","title":"`dns.lookup()`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Under the hood, [`dns.lookup()`](#dnslookuphostname-options-callback) uses the same operating system facilities\nas most other programs. For instance, [`dns.lookup()`](#dnslookuphostname-options-callback) will almost always\nresolve a given name the same way as the `ping` command. On most POSIX-like\noperating systems, the behavior of the [`dns.lookup()`](#dnslookuphostname-options-callback) function can be\nmodified by changing settings in [`nsswitch.conf(5)`](http://man7.org/linux/man-pages/man5/nsswitch.conf.5.html) and/or [`resolv.conf(5)`](http://man7.org/linux/man-pages/man5/resolv.conf.5.html),\nbut changing these files will change the behavior of all other\nprograms running on the same operating system.\n\nThough the call to `dns.lookup()` will be asynchronous from JavaScript's\nperspective, it is implemented as a synchronous call to [`getaddrinfo(3)`](http://man7.org/linux/man-pages/man3/getaddrinfo.3.html) that runs\non libuv's threadpool. This can have surprising negative performance\nimplications for some applications, see the [`UV_THREADPOOL_SIZE`](cli.html#uv_threadpool_sizesize)\ndocumentation for more information.\n\nVarious networking APIs will call `dns.lookup()` internally to resolve\nhost names. If that is an issue, consider resolving the host name to an address\nusing `dns.resolve()` and using the address instead of a host name. Also, some\nnetworking APIs (such as [`socket.connect()`](net.html#socketconnectoptions-connectlistener) and [`dgram.createSocket()`](dgram.html#dgramcreatesocketoptions-callback))\nallow the default resolver, `dns.lookup()`, to be replaced.","summary":"Under the hood, `dns.lookup()` uses the same operating system facilities as most other programs. For instance, `dns.lookup()` will almost always resolve a given name the same way as the `ping` command. On most POSIX-like operating systems, the behavior of the `dns.lookup()` function can be modified by changing settings in `nsswitch.conf(5)` and/or `resolv.conf(5)`, but changing these files will change the behavior of all other programs running on the same operating system.","examples":[],"children":[]},{"kind":"section","id":"dnsresolve-dnsresolve-and-dnsreverse","name":"dns.resolve(), dns.resolve*(), and dns.reverse()","title":"`dns.resolve()`, `dns.resolve*()`, and `dns.reverse()`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"These functions are implemented quite differently than [`dns.lookup()`](#dnslookuphostname-options-callback). They\ndo not use [`getaddrinfo(3)`](http://man7.org/linux/man-pages/man3/getaddrinfo.3.html) and they *always* perform a DNS query on the\nnetwork. This network communication is always done asynchronously and does not\nuse libuv's threadpool.\n\nAs a result, these functions cannot have the same negative impact on other\nprocessing that happens on libuv's threadpool that [`dns.lookup()`](#dnslookuphostname-options-callback) can have.\n\nThey do not use the same set of configuration files that [`dns.lookup()`](#dnslookuphostname-options-callback)\nuses. For instance, they do not use the configuration from `/etc/hosts`.","summary":"These functions are implemented quite differently than `dns.lookup()`. They do not use `getaddrinfo(3)` and they _always_ perform a DNS query on the network. This network communication is always done asynchronously and does not use libuv's threadpool.","examples":[],"children":[]}]}]}