简体   繁体   English

node.js dns.resolveAny返回一个空数组

[英]node.js dns.resolveAny returns an empty array

I'm using dns.resolveAny function to check DNS information about some domains. 我正在使用dns.resolveAny函数检查有关某些域的DNS信息。

One thing I found strange is that for some domains, dns.resolveAny returns an empty array while nslookup command doesn't. 我发现奇怪的一件事是,对于某些域, dns.resolveAny返回一个空数组,而nslookup命令却没有。

Here's an example: 这是一个例子:

// node.js version >= 9.2 is required

const dns = require('dns')

dns.resolveAny('www.ifshop.com.tw', (err, ret) => {
  if (err) {
      console.log(`err: ${err}`)
  } else {
      console.log(`ret: ${JSON.stringify(ret)}`)  // JSON.stringify(ret) == [] here
  }
})

resolveAny returns [] . resolveAny返回[] But nslookup successfully returns where www.ifshop.com.tw 's CNAME record. 但是nslookup成功返回了www.ifshop.com.tw的CNAME记录所在的www.ifshop.com.tw

> nslookup www.ifshop.com.tw
Server:     192.168.1.1
Address:    192.168.1.1#53

Non-authoritative answer:
www.ifshop.com.tw   canonical name = s1759.dname.91app.io.
s1759.dname.91app.io    canonical name = proxy.letssl.91app.io.
proxy.letssl.91app.io   canonical name = proxy-letssl-91app-io-196811564.ap-northeast-1.elb.amazonaws.com.
Name:   proxy-letssl-91app-io-196811564.ap-northeast-1.elb.amazonaws.com
Address: 54.178.248.57
Name:   proxy-letssl-91app-io-196811564.ap-northeast-1.elb.amazonaws.com
Address: 52.196.80.17

Why does this happen? 为什么会这样?

Is this a bug of resolveAny ? 这是resolveAny的错误吗?

Or is there a problem in the DNS configuration of www.ifshop.com.tw ? 还是www.ifshop.com.tw的DNS配置中存在问题?

I also found that dns.resolveCname returns CNAME successfully. 我还发现dns.resolveCname成功返回CNAME。

// node.js version >= 9.2 is required

const dns = require('dns')

dns.resolveCname('www.ifshop.com.tw', (err, ret) => {
  if (err) {
      console.log(`err: ${err}`)
  } else {
      console.log(`ret: ${JSON.stringify(ret)}`)
  }
})

Here, JSON.stringify(ret) is equal to ["s1759.dname.91app.io"] . 在这里, JSON.stringify(ret)等于["s1759.dname.91app.io"]

I set the type of nslookup to any . 我将nslookup的类型设置为any Then I found the following information. 然后我发现了以下信息。

nslookup
> set type=any
> www.ifshop.com.tw
Server:     10.11.1.5
Address:    10.11.1.5#53

Non-authoritative answer:
www.ifshop.com.tw   hinfo = "ANY obsoleted" "See draft-ietf-dnsop-refuse-any"

Authoritative answers can be found from:

From the information above, we can infer that the DNS provider refuse to respond to the queries of any type. 从上面的信息中,我们可以推断出DNS提供程序拒绝响应any类型的查询。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM