如何使用node.js检查域的the CAA(Certification Authority Authorization)记录?
我发现dnscaa能够检查CAA记录。但它是用go。写的。
Node.js v9.3.0 Documentation没有resolveCaa()
函数来检查域的CAA记录。
答案 0 :(得分:1)
我发现我可以使用dns-socket
来询问域名的CAA记录。例如,如果我想检查www.google.com
的CAA记录,我可以使用以下代码。
var dns = require('dns-socket')
var socket = dns()
socket.query({
questions: [{
type: 'CAA',
name: 'google.com'
}]
}, 53, '8.8.8.8', function (err, res) {
console.log(res, err)
socket.destroy()
})
结果将是:
{ id: 19712,
type: 'response',
flags: 384,
questions: [ { name: 'google.com', type: 'CAA', class: 1 } ],
answers:
[ { name: 'google.com',
type: 'CAA',
class: 1,
ttl: 21561,
flush: false,
data: [Object] } ],
authorities: [],
additionals: [] } null