starting dns record type parsers

This commit is contained in:
Daplie 2017-01-26 19:18:46 -07:00
vecāks 90e8ab6f0b
revīzija d04ea1b172
11 mainīti faili ar 137 papildinājumiem un 4 dzēšanām

Parādīt failu

@ -38,7 +38,7 @@ handlers.onListening = function () {
/*jshint validthis:true*/
var server = this;
console.log(server.address());
server.setBroadcast(true);
server.addMembership('224.0.0.251');
};

Parādīt failu

@ -17,7 +17,6 @@ exports.DNS_RDATA_PARSE = function (ab, packet, record) {
);
}
if (!record.typeName) {
throw new Error("Support for DNS Type " + record.type.toString(16) + "(" + record.type + ")"
+ " is not implemented yet. Open an issue if you actually need support"

Parādīt failu

@ -1,10 +1,12 @@
(function (exports) {
'use strict';
// An 'A' record is a 32-bit value representing the IP address
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];
};

31
dns.type.aaaa.js Normal file
Parādīt failu

@ -0,0 +1,31 @@
(function (exports) {
'use strict';
// Value: IP Address
// Meaning:Use: 16 octets represting the IP address
exports.DNS_TYPE_AAAA = function (rdata) {
console.log('*****************************************');
// // var rrTokens = rdata.trim().split(/\s+/g);
// // var len = rrTokens.length;
// // var result = {
// // name: rrTokens[0],
// // ip: rrTokens[len-1]
// // };
// // if(!isNaN(rrTokens[1])) result.ttl = parseInt(rrTokens[1], 10);
// // return result;
// console.log(rdata.length.toString());
// var ui8 = new Uint8Array(rdata);
};
}('undefined' !== typeof window ? window : exports));

12
dns.type.any.js Normal file
Parādīt failu

@ -0,0 +1,12 @@
(function (exports) {
'use strict';
// TODO. Not yet implemented
// Meaning:Use: Requests ANY resource record (typicall wants SOA,
// MX, NS, and MX)
exports.DNS_TYPE_ANY = function (rdata) {
};
}('undefined' !== typeof window ? window : exports));

19
dns.type.cname.js Normal file
Parādīt failu

@ -0,0 +1,19 @@
(function (exports) {
'use strict';
// TODO. Not yet implemented
// A CNAME reocord maps a single alias or nickname to the real or
// Canonical name which may lie outside the current zone.
// Canonical simply means the expected or real name.
exports.DNS_TYPE_CNAME = function (rdata) {
};
}('undefined' !== typeof window ? window : exports));

21
dns.type.mx.js Normal file
Parādīt failu

@ -0,0 +1,21 @@
(function (exports) {
'use strict';
// TODO. Not yet implemented
// Value: Preference
// Meaning/Use: Unsigned 16-bit integer
//-------------------------------------
// Value: Mail Exchanger
// Meaning/Use: The name host name that provides the service.
// May be a label, pointer or any combination
exports.DNS_TYPE_MX = function (rdata) {
};
}('undefined' !== typeof window ? window : exports));

16
dns.type.ns.js Normal file
Parādīt failu

@ -0,0 +1,16 @@
(function (exports) {
'use strict';
// Comes in variable lengths. It is the name of the primary Master for the Domain.
// For example 'ns1.example.com'
// It may be a label, pointer or any combination
exports.DNS_TYPE_NS = function (rdata) {
};
}('undefined' !== typeof window ? window : exports));

Parādīt failu

@ -0,0 +1,17 @@
(function (exports) {
'use strict';
// TODO. Not yet implemented
// Pointer records are the opposite of A and AAAA and are
// used in Reverse Map zone files to map an IP address (IPv4 or IPv6)
// to a host name.
// FORMAT:
// ame ttl class rr name
// 15 IN PTR www.example.com.
exports.DNS_TYPE_PTR = function (rdata) {
};
}('undefined' !== typeof window ? window : exports));

13
dns.type.srv.js Normal file
Parādīt failu

@ -0,0 +1,13 @@
(function (exports) {
'use strict';
// TODO. Not yet implemented
// SRV identifies the host(s) that will support a particular service. It
// is a general purpose RR to discover any service.
exports.DNS_TYPE_SRV = function (rdata) {
};
}('undefined' !== typeof window ? window : exports));

Parādīt failu

@ -158,7 +158,10 @@ pdns.unpack = function (ab) {
q.className = classes[q.class];
q.typeName = types[q.type];
console.log('*********************');
console.log(q.typeName);
return q;
}