added random ID to all aditional record responses

This commit is contained in:
tigerbot 2017-05-22 15:05:48 -06:00
parent 53cae83af4
commit 8960b9ae2a
1 changed files with 12 additions and 10 deletions

View File

@ -39,9 +39,19 @@ module.exports.respond = function (socket, packets, rinfo) {
, additional: [] , additional: []
, edns_options: [] , 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 ifaces = os.networkInterfaces();
//var llRe = /^(fe80|169)/i; // link-local //var llRe = /^(fe80|169)/i; // link-local
Object.keys(ifaces).forEach(function (iname) { Object.keys(ifaces).forEach(function (iname) {
var iface = ifaces[iname]; var iface = ifaces[iname];
@ -52,7 +62,7 @@ module.exports.respond = function (socket, packets, rinfo) {
iface.forEach(function (pface) { iface.forEach(function (pface) {
rpacket.additional.push({ rpacket.additional.push({
name: q.name name: myRndId + '.' + q.name
, typeName: ('IPv4' === pface.family ? 'A' : 'AAAA') , typeName: ('IPv4' === pface.family ? 'A' : 'AAAA')
, ttl: 10 , ttl: 10
, className: 'IN' , 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({ rpacket.additional.push({
name: myRndId + '.' + queryname name: myRndId + '.' + queryname
, typeName: 'SRV' , typeName: 'SRV'