Updates to improve mDNS support #2
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var classes = exports.DNS_CLASSES = {
|
var classes = exports.DNS_CLASSES = {
|
||||||
|
@ -9,4 +9,4 @@ Object.keys(classes).forEach(function (key) {
|
||||||
classes[classes[key]] = key;
|
classes[classes[key]] = key;
|
||||||
});
|
});
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
4
dns.js
4
dns.js
|
@ -1,4 +1,4 @@
|
||||||
;(function (exports) {
|
// ;(function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var Parser = (exports.DNS_PARSER || require('./dns.parser.js').DNS_PARSER);
|
var Parser = (exports.DNS_PARSER || require('./dns.parser.js').DNS_PARSER);
|
||||||
|
@ -55,4 +55,4 @@ if ('undefined' !== typeof module) {
|
||||||
exports.Packer = exports.DNS_PACKER;
|
exports.Packer = exports.DNS_PACKER;
|
||||||
}
|
}
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var opcodes = exports.DNS_OPCODES = {
|
var opcodes = exports.DNS_OPCODES = {
|
||||||
|
@ -10,4 +10,4 @@ Object.keys(opcodes).forEach(function (key) {
|
||||||
opcodes[opcodes[key]] = key;
|
opcodes[opcodes[key]] = key;
|
||||||
});
|
});
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var classes = exports.DNS_CLASSES || require('./dns.classes.js').DNS_CLASSES;
|
var classes = exports.DNS_CLASSES || require('./dns.classes.js').DNS_CLASSES;
|
||||||
|
@ -166,4 +166,4 @@ var dnspack = exports.DNS_PACKER = {
|
||||||
};
|
};
|
||||||
dnspack.packRdata = exports.DNS_RDATA_PACK || require('./dns.rdata.pack.js').DNS_RDATA_PACK;
|
dnspack.packRdata = exports.DNS_RDATA_PACK || require('./dns.rdata.pack.js').DNS_RDATA_PACK;
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
;(function (exports) {
|
// ;(function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var pdns = exports.DNS_PARSER = {};
|
var pdns = exports.DNS_PARSER = {};
|
||||||
|
@ -143,6 +143,10 @@ pdns.unpack = function (ab) {
|
||||||
total += 2;
|
total += 2;
|
||||||
q.byteLength = total - ototal;
|
q.byteLength = total - ototal;
|
||||||
|
|
||||||
|
// mDNS uses the MS bit of class to request a unicast response
|
||||||
|
q.unicastResponse = (q.class & 0x8000) !== 0;
|
||||||
|
q.class &= 0x7fff;
|
||||||
|
|
||||||
q.className = classes[q.class];
|
q.className = classes[q.class];
|
||||||
q.typeName = types[q.type];
|
q.typeName = types[q.type];
|
||||||
|
|
||||||
|
@ -194,6 +198,7 @@ pdns.unpack = function (ab) {
|
||||||
q.rdlength = dv.getUint16(total, false);
|
q.rdlength = dv.getUint16(total, false);
|
||||||
total += 2;
|
total += 2;
|
||||||
|
|
||||||
|
q.class &= 0x7fff;
|
||||||
q.className = classes[q.class];
|
q.className = classes[q.class];
|
||||||
q.typeName = types[q.type];
|
q.typeName = types[q.type];
|
||||||
|
|
||||||
|
@ -259,4 +264,4 @@ pdns.unpack = function (ab) {
|
||||||
};
|
};
|
||||||
pdns.unpackRdata = exports.DNS_RDATA_PARSE || require('./dns.rdata.parse.js').DNS_RDATA_PARSE;
|
pdns.unpackRdata = exports.DNS_RDATA_PARSE || require('./dns.rdata.parse.js').DNS_RDATA_PARSE;
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var rcodes = exports.DNS_RCODES = {
|
var rcodes = exports.DNS_RCODES = {
|
||||||
|
@ -12,4 +12,4 @@ Object.keys(rcodes).forEach(function (key) {
|
||||||
rcodes[rcodes[key]] = key;
|
rcodes[rcodes[key]] = key;
|
||||||
});
|
});
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var classes = exports.DNS_CLASSES || require('./dns.classes.js').DNS_CLASSES;
|
var classes = exports.DNS_CLASSES || require('./dns.classes.js').DNS_CLASSES;
|
||||||
|
@ -42,4 +42,4 @@ exports.DNS_RDATA_PACK = function (ab, dv, total, record) {
|
||||||
return packer(ab, dv, total, record);
|
return packer(ab, dv, total, record);
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
exports.DNS_RDATA_PARSE = function (ab, packet, record) {
|
exports.DNS_RDATA_PARSE = function (ab, packet, record) {
|
||||||
|
@ -45,4 +45,4 @@ exports.DNS_RDATA_PARSE = function (ab, packet, record) {
|
||||||
return parser(ab.slice(0, record.rdstart + record.rdlength), packet, record);
|
return parser(ab.slice(0, record.rdstart + record.rdlength), packet, record);
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,4 +9,4 @@ exports.DNS_TYPE_ANY = function (rdata) {
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var types = exports.DNS_TYPES = {
|
var types = exports.DNS_TYPES = {
|
||||||
|
@ -53,4 +53,4 @@ Object.keys(types).forEach(function (key) {
|
||||||
types[types[key]] = key;
|
types[types[key]] = key;
|
||||||
});
|
});
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// unpack labels with 0x20 compression pointer support
|
// unpack labels with 0x20 compression pointer support
|
||||||
|
@ -96,4 +96,4 @@ exports.DNS_UNPACK_LABELS = function (ui8, ptr, q) {
|
||||||
return q;
|
return q;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// An 'A' record is a 32-bit value representing the IP address
|
// An 'A' record is a 32-bit value representing the IP address
|
||||||
|
@ -23,4 +23,4 @@ exports.DNS_PACKER_TYPE_A = function (ab, dv, total, record) {
|
||||||
return total;
|
return total;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// 'AAAA'
|
// 'AAAA'
|
||||||
|
@ -38,4 +38,4 @@ exports.DNS_PACKER_TYPE_AAAA = function (ab, dv, total, record) {
|
||||||
return total;
|
return total;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// RFC 6844
|
// RFC 6844
|
||||||
|
@ -66,4 +66,4 @@ exports.DNS_PACKER_TYPE_CAA = function (ab, dv, total, record) {
|
||||||
return total;
|
return total;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// A 'CNAME' record is a 32-bit value representing the IP address
|
// A 'CNAME' record is a 32-bit value representing the IP address
|
||||||
|
@ -34,4 +34,4 @@ exports.DNS_PACKER_TYPE_CNAME = function (ab, dv, total, record) {
|
||||||
return total;
|
return total;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// An 'MX' record is a 32-bit value representing the IP address
|
// An 'MX' record is a 32-bit value representing the IP address
|
||||||
|
@ -41,4 +41,4 @@ exports.DNS_PACKER_TYPE_MX = function (ab, dv, total, record) {
|
||||||
return total;
|
return total;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// NOTE: this should be EXACTLY the same as PTR
|
// NOTE: this should be EXACTLY the same as PTR
|
||||||
|
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// NS name for the supplied domain. May be label, pointer or any combination
|
// NS name for the supplied domain. May be label, pointer or any combination
|
||||||
|
@ -33,4 +33,4 @@ exports.DNS_PACKER_TYPE_NS = function (ab, dv, total, record) {
|
||||||
return total;
|
return total;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// NOTE: this should be EXACTLY the same as NS
|
// NOTE: this should be EXACTLY the same as NS
|
||||||
|
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// The host name that represents the supplied UP address
|
// The host name that represents the supplied UP address
|
||||||
|
@ -34,4 +34,4 @@ exports.DNS_PACKER_TYPE_PTR = function (ab, dv, total, record) {
|
||||||
return total;
|
return total;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// http://www.zytrax.com/books/dns/ch8/soa.html
|
// http://www.zytrax.com/books/dns/ch8/soa.html
|
||||||
|
@ -101,4 +101,4 @@ exports.DNS_PACKER_TYPE_SOA = function (ab, dv, total, record) {
|
||||||
return total;
|
return total;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// SRV RDATA contains:
|
// SRV RDATA contains:
|
||||||
|
@ -70,4 +70,4 @@ exports.DNS_PACKER_TYPE_SRV = function (ab, dv, total, record) {
|
||||||
return total;
|
return total;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Record type is just any text.
|
// Record type is just any text.
|
||||||
|
@ -44,4 +44,4 @@ exports.DNS_PACKER_TYPE_TXT = function (ab, dv, total, record) {
|
||||||
return total;
|
return total;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Put some documentation here in these comments.
|
// Put some documentation here in these comments.
|
||||||
|
@ -113,4 +113,4 @@ exports.DNS_PARSER_TYPE_MX = function (ab, packet, record) {
|
||||||
return record;
|
return record;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// An 'A' record is a 32-bit value representing the IP address
|
// An 'A' record is a 32-bit value representing the IP address
|
||||||
|
@ -11,4 +11,4 @@ exports.DNS_PARSER_TYPE_A = function (ab, packet, record) {
|
||||||
return record;
|
return record;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Value: IP Address
|
// Value: IP Address
|
||||||
|
@ -45,4 +45,4 @@ exports.DNS_PARSER_TYPE_AAAA = function (ab, packet, record) {
|
||||||
return record;
|
return record;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// RFC 6844 https://tools.ietf.org/html/rfc6844#section-3
|
// RFC 6844 https://tools.ietf.org/html/rfc6844#section-3
|
||||||
|
@ -54,4 +54,4 @@ exports.DNS_PARSER_TYPE_CAA = function (ab, packet, record) {
|
||||||
return record;
|
return record;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// A CNAME reocord maps a single alias or nickname to the real or
|
// A CNAME reocord maps a single alias or nickname to the real or
|
||||||
|
@ -11,4 +11,4 @@ exports.DNS_PARSER_TYPE_CNAME = function (ab, packet, record) {
|
||||||
return record;
|
return record;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Value: Preference
|
// Value: Preference
|
||||||
|
@ -22,5 +22,5 @@ exports.DNS_PARSER_TYPE_MX = function (ab, packet, record) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// FORMAT:
|
// FORMAT:
|
||||||
|
@ -20,4 +20,4 @@ exports.DNS_PARSER_TYPE_NS = function (ab , packet, record) {
|
||||||
return record;
|
return record;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
// (function (exports) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
exports.DNS_PARSER_TYPE_NSEC = function (ab, packet, record) {
|
||||||
|
|
||||||
|
var rdataAb = ab.slice(record.rdstart,record.rdstart + record.rdlength)
|
||||||
|
var dv = new DataView(rdataAb);
|
||||||
|
|
||||||
|
// !!! Not actually implemented !!!
|
||||||
|
record.priority = 0;
|
||||||
|
record.weight = 0;
|
||||||
|
record.port = 0;
|
||||||
|
record.target = null;
|
||||||
|
|
||||||
|
return record;
|
||||||
|
|
||||||
|
};
|
||||||
|
// }('undefined' !== typeof window ? window : exports));
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Pointer records are the opposite of A and AAAA and are
|
// Pointer records are the opposite of A and AAAA and are
|
||||||
|
@ -18,4 +18,4 @@ exports.DNS_PARSER_TYPE_PTR = function (ab, pack, record) {
|
||||||
record.data = labelInfo.name;
|
record.data = labelInfo.name;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Value Meaning/Use
|
// Value Meaning/Use
|
||||||
|
@ -73,4 +73,4 @@ exports.DNS_PARSER_TYPE_SOA = function (ab, packet, record) {
|
||||||
return record;
|
return record;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// SRV identifies the host(s) that will support a particular service. It
|
// SRV identifies the host(s) that will support a particular service. It
|
||||||
|
@ -19,4 +19,4 @@ exports.DNS_PARSER_TYPE_SRV = function (ab, packet, record) {
|
||||||
return record;
|
return record;
|
||||||
|
|
||||||
};
|
};
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function (exports) {
|
// (function (exports) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Used to provide the ability to associate some arbitrary and unformatted text
|
// Used to provide the ability to associate some arbitrary and unformatted text
|
||||||
|
@ -10,9 +10,9 @@ var unpackLabels = exports.DNS_UNPACK_LABELS || require('../dns.unpack-labels.js
|
||||||
exports.DNS_PARSER_TYPE_TXT = function (ab, packet, record) {
|
exports.DNS_PARSER_TYPE_TXT = function (ab, packet, record) {
|
||||||
|
|
||||||
var labels = unpackLabels(new Uint8Array(ab), record.rdstart, { byteLength: 0, cpcount: 0, labels: [], name: '' });
|
var labels = unpackLabels(new Uint8Array(ab), record.rdstart, { byteLength: 0, cpcount: 0, labels: [], name: '' });
|
||||||
record.data = [ labels.name ];
|
record.data = labels.labels;
|
||||||
|
|
||||||
return record;
|
return record;
|
||||||
};
|
};
|
||||||
|
|
||||||
}('undefined' !== typeof window ? window : exports));
|
// }('undefined' !== typeof window ? window : exports));
|
||||||
|
|
Loading…
Reference in New Issue