diff --git a/dns.rdata.parse.js b/dns.rdata.parse.js index 894c808..d360974 100644 --- a/dns.rdata.parse.js +++ b/dns.rdata.parse.js @@ -27,7 +27,7 @@ exports.DNS_RDATA_PARSE = function (ab, packet, record) { try { parser = exports['DNS_TYPE_' + record.typeName] - || require('./dns.type.' + record.typeName.toLowerCase()); + || require('./dns.type.' + record.typeName.toLowerCase())['DNS_TYPE_' + record.typeName]; } catch (e) { /*console.error(e)*/ } diff --git a/dns.type.a.js b/dns.type.a.js new file mode 100644 index 0000000..906af75 --- /dev/null +++ b/dns.type.a.js @@ -0,0 +1,11 @@ +(function (exports) { +'use strict'; + +exports.DNS_TYPE_A = function (rdata) { + var ui8 = new Uint8Array(rdata); + + // i.e. 127.0.0.1 + return ui8[0] + '.' + ui8[1] + '.' + ui8[2] + '.' + ui8[3]; +}; + +}('undefined' !== typeof window ? window : exports));