2017-01-27 02:18:46 +00:00
|
|
|
(function (exports) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// Value: IP Address
|
|
|
|
// Meaning:Use: 16 octets represting the IP address
|
|
|
|
|
2017-01-29 01:35:57 +00:00
|
|
|
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));
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
2017-01-27 02:18:46 +00:00
|
|
|
};
|
|
|
|
}('undefined' !== typeof window ? window : exports));
|