added demo.html file, finished MX record type parser.

这个提交包含在:
Daplie 2017-02-01 19:45:03 -07:00
父节点 5f048f3486
当前提交 095def0fda
共有 3 个文件被更改,包括 10 次插入4 次删除

7
demo.html 普通文件
查看文件

@ -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;