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
Link copied to clipboard
Link copied to clipboard
external val ALL: Double
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

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
external fun getServers(): <Error class: unknown class><String>

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 external fun lookup(hostname: String): LookupAddress
external fun lookup(hostname: String, callback: (err: ErrnoException?, address: String, family: Double) -> Unit)
suspend external fun lookup(hostname: String, family: Number): LookupAddress
suspend external fun lookup(hostname: String, options: LookupAllOptions): <Error class: unknown class><LookupAddress>
suspend external fun lookup(hostname: String, options: LookupOneOptions): LookupAddress
suspend external fun lookup(hostname: String, options: LookupOptions): Any
external fun lookup(    hostname: String,     options: LookupAllOptions,     callback: (err: ErrnoException?, <Error class: unknown class><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): <Error class: unknown class><LookupAddress>
external fun lookupAsync(    hostname: String,     options: LookupAllOptions): <Error class: unknown class><<Error class: unknown class><LookupAddress>>
external fun lookupAsync(hostname: String, options: LookupOneOptions): <Error class: unknown class><LookupAddress>
external fun lookupAsync(hostname: String, options: LookupOptions): <Error class: unknown class><Any>

external fun lookupAsync(hostname: String, family: Number): <Error class: unknown class><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
suspend external fun lookupService(address: String, port: Number): LookupServiceResultPayload

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
external fun lookupServiceAsync(address: String, port: Number): <Error class: unknown class><LookupServiceResultPayload>

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 external fun resolve(hostname: String): <Error class: unknown class><String>
suspend external fun resolve(hostname: String, rrtype: String): Any
suspend external fun resolve(hostname: String, rrtype: ResourceRecordType.A): <Error class: unknown class><String>
suspend external fun resolve(hostname: String, rrtype: ResourceRecordType.AAAA): <Error class: unknown class><String>
suspend external fun resolve(hostname: String, rrtype: ResourceRecordType.ANY): <Error class: unknown class><AnyRecord>
suspend external fun resolve(hostname: String, rrtype: ResourceRecordType.CAA): <Error class: unknown class><CaaRecord>
suspend external fun resolve(hostname: String, rrtype: ResourceRecordType.CNAME): <Error class: unknown class><String>
suspend external fun resolve(hostname: String, rrtype: ResourceRecordType.MX): <Error class: unknown class><MxRecord>
suspend external fun resolve(hostname: String, rrtype: ResourceRecordType.NAPTR): <Error class: unknown class><NaptrRecord>
suspend external fun resolve(hostname: String, rrtype: ResourceRecordType.NS): <Error class: unknown class><String>
suspend external fun resolve(hostname: String, rrtype: ResourceRecordType.PTR): <Error class: unknown class><String>
suspend external fun resolve(hostname: String, rrtype: ResourceRecordType.SOA): SoaRecord
suspend external fun resolve(hostname: String, rrtype: ResourceRecordType.SRV): <Error class: unknown class><SrvRecord>
suspend external fun resolve(    hostname: String,     rrtype: ResourceRecordType.TXT): <Error class: unknown class><<Error class: unknown class><String>>
external fun resolve(hostname: String, rrtype: String, callback: (err: ErrnoException?, addresses: Any) -> Unit)
external fun resolve(hostname: String, rrtype: ResourceRecordType.A, callback: (err: ErrnoException?, <Error class: unknown class><String>) -> Unit)
external fun resolve(    hostname: String,     rrtype: ResourceRecordType.AAAA,     callback: (err: ErrnoException?, <Error class: unknown class><String>) -> Unit)
external fun resolve(    hostname: String,     rrtype: ResourceRecordType.ANY,     callback: (err: ErrnoException?, <Error class: unknown class><AnyRecord>) -> Unit)
external fun resolve(    hostname: String,     rrtype: ResourceRecordType.CNAME,     callback: (err: ErrnoException?, <Error class: unknown class><String>) -> Unit)
external fun resolve(    hostname: String,     rrtype: ResourceRecordType.MX,     callback: (err: ErrnoException?, <Error class: unknown class><MxRecord>) -> Unit)
external fun resolve(    hostname: String,     rrtype: ResourceRecordType.NAPTR,     callback: (err: ErrnoException?, <Error class: unknown class><NaptrRecord>) -> Unit)
external fun resolve(    hostname: String,     rrtype: ResourceRecordType.NS,     callback: (err: ErrnoException?, <Error class: unknown class><String>) -> Unit)
external fun resolve(    hostname: String,     rrtype: ResourceRecordType.PTR,     callback: (err: ErrnoException?, <Error class: unknown class><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?, <Error class: unknown class><SrvRecord>) -> Unit)
external fun resolve(    hostname: String,     rrtype: ResourceRecordType.TXT,     callback: (err: ErrnoException?, <Error class: unknown class><<Error class: unknown class><String>>) -> Unit)

external fun resolve(hostname: String, callback: (err: ErrnoException?, <Error class: unknown class><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 external fun resolve4(hostname: String): <Error class: unknown class><String>
suspend external fun resolve4(hostname: String, options: ResolveOptions): Any
suspend external fun resolve4(hostname: String, options: ResolveWithTtlOptions): <Error class: unknown class><RecordWithTtl>
external fun resolve4(hostname: String, options: ResolveOptions, callback: (err: ErrnoException?, addresses: Any) -> Unit)
external fun resolve4(    hostname: String,     options: ResolveWithTtlOptions,     callback: (err: ErrnoException?, <Error class: unknown class><RecordWithTtl>) -> Unit)

external fun resolve4(hostname: String, callback: (err: ErrnoException?, <Error class: unknown class><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): <Error class: unknown class><<Error class: unknown class><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): <Error class: unknown class><Any>
external fun resolve4Async(    hostname: String,     options: ResolveWithTtlOptions): <Error class: unknown class><<Error class: unknown class><RecordWithTtl>>
Link copied to clipboard
suspend external fun resolve6(hostname: String): <Error class: unknown class><String>
suspend external fun resolve6(hostname: String, options: ResolveOptions): Any
suspend external fun resolve6(hostname: String, options: ResolveWithTtlOptions): <Error class: unknown class><RecordWithTtl>
external fun resolve6(hostname: String, options: ResolveOptions, callback: (err: ErrnoException?, addresses: Any) -> Unit)
external fun resolve6(    hostname: String,     options: ResolveWithTtlOptions,     callback: (err: ErrnoException?, <Error class: unknown class><RecordWithTtl>) -> Unit)

external fun resolve6(hostname: String, callback: (err: ErrnoException?, <Error class: unknown class><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): <Error class: unknown class><<Error class: unknown class><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): <Error class: unknown class><Any>
external fun resolve6Async(    hostname: String,     options: ResolveWithTtlOptions): <Error class: unknown class><<Error class: unknown class><RecordWithTtl>>
Link copied to clipboard
suspend external fun resolveAny(hostname: String): <Error class: unknown class><AnyRecord>

external fun resolveAny(hostname: String, callback: (err: ErrnoException?, <Error class: unknown class><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
external fun resolveAnyAsync(hostname: String): <Error class: unknown class><<Error class: unknown class><AnyRecord>>

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): <Error class: unknown class><<Error class: unknown class><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): <Error class: unknown class><Any>
external fun resolveAsync(hostname: String, rrtype: ResourceRecordType.A): <Error class: unknown class><<Error class: unknown class><String>>
external fun resolveAsync(    hostname: String,     rrtype: ResourceRecordType.AAAA): <Error class: unknown class><<Error class: unknown class><String>>
external fun resolveAsync(    hostname: String,     rrtype: ResourceRecordType.ANY): <Error class: unknown class><<Error class: unknown class><AnyRecord>>
external fun resolveAsync(    hostname: String,     rrtype: ResourceRecordType.CAA): <Error class: unknown class><<Error class: unknown class><CaaRecord>>
external fun resolveAsync(    hostname: String,     rrtype: ResourceRecordType.CNAME): <Error class: unknown class><<Error class: unknown class><String>>
external fun resolveAsync(    hostname: String,     rrtype: ResourceRecordType.MX): <Error class: unknown class><<Error class: unknown class><MxRecord>>
external fun resolveAsync(    hostname: String,     rrtype: ResourceRecordType.NAPTR): <Error class: unknown class><<Error class: unknown class><NaptrRecord>>
external fun resolveAsync(hostname: String, rrtype: ResourceRecordType.NS): <Error class: unknown class><<Error class: unknown class><String>>
external fun resolveAsync(    hostname: String,     rrtype: ResourceRecordType.PTR): <Error class: unknown class><<Error class: unknown class><String>>
external fun resolveAsync(hostname: String, rrtype: ResourceRecordType.SOA): <Error class: unknown class><SoaRecord>
external fun resolveAsync(    hostname: String,     rrtype: ResourceRecordType.SRV): <Error class: unknown class><<Error class: unknown class><SrvRecord>>
external fun resolveAsync(    hostname: String,     rrtype: ResourceRecordType.TXT): <Error class: unknown class><<Error class: unknown class><<Error class: unknown class><String>>>
Link copied to clipboard
suspend external fun resolveCaa(hostname: String): <Error class: unknown class><CaaRecord>

external fun resolveCaa(hostname: String, callback: (err: ErrnoException?, <Error class: unknown class><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
external fun resolveCaaAsync(hostname: String): <Error class: unknown class><<Error class: unknown class><CaaRecord>>

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 external fun resolveCname(hostname: String): <Error class: unknown class><String>

external fun resolveCname(hostname: String, callback: (err: ErrnoException?, <Error class: unknown class><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
external fun resolveCnameAsync(hostname: String): <Error class: unknown class><<Error class: unknown class><String>>

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 external fun resolveMx(hostname: String): <Error class: unknown class><MxRecord>

external fun resolveMx(hostname: String, callback: (err: ErrnoException?, <Error class: unknown class><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
external fun resolveMxAsync(hostname: String): <Error class: unknown class><<Error class: unknown class><MxRecord>>

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 external fun resolveNaptr(hostname: String): <Error class: unknown class><NaptrRecord>

external fun resolveNaptr(hostname: String, callback: (err: ErrnoException?, <Error class: unknown class><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
external fun resolveNaptrAsync(hostname: String): <Error class: unknown class><<Error class: unknown class><NaptrRecord>>

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 external fun resolveNs(hostname: String): <Error class: unknown class><String>

external fun resolveNs(hostname: String, callback: (err: ErrnoException?, <Error class: unknown class><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): <Error class: unknown class><<Error class: unknown class><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 external fun resolvePtr(hostname: String): <Error class: unknown class><String>

external fun resolvePtr(hostname: String, callback: (err: ErrnoException?, <Error class: unknown class><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
external fun resolvePtrAsync(hostname: String): <Error class: unknown class><<Error class: unknown class><String>>

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 external 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): <Error class: unknown class><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 external fun resolveSrv(hostname: String): <Error class: unknown class><SrvRecord>

external fun resolveSrv(hostname: String, callback: (err: ErrnoException?, <Error class: unknown class><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
external fun resolveSrvAsync(hostname: String): <Error class: unknown class><<Error class: unknown class><SrvRecord>>

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
suspend external fun resolveTxt(hostname: String): <Error class: unknown class><<Error class: unknown class><String>>

external fun resolveTxt(    hostname: String,     callback: (err: ErrnoException?, <Error class: unknown class><<Error class: unknown class><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
external fun resolveTxtAsync(    hostname: String): <Error class: unknown class><<Error class: unknown class><<Error class: unknown class><String>>>

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 external fun reverse(ip: String): <Error class: unknown class><String>

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

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

Link copied to clipboard
external fun reverseAsync(ip: String): <Error class: unknown class><<Error class: unknown class><String>>

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: <Error class: unknown class><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.