Package-level declarations

Types

Link copied to clipboard
sealed external interface AnyAaaaRecord : RecordWithTtl
Link copied to clipboard
sealed external interface AnyARecord : RecordWithTtl
Link copied to clipboard
sealed external interface AnyCnameRecord
Link copied to clipboard
sealed external interface AnyMxRecord : MxRecord
Link copied to clipboard
sealed external interface AnyNaptrRecord : NaptrRecord
Link copied to clipboard
sealed external interface AnyNsRecord
Link copied to clipboard
sealed external interface AnyPtrRecord
Link copied to clipboard
typealias AnyRecord = Any
Link copied to clipboard
typealias AnyRecordWithTtl = Any
Link copied to clipboard
sealed external interface AnySoaRecord : SoaRecord
Link copied to clipboard
sealed external interface AnySrvRecord : SrvRecord
Link copied to clipboard
sealed external interface AnyTxtRecord
Link copied to clipboard
sealed external interface CaaRecord
Link copied to clipboard
sealed external interface GetDefaultResultOrderResult
Link copied to clipboard
sealed external interface LookupAddress
Link copied to clipboard
sealed external interface LookupAllOptions : LookupOptions
Link copied to clipboard
sealed external interface LookupOneOptions : LookupOptions
Link copied to clipboard
sealed external interface LookupOptions
Link copied to clipboard
sealed external interface LookupOptionsOrder
Link copied to clipboard
sealed external interface LookupServiceResultPayload
Link copied to clipboard
sealed external interface MxRecord
Link copied to clipboard
sealed external interface NaptrRecord
Link copied to clipboard
sealed external interface RecordWithTtl
Link copied to clipboard
sealed external interface ResolveOptions
Link copied to clipboard
external class Resolver

An independent resolver for DNS requests.

Link copied to clipboard
sealed external interface ResolverOptions
Link copied to clipboard
sealed external interface ResolveWithTtlOptions : ResolveOptions
Link copied to clipboard
sealed external interface ResourceRecordType
Link copied to clipboard
sealed external interface SetDefaultResultOrderOrder
Link copied to clipboard
sealed external interface SoaRecord
Link copied to clipboard
sealed external interface SrvRecord

Properties

Link copied to clipboard
external val ADDRCONFIG: Double

Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are only returned if the current system has at least one IPv4 address configured.

Link copied to clipboard
Link copied to clipboard
external val ALL: Double

If dns.V4MAPPED is specified, return resolved IPv6 addresses as well as IPv4 mapped IPv6 addresses.

Link copied to clipboard
external val BADFAMILY: String
Link copied to clipboard
external val BADFLAGS: String
Link copied to clipboard
external val BADHINTS: String
Link copied to clipboard
external val BADNAME: String
Link copied to clipboard
external val BADQUERY: String
Link copied to clipboard
external val BADRESP: String
Link copied to clipboard
external val BADSTR: String
Link copied to clipboard
external val CANCELLED: String
Link copied to clipboard
external val CONNREFUSED: String
Link copied to clipboard
external val DESTRUCTION: String
Link copied to clipboard
external val EOF: String
Link copied to clipboard
external val FILE: String
Link copied to clipboard
external val FORMERR: String
Link copied to clipboard
external val LOADIPHLPAPI: String
Link copied to clipboard
external val NODATA: String
Link copied to clipboard
external val NOMEM: String
Link copied to clipboard
external val NONAME: String
Link copied to clipboard
external val NOTFOUND: String
Link copied to clipboard
external val NOTIMP: String
Link copied to clipboard
external val NOTINITIALIZED: String
Link copied to clipboard
external val REFUSED: String
Link copied to clipboard
external val SERVFAIL: String
Link copied to clipboard
external val TIMEOUT: String
Link copied to clipboard
external val V4MAPPED: Double

If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported on some operating systems (e.g. FreeBSD 10.1).

Functions

Link copied to clipboard

Get the default value for order in {@link lookup} and dnsPromises.lookup(). The value could be:

Link copied to clipboard

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.

Link copied to clipboard
suspend fun lookup(hostname: String): LookupAddress
external fun lookup(hostname: String, callback: (err: ErrnoException?, address: String, family: Double) -> Unit)
suspend fun lookup(hostname: String, family: Number): LookupAddress
suspend fun lookup(hostname: String, options: LookupAllOptions): ReadonlyArray<LookupAddress>
suspend fun lookup(hostname: String, options: LookupOneOptions): LookupAddress
suspend fun lookup(hostname: String, options: LookupOptions): Any
external fun lookup(hostname: String, options: LookupAllOptions, callback: (err: ErrnoException?, ReadonlyArray<LookupAddress>) -> Unit)
external fun lookup(hostname: String, options: LookupOneOptions, callback: (err: ErrnoException?, address: String, family: Double) -> Unit)
external fun lookup(hostname: String, options: LookupOptions, callback: (err: ErrnoException?, address: Any, family: Double) -> Unit)

