added demo.html file, finished MX record type parser.
This commit is contained in:
parent
5f048f3486
commit
095def0fda
|
@ -0,0 +1,7 @@
|
|||
<!--
|
||||
|
||||
This demo is meant to have 3 feilds that accept base-64, hex and array values the user
|
||||
can copy in, and a button that will call the dns parser to parse the input and display
|
||||
the output in a seperate field.
|
||||
|
||||
-->
|
|
@ -11,4 +11,3 @@ exports.DNS_TYPE_CNAME = function (ab, packet, record) {
|
|||
};
|
||||
|
||||
}('undefined' !== typeof window ? window : exports));
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ exports.DNS_TYPE_MX = function (ab, packet, record) {
|
|||
for (var i = 0; i < dv.byteLength; i += 1) {
|
||||
|
||||
|
||||
console.log(dv.getUint8(i, false.toString(16)));
|
||||
// console.log(dv.getUint8(i, false.toString(16)));
|
||||
//Priority is the first two bytes
|
||||
if (i < 2){
|
||||
|
||||
|
@ -53,7 +53,7 @@ exports.DNS_TYPE_MX = function (ab, packet, record) {
|
|||
console.log("data at index " + i + ":" + temp);
|
||||
|
||||
// I need to place the '.' in the correct place. This is wrong though.
|
||||
if ((temp.trim() === '' && i > 2) || (!temp.match(/^[a-zA-Z0-9._-]+$/) && i > 2)) {
|
||||
if ((temp.trim() === '' && i > 2) /*|| (!temp.match(/^[a-zA-Z0-9._-]+$/) && i > 2)*/) {
|
||||
s.exchange += ".";
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ exports.DNS_TYPE_MX = function (ab, packet, record) {
|
|||
|
||||
// the below code returns an empty string.
|
||||
|
||||
// s.exchange = unpackLabels(new Uint8Array(ab), record.rdstart, { byteLength: 0, cpcount: 0, labels: [], name: '' }).labels;
|
||||
s.exchange = unpackLabels(new Uint8Array(ab), record.rdstart+2, { byteLength: 0, cpcount: 0, labels: [], name: '' }).labels;
|
||||
|
||||
return s;
|
||||
|
||||
|
|
Loading…
Reference in New Issue