@nictool/dns-resource-record 1.5.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/rr/https.js CHANGED
@@ -32,6 +32,10 @@ export default class HTTPS extends RR {
32
32
  return 'HTTP Semantics'
33
33
  }
34
34
 
35
+ getTags() {
36
+ return ['common']
37
+ }
38
+
35
39
  getRdataFields(arg) {
36
40
  return ['priority', 'target name', 'params']
37
41
  }
@@ -44,6 +48,18 @@ export default class HTTPS extends RR {
44
48
  return 65
45
49
  }
46
50
 
51
+ getCanonical() {
52
+ return {
53
+ owner: 'example.com.',
54
+ ttl: 3600,
55
+ class: 'IN',
56
+ type: 'HTTPS',
57
+ priority: 1,
58
+ 'target name': 'example.com.',
59
+ params: 'alpn="h2,h3"',
60
+ }
61
+ }
62
+
47
63
  /****** IMPORTERS *******/
48
64
 
49
65
  fromBind({ bindline }) {
package/rr/ipseckey.js CHANGED
@@ -71,6 +71,10 @@ export default class IPSECKEY extends RR {
71
71
  return 'IPsec Keying'
72
72
  }
73
73
 
74
+ getTags() {
75
+ return ['security']
76
+ }
77
+
74
78
  getRdataFields(arg) {
75
79
  return ['precedence', 'gateway type', 'algorithm', 'gateway', 'publickey']
76
80
  }
@@ -134,7 +138,7 @@ export default class IPSECKEY extends RR {
134
138
  octalKey = rdata.slice(28)
135
139
  break
136
140
  case 2: // 16-byte IPv6
137
- gateway = TINYDNS.octalToHex(rdata.slice(12, 76))
141
+ gateway = TINYDNS.octalToIPv6(rdata.slice(12, 76))
138
142
  octalKey = rdata.slice(76)
139
143
  break
140
144
  case 3: // wire encoded domain name
package/rr/key.js CHANGED
@@ -63,6 +63,19 @@ export default class KEY extends RR {
63
63
  return 25
64
64
  }
65
65
 
66
+ getCanonical() {
67
+ return {
68
+ owner: 'example.com.',
69
+ ttl: 3600,
70
+ class: 'IN',
71
+ type: 'KEY',
72
+ flags: 256,
73
+ protocol: 3,
74
+ algorithm: 5,
75
+ publickey: 'AQPSKAsj8...',
76
+ }
77
+ }
78
+
66
79
  /****** IMPORTERS *******/
67
80
 
68
81
  fromBind({ bindline }) {
package/rr/loc.js CHANGED
@@ -48,6 +48,16 @@ export default class LOC extends RR {
48
48
  return 29
49
49
  }
50
50
 
51
+ getCanonical() {
52
+ return {
53
+ owner: 'example.com.',
54
+ ttl: 3600,
55
+ class: 'IN',
56
+ type: 'LOC',
57
+ address: '52 22 23.000 N 4 53 32.000 E 10m 100m 10m 2m',
58
+ }
59
+ }
60
+
51
61
  parseLoc(string) {
52
62
  // d1 [m1 [s1]]
53
63
  const dms = '(\\d+)\\s+(?:(\\d+)\\s+)?(?:([\\d.]+)\\s+)?'
package/rr/mx.js CHANGED
@@ -29,6 +29,10 @@ export default class MX extends RR {
29
29
  return 'Mail Exchanger'
30
30
  }
31
31
 
32
+ getTags() {
33
+ return ['common']
34
+ }
35
+
32
36
  getRdataFields(arg) {
33
37
  return ['preference', 'exchange']
34
38
  }
@@ -47,7 +51,7 @@ export default class MX extends RR {
47
51
  ttl: 43200,
48
52
  class: 'IN',
49
53
  type: 'MX',
50
- preference: 0,
54
+ preference: 10,
51
55
  exchange: 'mail.example.com.',
52
56
  }
53
57
  }
@@ -84,6 +88,12 @@ export default class MX extends RR {
84
88
  }
85
89
 
86
90
  /****** EXPORTERS *******/
91
+ getWireRdata() {
92
+ const pref = Buffer.alloc(2)
93
+ pref.writeUInt16BE(this.get('preference'))
94
+ return Buffer.concat([pref, this.wirePackDomain(this.get('exchange'))])
95
+ }
96
+
87
97
  toBind(zone_opts) {
88
98
  return `${this.getPrefix(zone_opts)}\t${this.get('preference')}\t${this.getFQDN('exchange', zone_opts)}\n`
89
99
  }
package/rr/naptr.js CHANGED
@@ -21,13 +21,28 @@ export default class NAPTR extends RR {
21
21
  }
22
22
 
23
23
  getRFCs() {
24
- return [2915, 3403]
24
+ return [2915, 3403, 4848]
25
25
  }
26
26
 
27
27
  getTypeId() {
28
28
  return 35
29
29
  }
30
30
 
31
+ getCanonical() {
32
+ return {
33
+ owner: 'cid.urn.arpa.',
34
+ ttl: 3600,
35
+ class: 'IN',
36
+ type: 'NAPTR',
37
+ order: 100,
38
+ preference: 10,
39
+ flags: 'S',
40
+ service: 'z3950+N2L+N2R',
41
+ regexp: '',
42
+ replacement: 'gatekeeper.example.com.',
43
+ }
44
+ }
45
+
31
46
  /****** Resource record specific setters *******/
32
47
  setOrder(val) {
33
48
  this.is16bitInt('NAPTR', 'order', val)
package/rr/ns.js CHANGED
@@ -21,6 +21,10 @@ export default class NS extends RR {
21
21
  return 'Name Server'
22
22
  }
23
23
 
24
+ getTags() {
25
+ return ['common']
26
+ }
27
+
24
28
  getRdataFields(arg) {
25
29
  return ['dname']
26
30
  }
@@ -33,6 +37,16 @@ export default class NS extends RR {
33
37
  return 2
34
38
  }
35
39
 
40
+ getCanonical() {
41
+ return {
42
+ owner: 'example.com.',
43
+ ttl: 3600,
44
+ class: 'IN',
45
+ type: 'NS',
46
+ dname: 'ns1.example.com.',
47
+ }
48
+ }
49
+
36
50
  /****** IMPORTERS *******/
37
51
  fromTinydns({ tinyline }) {
38
52
  // &fqdn:ip:x:ttl:timestamp:lo
@@ -63,6 +77,10 @@ export default class NS extends RR {
63
77
  }
64
78
 
65
79
  /****** EXPORTERS *******/
80
+ getWireRdata() {
81
+ return this.wirePackDomain(this.get('dname'))
82
+ }
83
+
66
84
  toBind(zone_opts) {
67
85
  return `${this.getPrefix(zone_opts)}\t${this.getFQDN('dname', zone_opts)}\n`
68
86
  }
package/rr/nsec.js CHANGED
@@ -29,6 +29,10 @@ export default class NSEC extends RR {
29
29
  return 'Next Secure'
30
30
  }
31
31
 
32
+ getTags() {
33
+ return ['dnssec']
34
+ }
35
+
32
36
  getRdataFields(arg) {
33
37
  return ['next domain', 'type bit maps']
34
38
  }
@@ -41,6 +45,17 @@ export default class NSEC extends RR {
41
45
  return 47
42
46
  }
43
47
 
48
+ getCanonical() {
49
+ return {
50
+ owner: 'alfa.example.com.',
51
+ ttl: 3600,
52
+ class: 'IN',
53
+ type: 'NSEC',
54
+ 'next domain': 'host.example.com.',
55
+ 'type bit maps': 'A MX RRSIG NSEC TYPE1234',
56
+ }
57
+ }
58
+
44
59
  /****** IMPORTERS *******/
45
60
 
46
61
  fromTinydns({ tinyline }) {
package/rr/nsec3.js CHANGED
@@ -64,6 +64,10 @@ export default class NSEC3 extends RR {
64
64
  return 'Next Secure'
65
65
  }
66
66
 
67
+ getTags() {
68
+ return ['dnssec']
69
+ }
70
+
67
71
  getRdataFields(arg) {
68
72
  return ['hash algorithm', 'flags', 'iterations', 'salt', 'next hashed owner name', 'type bit maps']
69
73
  }
@@ -76,6 +80,21 @@ export default class NSEC3 extends RR {
76
80
  return 50
77
81
  }
78
82
 
83
+ getCanonical() {
84
+ return {
85
+ owner: 'test.example.com.',
86
+ ttl: 3600,
87
+ class: 'IN',
88
+ type: 'NSEC3',
89
+ 'hash algorithm': 1,
90
+ flags: 1,
91
+ iterations: 12,
92
+ salt: 'aabbccdd',
93
+ 'next hashed owner name': '2vptu5timamqttgl4luu9kg21e0aor3s',
94
+ 'type bit maps': 'A RRSIG',
95
+ }
96
+ }
97
+
79
98
  /****** IMPORTERS *******/
80
99
 
81
100
  fromBind({ bindline }) {
package/rr/nsec3param.js CHANGED
@@ -57,6 +57,10 @@ export default class NSEC3PARAM extends RR {
57
57
  return 'Next Secure Parameters'
58
58
  }
59
59
 
60
+ getTags() {
61
+ return ['dnssec']
62
+ }
63
+
60
64
  getRdataFields(arg) {
61
65
  return ['hash algorithm', 'flags', 'iterations', 'salt']
62
66
  }
@@ -69,6 +73,19 @@ export default class NSEC3PARAM extends RR {
69
73
  return 51
70
74
  }
71
75
 
76
+ getCanonical() {
77
+ return {
78
+ owner: 'example.com.',
79
+ ttl: 3600,
80
+ class: 'IN',
81
+ type: 'NSEC3PARAM',
82
+ 'hash algorithm': 1,
83
+ flags: 1,
84
+ iterations: 12,
85
+ salt: 'aabbccdd',
86
+ }
87
+ }
88
+
72
89
  /****** IMPORTERS *******/
73
90
 
74
91
  fromBind({ bindline }) {
package/rr/nxt.js CHANGED
@@ -29,6 +29,10 @@ export default class NXT extends RR {
29
29
  return 'Next Secure'
30
30
  }
31
31
 
32
+ getTags() {
33
+ return ['deprecated']
34
+ }
35
+
32
36
  getRdataFields(arg) {
33
37
  return ['next domain', 'type bit map']
34
38
  }
@@ -41,6 +45,17 @@ export default class NXT extends RR {
41
45
  return 30
42
46
  }
43
47
 
48
+ getCanonical() {
49
+ return {
50
+ owner: 'big.example.com.',
51
+ ttl: 3600,
52
+ class: 'IN',
53
+ type: 'NXT',
54
+ 'next domain': 'host.example.com.',
55
+ 'type bit map': 'A MX NXT',
56
+ }
57
+ }
58
+
44
59
  /****** IMPORTERS *******/
45
60
 
46
61
  fromTinydns({ tinyline }) {
package/rr/openpgpkey.js CHANGED
@@ -15,6 +15,10 @@ export default class OPENPGPKEY extends RR {
15
15
  return 'OpenPGP Public Key'
16
16
  }
17
17
 
18
+ getTags() {
19
+ return ['security']
20
+ }
21
+
18
22
  getRdataFields() {
19
23
  return ['public key']
20
24
  }
@@ -27,6 +31,16 @@ export default class OPENPGPKEY extends RR {
27
31
  return 61
28
32
  }
29
33
 
34
+ getCanonical() {
35
+ return {
36
+ owner: 'matt.example.com.',
37
+ ttl: 3600,
38
+ class: 'IN',
39
+ type: 'OPENPGPKEY',
40
+ 'public key': 'mQINBFY...',
41
+ }
42
+ }
43
+
30
44
  /****** IMPORTERS *******/
31
45
  fromBind({ bindline: bindline }) {
32
46
  // test.example.com 3600 IN OPENPGPKEY <base64 public key>
package/rr/ptr.js CHANGED
@@ -18,6 +18,10 @@ export default class PTR extends RR {
18
18
  return 'Pointer'
19
19
  }
20
20
 
21
+ getTags() {
22
+ return ['common']
23
+ }
24
+
21
25
  getRdataFields(arg) {
22
26
  return ['dname']
23
27
  }
@@ -30,6 +34,16 @@ export default class PTR extends RR {
30
34
  return 12
31
35
  }
32
36
 
37
+ getCanonical() {
38
+ return {
39
+ owner: '2.2.0.192.in-addr.arpa.',
40
+ ttl: 3600,
41
+ class: 'IN',
42
+ type: 'PTR',
43
+ dname: 'host.example.com.',
44
+ }
45
+ }
46
+
33
47
  /****** IMPORTERS *******/
34
48
  fromTinydns({ tinyline }) {
35
49
  // ^fqdn:p:ttl:timestamp:lo
@@ -58,6 +72,10 @@ export default class PTR extends RR {
58
72
  }
59
73
 
60
74
  /****** EXPORTERS *******/
75
+ getWireRdata() {
76
+ return this.wirePackDomain(this.get('dname'))
77
+ }
78
+
61
79
  toTinydns() {
62
80
  return `^${this.getTinyFQDN('owner')}:${this.getTinyFQDN('dname')}:${this.getTinydnsPostamble()}\n`
63
81
  }
package/rr/rp.js CHANGED
@@ -28,6 +28,10 @@ export default class RP extends RR {
28
28
  return 'Responsible Person'
29
29
  }
30
30
 
31
+ getTags() {
32
+ return ['obsolete']
33
+ }
34
+
31
35
  getRdataFields(arg) {
32
36
  return ['mbox', 'txt']
33
37
  }
package/rr/rrsig.js CHANGED
@@ -78,6 +78,10 @@ export default class RRSIG extends RR {
78
78
  return 'Resource Record Signature'
79
79
  }
80
80
 
81
+ getTags() {
82
+ return ['dnssec']
83
+ }
84
+
81
85
  getRdataFields(arg) {
82
86
  return [
83
87
  'type covered',
@@ -100,6 +104,24 @@ export default class RRSIG extends RR {
100
104
  return 46
101
105
  }
102
106
 
107
+ getCanonical() {
108
+ return {
109
+ owner: 'example.com.',
110
+ ttl: 3600,
111
+ class: 'IN',
112
+ type: 'RRSIG',
113
+ 'type covered': 1,
114
+ algorithm: 5,
115
+ labels: 3,
116
+ 'original ttl': 3600,
117
+ 'signature expiration': 1045053120,
118
+ 'signature inception': 1042461120,
119
+ 'key tag': 12345,
120
+ 'signers name': 'example.com.',
121
+ signature: 'ABCDEF...',
122
+ }
123
+ }
124
+
103
125
  /****** IMPORTERS *******/
104
126
 
105
127
  fromBind({ bindline }) {
package/rr/sig.js CHANGED
@@ -68,6 +68,10 @@ export default class SIG extends RR {
68
68
  return 'Signature'
69
69
  }
70
70
 
71
+ getTags() {
72
+ return ['obsolete']
73
+ }
74
+
71
75
  getRdataFields(arg) {
72
76
  return [
73
77
  'type covered',
@@ -83,13 +87,31 @@ export default class SIG extends RR {
83
87
  }
84
88
 
85
89
  getRFCs() {
86
- return [2535]
90
+ return [2535, 3755]
87
91
  }
88
92
 
89
93
  getTypeId() {
90
94
  return 24
91
95
  }
92
96
 
97
+ getCanonical() {
98
+ return {
99
+ owner: 'example.com.',
100
+ ttl: 3600,
101
+ class: 'IN',
102
+ type: 'SIG',
103
+ 'type covered': 1,
104
+ algorithm: 5,
105
+ labels: 3,
106
+ 'original ttl': 3600,
107
+ 'signature expiration': 1045053120,
108
+ 'signature inception': 1042461120,
109
+ 'key tag': 12345,
110
+ 'signers name': 'example.com.',
111
+ signature: 'ABCDEF...',
112
+ }
113
+ }
114
+
93
115
  /****** IMPORTERS *******/
94
116
 
95
117
  fromBind({ bindline }) {
package/rr/smimea.js CHANGED
@@ -58,6 +58,10 @@ export default class SMIMEA extends RR {
58
58
  return 'S/MIME cert association'
59
59
  }
60
60
 
61
+ getTags() {
62
+ return ['security']
63
+ }
64
+
61
65
  getRdataFields(arg) {
62
66
  return ['certificate usage', 'selector', 'matching type', 'certificate association data']
63
67
  }
@@ -70,6 +74,19 @@ export default class SMIMEA extends RR {
70
74
  return 53
71
75
  }
72
76
 
77
+ getCanonical() {
78
+ return {
79
+ owner: '_443._tcp.www.example.com.',
80
+ ttl: 3600,
81
+ class: 'IN',
82
+ type: 'SMIMEA',
83
+ 'certificate usage': 0,
84
+ selector: 0,
85
+ 'matching type': 1,
86
+ 'certificate association data': 'ABCDEF...',
87
+ }
88
+ }
89
+
73
90
  getQuotedFields() {
74
91
  return []
75
92
  }
package/rr/soa.js CHANGED
@@ -83,6 +83,22 @@ export default class SOA extends RR {
83
83
  return 6
84
84
  }
85
85
 
86
+ getCanonical() {
87
+ return {
88
+ owner: 'example.com.',
89
+ ttl: 3600,
90
+ class: 'IN',
91
+ type: 'SOA',
92
+ mname: 'ns1.example.com.',
93
+ rname: 'admin.example.com.',
94
+ serial: 2023051001,
95
+ refresh: 7200,
96
+ retry: 3600,
97
+ expire: 1209600,
98
+ minimum: 3600,
99
+ }
100
+ }
101
+
86
102
  /****** IMPORTERS *******/
87
103
  fromBind({ bindline }) {
88
104
  // example.com TTL IN SOA mname rname serial refresh retry expire minimum
@@ -136,6 +152,20 @@ export default class SOA extends RR {
136
152
  .join('\t')} ~\n`
137
153
  }
138
154
 
155
+ getWireRdata() {
156
+ const nums = Buffer.alloc(20)
157
+ nums.writeUInt32BE(this.get('serial'), 0)
158
+ nums.writeUInt32BE(this.get('refresh'), 4)
159
+ nums.writeUInt32BE(this.get('retry'), 8)
160
+ nums.writeUInt32BE(this.get('expire'), 12)
161
+ nums.writeUInt32BE(this.get('minimum'), 16)
162
+ return Buffer.concat([
163
+ this.wirePackDomain(this.get('mname')),
164
+ this.wirePackDomain(this.get('rname')),
165
+ nums,
166
+ ])
167
+ }
168
+
139
169
  toTinydns() {
140
170
  return `Z${this.getTinyFQDN('owner')}:${this.getTinyFQDN('mname')}:${this.getTinyFQDN('rname')}:${this.getEmpty('serial')}:${this.getEmpty('refresh')}:${this.getEmpty('retry')}:${this.getEmpty('expire')}:${this.getEmpty('minimum')}:${this.getTinydnsPostamble()}\n`
141
171
  }
package/rr/spf.js CHANGED
@@ -18,6 +18,10 @@ export default class SPF extends TXT {
18
18
  return 'Sender Policy Framework'
19
19
  }
20
20
 
21
+ getTags() {
22
+ return ['deprecated']
23
+ }
24
+
21
25
  getRdataFields(arg) {
22
26
  return ['data']
23
27
  }
@@ -30,6 +34,16 @@ export default class SPF extends TXT {
30
34
  return 99
31
35
  }
32
36
 
37
+ getCanonical() {
38
+ return {
39
+ owner: 'example.com.',
40
+ ttl: 3600,
41
+ class: 'IN',
42
+ type: 'SPF',
43
+ data: 'v=spf1 mx -all',
44
+ }
45
+ }
46
+
33
47
  /****** IMPORTERS *******/
34
48
  fromTinydns({ tinyline }) {
35
49
  // SPF via generic, :fqdn:n:rdata:ttl:timestamp:lo
package/rr/srv.js CHANGED
@@ -41,6 +41,10 @@ export default class SRV extends RR {
41
41
  return 'Service'
42
42
  }
43
43
 
44
+ getTags() {
45
+ return ['common']
46
+ }
47
+
44
48
  getRdataFields(arg) {
45
49
  return ['priority', 'weight', 'port', 'target']
46
50
  }
@@ -53,6 +57,19 @@ export default class SRV extends RR {
53
57
  return 33
54
58
  }
55
59
 
60
+ getCanonical() {
61
+ return {
62
+ owner: '_imaps._tcp.example.com.',
63
+ ttl: 3600,
64
+ class: 'IN',
65
+ type: 'SRV',
66
+ priority: 10,
67
+ weight: 10,
68
+ port: 993,
69
+ target: 'mail.example.com.',
70
+ }
71
+ }
72
+
56
73
  /****** IMPORTERS *******/
57
74
  fromTinydns({ tinyline }) {
58
75
  const str = tinyline
package/rr/sshfp.js CHANGED
@@ -46,6 +46,10 @@ export default class SSHFP extends RR {
46
46
  return 'Secure Shell Key Fingerprints'
47
47
  }
48
48
 
49
+ getTags() {
50
+ return ['security']
51
+ }
52
+
49
53
  getRdataFields() {
50
54
  return ['algorithm', 'fptype', 'fingerprint']
51
55
  }
@@ -58,6 +62,18 @@ export default class SSHFP extends RR {
58
62
  return 44
59
63
  }
60
64
 
65
+ getCanonical() {
66
+ return {
67
+ owner: 'mail.example.com.',
68
+ ttl: 3600,
69
+ class: 'IN',
70
+ type: 'SSHFP',
71
+ algorithm: 2,
72
+ fptype: 1,
73
+ fingerprint: '123456789abcdef6789abcdf6789abdf6789abcd',
74
+ }
75
+ }
76
+
61
77
  /****** IMPORTERS *******/
62
78
  fromTinydns({ tinyline }) {
63
79
  // SSHFP via generic, :fqdn:n:rdata:ttl:timestamp:lo
package/rr/svcb.js CHANGED
@@ -44,6 +44,18 @@ export default class SVCB extends RR {
44
44
  return 64
45
45
  }
46
46
 
47
+ getCanonical() {
48
+ return {
49
+ owner: '_8443._foo.api.example.com.',
50
+ ttl: 3600,
51
+ class: 'IN',
52
+ type: 'SVCB',
53
+ priority: 1,
54
+ 'target name': 'svc4.example.net.',
55
+ params: 'alpn="h2,h3"',
56
+ }
57
+ }
58
+
47
59
  /****** IMPORTERS *******/
48
60
 
49
61
  fromBind({ bindline }) {
package/rr/tlsa.js CHANGED
@@ -58,18 +58,35 @@ export default class TLSA extends RR {
58
58
  return 'TLSA certificate association'
59
59
  }
60
60
 
61
+ getTags() {
62
+ return ['security']
63
+ }
64
+
61
65
  getRdataFields(arg) {
62
66
  return ['certificate usage', 'selector', 'matching type', 'certificate association data']
63
67
  }
64
68
 
65
69
  getRFCs() {
66
- return [6698]
70
+ return [6698, 7671]
67
71
  }
68
72
 
69
73
  getTypeId() {
70
74
  return 52
71
75
  }
72
76
 
77
+ getCanonical() {
78
+ return {
79
+ owner: '_443._tcp.www.example.com.',
80
+ ttl: 3600,
81
+ class: 'IN',
82
+ type: 'TLSA',
83
+ 'certificate usage': 3,
84
+ selector: 1,
85
+ 'matching type': 1,
86
+ 'certificate association data': 'ABCDEF...',
87
+ }
88
+ }
89
+
73
90
  getQuotedFields() {
74
91
  return []
75
92
  }