Merge branch 'creationix/add-missing-dns-types' into 'master'
Add missing dns type IDs to mapping table See merge request !2
This commit is contained in:
commit
8fc78f35f0
59
dns.types.js
59
dns.types.js
|
@ -2,22 +2,55 @@
|
|||
'use strict';
|
||||
|
||||
var types = exports.DNS_TYPES = {
|
||||
A: 0x01 // 1
|
||||
, NS: 0x02 // 2
|
||||
, CNAME: 0x05 // 5
|
||||
, SOA: 0x06 // 6
|
||||
, PTR: 0x0c // 12
|
||||
, MX: 0x0f // 15
|
||||
, TXT: 0x10 // 16
|
||||
, AAAA: 0x1c // 28
|
||||
, SRV: 0x21 // 33
|
||||
, OPT: 0x29 // 41
|
||||
, ANY: 0xff // 255
|
||||
A: 0x1 // 1
|
||||
, NS: 0x2 // 2
|
||||
, CNAME: 0x5 // 5
|
||||
, SOA: 0x6 // 6
|
||||
, NULL: 0xa // 10
|
||||
, PTR: 0xc // 12
|
||||
, HINFO: 0xd // 13
|
||||
, MX: 0xf // 15
|
||||
, TXT: 0x10 // 16
|
||||
, RP: 0x11 // 17
|
||||
, AFSDB: 0x12 // 18
|
||||
, SIG: 0x18 // 24
|
||||
, KEY: 0x19 // 25
|
||||
, AAAA: 0x1c // 28
|
||||
, LOC: 0x1d // 29
|
||||
, SRV: 0x21 // 33
|
||||
, NAPTR: 0x23 // 35
|
||||
, KX: 0x24 // 36
|
||||
, CERT: 0x25 // 37
|
||||
, DNAME: 0x27 // 39
|
||||
, OPT: 0x29 // 41
|
||||
, APL: 0x2a // 42
|
||||
, DS: 0x2b // 43
|
||||
, SSHFP: 0x2c // 44
|
||||
, IPSECKEY: 0x2d // 45
|
||||
, RRSIG: 0x2e // 46
|
||||
, NSEC: 0x2f // 47
|
||||
, DNSKEY: 0x30 // 48
|
||||
, DHCID: 0x31 // 49
|
||||
, NSEC3: 0x32 // 50
|
||||
, NSEC3PARAM: 0x33 // 51
|
||||
, TLSA: 0x34 // 52
|
||||
, HIP: 0x37 // 55
|
||||
, CDS: 0x3b // 59
|
||||
, CDNSKEY: 0x3c // 60
|
||||
, SPF: 0x63 // 99
|
||||
, TKEY: 0xf9 // 249
|
||||
, TSIG: 0xfa // 250
|
||||
, IXFR: 0xfb // 251
|
||||
, AXFR: 0xfc // 252
|
||||
, ANY: 0xff // 255
|
||||
, CAA: 0x101 // 257
|
||||
, TA: 0x8000 // 32768
|
||||
, DLV: 0x8001 // 32769
|
||||
};
|
||||
|
||||
// and in reverse
|
||||
Object.keys(types).forEach(function (key) {
|
||||
for (var key in types) {
|
||||
types[types[key]] = key;
|
||||
});
|
||||
}
|
||||
|
||||
}('undefined' !== typeof window ? window : exports));
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
(function (exports) {
|
||||
'use strict';
|
||||
|
||||
// A Certification Authority Authorization (CAA) record is used to specify which
|
||||
// certificate authorities (CAs) are allowed to issue certificates for a domain.
|
||||
|
||||
// Value Meaning/Use
|
||||
//
|
||||
// Flag An unsigned integer between 0-255.
|
||||
// It is currently used to represent the critical flag, that has a
|
||||
// specific meaning per RFC 6844
|
||||
// Tag An ASCII string that represents the identifier of the property
|
||||
// represented by the record.
|
||||
// Value The value associated with the tag.
|
||||
|
||||
// The RFC currently defines 3 available tags:
|
||||
//
|
||||
// - issue: explicity authorizes a single certificate authority to issue a
|
||||
// certificate (any type) for the hostname.
|
||||
// - issuewild: explicity authorizes a single certificate authority to issue a
|
||||
// wildcard certificate (and only wildcard) for the hostname.
|
||||
// - iodef: specifies an URL to which a certificate authority may report
|
||||
// policy violations.
|
||||
|
||||
exports.DNS_PARSER_TYPE_CAA = function (ab, packet, record) {
|
||||
|
||||
var data = new Uint8Array(ab);
|
||||
var i = record.rdstart;
|
||||
var flag = data[i++];
|
||||
var mid = data[i++];
|
||||
mid += i;
|
||||
var end = record.rdstart + record.rdlength;
|
||||
var tag = '', value = '';
|
||||
while (i < mid) { tag += String.fromCharCode(data[i++]); }
|
||||
while (i < end) { value += String.fromCharCode(data[i++]); }
|
||||
|
||||
record.flag = flag;
|
||||
record.tag = tag;
|
||||
record.value = value;
|
||||
|
||||
return record;
|
||||
};
|
||||
|
||||
}('undefined' !== typeof window ? window : exports));
|
Loading…
Reference in New Issue