dnsPromises.setDefaultResultOrder(order)


  • order <string> 必须是 'ipv4first''ipv6first''verbatim'

    ¥order <string> must be 'ipv4first', 'ipv6first' or 'verbatim'.

dns.lookup()dnsPromises.lookup() 中设置 order 的默认值。该值可能是:

¥Set the default value of order in dns.lookup() and dnsPromises.lookup(). The value could be:

  • ipv4first:将默认 order 设置为 ipv4first

    ¥ipv4first: sets default order to ipv4first.

  • ipv6first:将默认 order 设置为 ipv6first

    ¥ipv6first: sets default order to ipv6first.

  • verbatim:将默认 order 设置为 verbatim

    ¥verbatim: sets default order to verbatim.

默认为 verbatim,并且 dnsPromises.setDefaultResultOrder() 的优先级高于 --dns-result-order。当使用 工作线程 时,主线程中的 dnsPromises.setDefaultResultOrder() 不会影响 worker 中的默认 dns 命令。

¥The default is verbatim and dnsPromises.setDefaultResultOrder() have higher priority than --dns-result-order. When using worker threads, dnsPromises.setDefaultResultOrder() from the main thread won't affect the default dns orders in workers.