external fun lookup(hostname: String, family: Number, callback: (err: ErrnoException?, address: String, family: Double) -> Unit)

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 0 or not provided, then IPv4 and IPv6 addresses are both returned if found.

Link copied to clipboard
external fun lookupAsync(hostname: String): Promise<LookupAddress>
external fun lookupAsync(hostname: String, options: LookupOneOptions): Promise<LookupAddress>
external fun lookupAsync(hostname: String, options: LookupOptions): Promise<Any>

external fun lookupAsync(hostname: String, family: Number): Promise<LookupAddress>

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 IPv4 and IPv6 addresses are both returned if found.

Link copied to clipboard

external fun lookupService(address: String, port: Number, callback: (err: ErrnoException?, hostname: String, service: String) -> Unit)

Resolves the given address and port into a host name and service using the operating system's underlying getnameinfo implementation.

Link copied to clipboard

Resolves the given address and port into a host name and service using the operating system's underlying getnameinfo implementation.

Link copied to clipboard
suspend fun resolve(hostname: String): ReadonlyArray<String>
suspend fun resolve(hostname: String, rrtype: String): Any
suspend fun resolve(hostname: String, rrtype: ResourceRecordType.A): ReadonlyArray<String>
suspend fun resolve(hostname: String, rrtype: ResourceRecordType.AAAA): ReadonlyArray<String>
suspend fun resolve(hostname: String, rrtype: ResourceRecordType.ANY): ReadonlyArray<AnyRecord>
suspend fun resolve(hostname: String, rrtype: ResourceRecordType.CAA): ReadonlyArray<CaaRecord>
suspend fun resolve(hostname: String, rrtype: ResourceRecordType.CNAME): ReadonlyArray<String>
suspend fun resolve(hostname: String, rrtype: ResourceRecordType.MX): ReadonlyArray<MxRecord>
suspend fun resolve(hostname: String, rrtype: ResourceRecordType.NS): ReadonlyArray<String>
suspend fun resolve(hostname: String, rrtype: ResourceRecordType.PTR): ReadonlyArray<String>
suspend fun resolve(hostname: String, rrtype: ResourceRecordType.SOA): SoaRecord
suspend fun resolve(hostname: String, rrtype: ResourceRecordType.SRV): ReadonlyArray<SrvRecord>
external fun resolve(hostname: String, rrtype: String, callback: (err: ErrnoException?, addresses: Any) -> Unit)
external fun resolve(hostname: String, rrtype: ResourceRecordType.A, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)
external fun resolve(hostname: String, rrtype: ResourceRecordType.AAAA, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)
external fun resolve(hostname: String, rrtype: ResourceRecordType.ANY, callback: (err: ErrnoException?, ReadonlyArray<AnyRecord>) -> Unit)
external fun resolve(hostname: String, rrtype: ResourceRecordType.CNAME, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)
external fun resolve(hostname: String, rrtype: ResourceRecordType.MX, callback: (err: ErrnoException?, ReadonlyArray<MxRecord>) -> Unit)
external fun resolve(hostname: String, rrtype: ResourceRecordType.NAPTR, callback: (err: ErrnoException?, ReadonlyArray<NaptrRecord>) -> Unit)
external fun resolve(hostname: String, rrtype: ResourceRecordType.NS, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)
external fun resolve(hostname: String, rrtype: ResourceRecordType.PTR, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)
external fun resolve(hostname: String, rrtype: ResourceRecordType.SOA, callback: (err: ErrnoException?, addresses: SoaRecord) -> Unit)
external fun resolve(hostname: String, rrtype: ResourceRecordType.SRV, callback: (err: ErrnoException?, ReadonlyArray<SrvRecord>) -> Unit)
external fun resolve(hostname: String, rrtype: ResourceRecordType.TXT, callback: (err: ErrnoException?, ReadonlyArray<ReadonlyArray<String>>) -> Unit)

external fun resolve(hostname: String, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)

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:

Link copied to clipboard
suspend fun resolve4(hostname: String): ReadonlyArray<String>
suspend fun resolve4(hostname: String, options: ResolveOptions): Any
external fun resolve4(hostname: String, options: ResolveOptions, callback: (err: ErrnoException?, addresses: Any) -> Unit)
external fun resolve4(hostname: String, options: ResolveWithTtlOptions, callback: (err: ErrnoException?, ReadonlyArray<RecordWithTtl>) -> Unit)

