|
@ -61,29 +61,37 @@ AAAA (IPv6) record. `options` can be an object or integer. If `options` is |
|
|
not provided, then IP v4 and v6 addresses are both valid. If `options` is |
|
|
not provided, then IP v4 and v6 addresses are both valid. If `options` is |
|
|
an integer, then it must be `4` or `6`. |
|
|
an integer, then it must be `4` or `6`. |
|
|
|
|
|
|
|
|
Alternatively, `options` can be an object containing two properties, |
|
|
Alternatively, `options` can be an object containing these properties: |
|
|
`family` and `hints`. Both properties are optional. If `family` is provided, |
|
|
|
|
|
it must be the integer `4` or `6`. If `family` is not provided then IP v4 |
|
|
* `family` {Number} - The record family. If present, must be the integer |
|
|
and v6 addresses are accepted. The `hints` field, if present, should be one |
|
|
`4` or `6`. If not provided, both IP v4 and v6 addresses are accepted. |
|
|
or more of the supported `getaddrinfo` flags. If `hints` is not provided, |
|
|
* `hints`: {Number} - If present, it should be one or more of the supported |
|
|
then no flags are passed to `getaddrinfo`. Multiple flags can be passed |
|
|
`getaddrinfo` flags. If `hints` is not provided, then no flags are passed to |
|
|
through `hints` by logically `OR`ing their values. An example usage of |
|
|
`getaddrinfo`. Multiple flags can be passed through `hints` by logically |
|
|
`options` is shown below. |
|
|
`OR`ing their values. |
|
|
|
|
|
See [supported `getaddrinfo` flags](#dns_supported_getaddrinfo_flags) below |
|
|
|
|
|
for more information on supported flags. |
|
|
|
|
|
* `all`: {Boolean} - When `true`, the callback returns all resolved addresses |
|
|
|
|
|
in an array, otherwise returns a single address. Defaults to `false`. |
|
|
|
|
|
|
|
|
|
|
|
All properties are optional. An example usage of options is shown below. |
|
|
|
|
|
|
|
|
``` |
|
|
``` |
|
|
{ |
|
|
{ |
|
|
family: 4, |
|
|
family: 4, |
|
|
hints: dns.ADDRCONFIG | dns.V4MAPPED |
|
|
hints: dns.ADDRCONFIG | dns.V4MAPPED |
|
|
|
|
|
all: true |
|
|
} |
|
|
} |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
See [supported `getaddrinfo` flags](#dns_supported_getaddrinfo_flags) below for |
|
|
The callback has arguments `(err, address, family)`. `address` is a string |
|
|
more information on supported flags. |
|
|
representation of a IP v4 or v6 address. `family` is either the integer 4 or 6 |
|
|
|
|
|
and denotes the family of `address` (not necessarily the value initially passed |
|
|
|
|
|
to `lookup`). |
|
|
|
|
|
|
|
|
The callback has arguments `(err, address, family)`. The `address` argument |
|
|
With the `all` option set, the arguments change to `(err, addresses)`, with |
|
|
is a string representation of a IP v4 or v6 address. The `family` argument |
|
|
`addresses` being an array of objects with the properties `address` and |
|
|
is either the integer 4 or 6 and denotes the family of `address` (not |
|
|
`family`. |
|
|
necessarily the value initially passed to `lookup`). |
|
|
|
|
|
|
|
|
|
|
|
On error, `err` is an `Error` object, where `err.code` is the error code. |
|
|
On error, `err` is an `Error` object, where `err.code` is the error code. |
|
|
Keep in mind that `err.code` will be set to `'ENOENT'` not only when |
|
|
Keep in mind that `err.code` will be set to `'ENOENT'` not only when |
|
|