Source code

Revision control

Copy as Markdown

Other Tools

'use strict'
exports.toString = function (type) {
switch (type) {
case 1: return 'A'
case 10: return 'NULL'
case 28: return 'AAAA'
case 18: return 'AFSDB'
case 42: return 'APL'
case 257: return 'CAA'
case 60: return 'CDNSKEY'
case 59: return 'CDS'
case 37: return 'CERT'
case 5: return 'CNAME'
case 49: return 'DHCID'
case 32769: return 'DLV'
case 39: return 'DNAME'
case 48: return 'DNSKEY'
case 43: return 'DS'
case 55: return 'HIP'
case 13: return 'HINFO'
case 45: return 'IPSECKEY'
case 25: return 'KEY'
case 36: return 'KX'
case 29: return 'LOC'
case 15: return 'MX'
case 35: return 'NAPTR'
case 2: return 'NS'
case 47: return 'NSEC'
case 50: return 'NSEC3'
case 51: return 'NSEC3PARAM'
case 12: return 'PTR'
case 46: return 'RRSIG'
case 17: return 'RP'
case 24: return 'SIG'
case 6: return 'SOA'
case 99: return 'SPF'
case 33: return 'SRV'
case 44: return 'SSHFP'
case 32768: return 'TA'
case 249: return 'TKEY'
case 52: return 'TLSA'
case 250: return 'TSIG'
case 16: return 'TXT'
case 252: return 'AXFR'
case 251: return 'IXFR'
case 41: return 'OPT'
case 255: return 'ANY'
case 65: return 'HTTPS'
}
return 'UNKNOWN_' + type
}
exports.toType = function (name) {
switch (name.toUpperCase()) {
case 'A': return 1
case 'NULL': return 10
case 'AAAA': return 28
case 'AFSDB': return 18
case 'APL': return 42
case 'CAA': return 257
case 'CDNSKEY': return 60
case 'CDS': return 59
case 'CERT': return 37
case 'CNAME': return 5
case 'DHCID': return 49
case 'DLV': return 32769
case 'DNAME': return 39
case 'DNSKEY': return 48
case 'DS': return 43
case 'HIP': return 55
case 'HINFO': return 13
case 'IPSECKEY': return 45
case 'KEY': return 25
case 'KX': return 36
case 'LOC': return 29
case 'MX': return 15
case 'NAPTR': return 35
case 'NS': return 2
case 'NSEC': return 47
case 'NSEC3': return 50
case 'NSEC3PARAM': return 51
case 'PTR': return 12
case 'RRSIG': return 46
case 'RP': return 17
case 'SIG': return 24
case 'SOA': return 6
case 'SPF': return 99
case 'SRV': return 33
case 'SSHFP': return 44
case 'TA': return 32768
case 'TKEY': return 249
case 'TLSA': return 52
case 'TSIG': return 250
case 'TXT': return 16
case 'AXFR': return 252
case 'IXFR': return 251
case 'OPT': return 41
case 'ANY': return 255
case 'HTTPS': return 65
case '*': return 255
}
if (name.toUpperCase().startsWith('UNKNOWN_')) return parseInt(name.slice(8))
return 0
}