dns.resolve()

dns.resolve(hostname[, rrtype], callback)

Uses the DNS protocol to resolve a hostname (e.g. 'nodejs.org') into an array of the record types specified by rrtype.

Valid values for rrtype are:

  • 'A' - IPV4 addresses, default
  • 'AAAA' - IPV6 addresses
  • 'MX' - mail exchange records
  • 'TXT' - text records
  • 'SRV' - SRV records
  • 'PTR' - used for reverse IP lookups
  • 'NS' - name server records
  • 'CNAME' - canonical name records
  • 'SOA' - start of authority record

The callback function has arguments (err, addresses). When successful, addresses will be an array. The type of each item in addresses is determined by the record type, and described in the documentation for the corresponding lookup methods.

On error, err is an Error object, where err.code is one of the error codes listed here.

doc_Nodejs
2016-04-30 04:38:55
Comments
Leave a Comment

Please login to continue.