dns.resolve4(hostname[, options], callback)


使用域名系统协议为 hostname 解析 IPv4 地址(A 记录)。 传给 callback 函数的 addresses 参数将包含 IPv4 地址的数组(例如 ['74.125.79.104', '74.125.79.105', '74.125.79.106'])。

  • hostname <string> Host name to resolve.
  • options <Object>
    • ttl <boolean> Retrieves the Time-To-Live value (TTL) of each record. When true, the callback receives an array of { address: '1.2.3.4', ttl: 60 } objects rather than an array of strings, with the TTL expressed in seconds.
  • callback <Function>

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