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


  • hostname <string> 需要解析的主机名。
  • options <Object>  - ttl <boolean> 记录每一条记录的存活次数 (TTL)。如果为 true, 返回的结果将会为 Object 的数组,就像 { address: '1.2.3.4', ttl: 60 } 带有 TTL 秒数的记录,而不是 string 的数组.
  • callback <Function>

使用DNS协议解析IPv4地址主机名(A记录)。adresses参数是传递给callback函数的IPv4地址数组。(例如:['74.125.79.104', '74.125.79.105', '74.125.79.106']

  • hostname <string> Hostname to resolve.
  • options <Object>

    • ttl <boolean> Retrieve 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']).