From 8960b9ae2a3278fec51cf39359573ad94ae7155b Mon Sep 17 00:00:00 2001 From: tigerbot Date: Mon, 22 May 2017 15:05:48 -0600 Subject: [PATCH] added random ID to all aditional record responses --- examples/cloud-respond.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/examples/cloud-respond.js b/examples/cloud-respond.js index 7fe5957..bd983c4 100644 --- a/examples/cloud-respond.js +++ b/examples/cloud-respond.js @@ -39,9 +39,19 @@ module.exports.respond = function (socket, packets, rinfo) { , additional: [] , edns_options: [] }; + + var myRndId = 'be1af7a'; + + rpacket.answer.push({ + name: q.name + , typeName: 'PTR' + , ttl: 10 + , className: 'IN' + , data: myRndId + '.' + queryname + }); + var ifaces = os.networkInterfaces(); //var llRe = /^(fe80|169)/i; // link-local - Object.keys(ifaces).forEach(function (iname) { var iface = ifaces[iname]; @@ -52,7 +62,7 @@ module.exports.respond = function (socket, packets, rinfo) { iface.forEach(function (pface) { rpacket.additional.push({ - name: q.name + name: myRndId + '.' + q.name , typeName: ('IPv4' === pface.family ? 'A' : 'AAAA') , ttl: 10 , className: 'IN' @@ -61,14 +71,6 @@ module.exports.respond = function (socket, packets, rinfo) { }); }); - var myRndId = 'be1af7a'; - rpacket.answer.push({ - name: q.name - , typeName: 'PTR' - , ttl: 10 - , className: 'IN' - , data: myRndId + '.' + queryname - }); rpacket.additional.push({ name: myRndId + '.' + queryname , typeName: 'SRV'