external fun resolve4(hostname: String, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)

Uses the DNS protocol to resolve a 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']).

Link copied to clipboard
external fun resolve4Async(hostname: String): Promise<ReadonlyArray<String>>

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']).

external fun resolve4Async(hostname: String, options: ResolveOptions): Promise<Any>
Link copied to clipboard
suspend fun resolve6(hostname: String): ReadonlyArray<String>
suspend fun resolve6(hostname: String, options: ResolveOptions): Any
external fun resolve6(hostname: String, options: ResolveOptions, callback: (err: ErrnoException?, addresses: Any) -> Unit)
external fun resolve6(hostname: String, options: ResolveWithTtlOptions, callback: (err: ErrnoException?, ReadonlyArray<RecordWithTtl>) -> Unit)

external fun resolve6(hostname: String, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)

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.

Link copied to clipboard
external fun resolve6Async(hostname: String): Promise<ReadonlyArray<String>>

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.

external fun resolve6Async(hostname: String, options: ResolveOptions): Promise<Any>
Link copied to clipboard
suspend fun resolveAny(hostname: String): ReadonlyArray<AnyRecord>

external fun resolveAny(hostname: String, callback: (err: ErrnoException?, ReadonlyArray<AnyRecord>) -> Unit)

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:

Link copied to clipboard

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:

Link copied to clipboard
external fun resolveAsync(hostname: String): Promise<ReadonlyArray<String>>

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:

external fun resolveAsync(hostname: String, rrtype: String): Promise<Any>
external fun resolveAsync(hostname: String, rrtype: ResourceRecordType.SOA): Promise<SoaRecord>
Link copied to clipboard
suspend fun resolveCaa(hostname: String): ReadonlyArray<CaaRecord>

external fun resolveCaa(hostname: String, callback: (err: ErrnoException?, ReadonlyArray<CaaRecord>) -> Unit)

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'}]).

Link copied to clipboard

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'}]).

Link copied to clipboard
suspend fun resolveCname(hostname: String): ReadonlyArray<String>

external fun resolveCname(hostname: String, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)

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']).

Link copied to clipboard

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']).

Link copied to clipboard
suspend fun resolveMx(hostname: String): ReadonlyArray<MxRecord>

external fun resolveMx(hostname: String, callback: (err: ErrnoException?, ReadonlyArray<MxRecord>) -> Unit)

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'}, ...]).

Link copied to clipboard

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'}, ...]).

Link copied to clipboard
suspend fun resolveNaptr(hostname: String): ReadonlyArray<NaptrRecord>

external fun resolveNaptr(hostname: String, callback: (err: ErrnoException?, ReadonlyArray<NaptrRecord>) -> Unit)

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:

Link copied to clipboard

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:

Link copied to clipboard
suspend fun resolveNs(hostname: String): ReadonlyArray<String>

external fun resolveNs(hostname: String, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)

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']).

Link copied to clipboard
external fun resolveNsAsync(hostname: String): Promise<ReadonlyArray<String>>

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']).

Link copied to clipboard
suspend fun resolvePtr(hostname: String): ReadonlyArray<String>

external fun resolvePtr(hostname: String, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)

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.

Link copied to clipboard

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.

Link copied to clipboard
suspend fun resolveSoa(hostname: String): SoaRecord

external fun resolveSoa(hostname: String, callback: (err: ErrnoException?, address: SoaRecord) -> Unit)

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:

Link copied to clipboard
external fun resolveSoaAsync(hostname: String): Promise<SoaRecord>

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:

Link copied to clipboard
suspend fun resolveSrv(hostname: String): ReadonlyArray<SrvRecord>

external fun resolveSrv(hostname: String, callback: (err: ErrnoException?, ReadonlyArray<SrvRecord>) -> Unit)

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:

Link copied to clipboard

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:

Link copied to clipboard

external fun resolveTxt(hostname: String, callback: (err: ErrnoException?, ReadonlyArray<ReadonlyArray<String>>) -> Unit)

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.

Link copied to clipboard

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.

Link copied to clipboard
suspend fun reverse(ip: String): ReadonlyArray<String>

external fun reverse(ip: String, callback: (err: ErrnoException?, ReadonlyArray<String>) -> Unit)

Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an array of host names.

Link copied to clipboard

Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an array of host names.

Link copied to clipboard

Set the default value of order in {@link lookup} and dnsPromises.lookup(). The value could be:

Link copied to clipboard
external fun setServers(servers: ReadonlyArray<String>)

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.