阿西河

所有教程

公众号
🌙
阿西河前端的公众号

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      Node.js dns dnsPromises.Resolver 类

      Node.js dns dnsPromises.Resolver 类 新增于: v10.6.0

      An independent resolver for DNS requests.

      Note that creating a new resolver uses the default server settings. Setting the servers used for a resolver using resolver.setServers() does not affect other resolvers:

      const { Resolver } = require('dns').promises;
      const resolver = new Resolver();
      resolver.setServers(['4.4.4.4']);
      
      // This request will use the server at 4.4.4.4, independent of global settings.
      resolver.resolve4('example.org').then((addresses) => {
        // ...
      });
      
      // Alternatively, the same code can be written using async-await style.
      (async function() {
        const addresses = await resolver.resolve4('example.org');
      })();
      

      The following methods from the dnsPromises API are available:

      • resolver.getServers()
      • resolver.resolve()
      • resolver.resolve4()
      • resolver.resolve6()
      • resolver.resolveAny()
      • resolver.resolveCname()
      • resolver.resolveMx()
      • resolver.resolveNaptr()
      • resolver.resolveNs()
      • resolver.resolvePtr()
      • resolver.resolveSoa()
      • resolver.resolveSrv()
      • resolver.resolveTxt()
      • resolver.reverse()
      • resolver.setServers()

      更多内容请参考:Node.js dns 域名服务器,或者通过 点击对应菜单 进行查看;


      目录
      本文目录
      目录