AAAA now passes the native dns tests.

This commit is contained in:
dwes7 2017-01-28 18:35:57 -07:00
parent 88093062a2
commit a05b5d27f2
1 changed files with 26 additions and 18 deletions

View File

@ -4,28 +4,36 @@
// Value: IP Address
// Meaning:Use: 16 octets represting the IP address
exports.DNS_TYPE_AAAA = function (ab, packet, record) {
var ui8 = record.rdata;
console.log("ByteLength: " + ui8.byteLength);
console.log("normal length: " + ui8.length);
var s = '';
var z = 0;
for (var i = 0; i < ui8.length; i += 1) {
console.log(ui8[i].toString(16));
exports.DNS_TYPE_AAAA = function (rdata) {
console.log('*****************************************');
// // var rrTokens = rdata.trim().split(/\s+/g);
// // var len = rrTokens.length;
// // var result = {
// // name: rrTokens[0],
// // ip: rrTokens[len-1]
// // };
// // if(!isNaN(rrTokens[1])) result.ttl = parseInt(rrTokens[1], 10);
// // return result;
// console.log(rdata.length.toString());
// var ui8 = new Uint8Array(rdata);
if (i%2 === 1 && ui8[i].toString(16).length < 2) {
s = s + '0' + ui8[i].toString(16);
} else {
s = s + ui8[i].toString(16);
if (ui8[i].toString(16) === '0' && i%2 === 0){
s = s.substring(0, s.length-1);
}
}
if (i%2 === 1) {
s = s + ":"
}
if (i === 15) {
s = s.substring(0, s.length-1);
}
}
console.log(s);
return s;
};
}('undefined' !== typeof window ? window : exports));