@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/CHANGELOG.md +19 -0
- package/README.md +91 -79
- package/lib/readme.js +84 -0
- package/lib/tinydns.js +10 -0
- package/package.json +9 -6
- package/rr/a.js +8 -0
- package/rr/aaaa.js +10 -2
- package/rr/caa.js +4 -0
- package/rr/cert.js +13 -0
- package/rr/cname.js +17 -0
- package/rr/dname.js +10 -0
- package/rr/dnskey.js +17 -0
- package/rr/ds.js +17 -0
- package/rr/hinfo.js +15 -0
- package/rr/https.js +16 -0
- package/rr/ipseckey.js +5 -1
- package/rr/key.js +13 -0
- package/rr/loc.js +10 -0
- package/rr/mx.js +11 -1
- package/rr/naptr.js +16 -1
- package/rr/ns.js +18 -0
- package/rr/nsec.js +15 -0
- package/rr/nsec3.js +19 -0
- package/rr/nsec3param.js +17 -0
- package/rr/nxt.js +15 -0
- package/rr/openpgpkey.js +14 -0
- package/rr/ptr.js +18 -0
- package/rr/rp.js +4 -0
- package/rr/rrsig.js +22 -0
- package/rr/sig.js +23 -1
- package/rr/smimea.js +17 -0
- package/rr/soa.js +30 -0
- package/rr/spf.js +14 -0
- package/rr/srv.js +17 -0
- package/rr/sshfp.js +16 -0
- package/rr/svcb.js +12 -0
- package/rr/tlsa.js +18 -1
- package/rr/tsig.js +16 -0
- package/rr/txt.js +36 -1
- package/rr/uri.js +12 -0
- package/rr/wks.js +16 -0
- package/rr.js +57 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ Notable changes to this project are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
#### Unreleased
|
|
6
6
|
|
|
7
|
+
### [1.6.1] - 2026-04-20
|
|
8
|
+
|
|
9
|
+
- doc(README): add wire export format
|
|
10
|
+
- ci: split coverage to new GHA file, trigger on push to main
|
|
11
|
+
|
|
12
|
+
### [1.6.0] - 2026-03-26
|
|
13
|
+
|
|
14
|
+
- feat(toWire): add wire export format to every RR, fixes #23
|
|
15
|
+
- feat(getTags): added to all RR types
|
|
16
|
+
- values: common, obsolete, security, dnssec
|
|
17
|
+
- feat(getCanonical): added to RRs where missing
|
|
18
|
+
- added RFCs to: AAAA 5952, NAPTR 4848, SIG 3755, TLSA 7671
|
|
19
|
+
- TXT: 4408, 6376, 7208
|
|
20
|
+
- doc(README): categorize RR types.
|
|
21
|
+
- doc(README): generate the supported RRs table
|
|
22
|
+
- test: add tests for toWire, getCanonical, getTags
|
|
23
|
+
|
|
7
24
|
### [1.5.0] - 2026-03-22
|
|
8
25
|
|
|
9
26
|
- feat(RRSIG, SIG, TSIG): added toBind, toTinydns, fromTinydns
|
|
@@ -366,3 +383,5 @@ Notable changes to this project are documented in this file.
|
|
|
366
383
|
[1.3.1]: https://github.com/NicTool/dns-resource-record/releases/tag/v1.3.1
|
|
367
384
|
[1.4.0]: https://github.com/NicTool/dns-resource-record/releases/tag/v1.4.0
|
|
368
385
|
[1.5.0]: https://github.com/NicTool/dns-resource-record/releases/tag/v1.5.0
|
|
386
|
+
[1.6.0]: https://github.com/NicTool/dns-resource-record/releases/tag/v1.6.0
|
|
387
|
+
[1.6.1]: https://github.com/NicTool/dns-resource-record/releases/tag/v1.6.1
|
package/README.md
CHANGED
|
@@ -15,11 +15,12 @@ This module is used to:
|
|
|
15
15
|
| **RR format** | **import** | **export** |
|
|
16
16
|
| :------------------------------------------------------: | :----------------: | :----------------: |
|
|
17
17
|
| **JSON** | :white_check_mark: | :white_check_mark: |
|
|
18
|
-
|
|
|
18
|
+
| **[BIND](https://www.isc.org/bind/) / RFC 1035** | :white_check_mark: | :white_check_mark: |
|
|
19
19
|
| **[Tinydns](https://cr.yp.to/djbdns/tinydns-data.html)** | :white_check_mark: | :white_check_mark: |
|
|
20
20
|
| **MaraDNS** | | :white_check_mark: |
|
|
21
21
|
| **JS** | :white_check_mark: | :white_check_mark: |
|
|
22
22
|
| **PowerDNS** | | |
|
|
23
|
+
| **Wire** | | :white_check_mark: |
|
|
23
24
|
|
|
24
25
|
This package intends to import and export RFC compliant DNS resource records. Please [raise an issue](https://github.com/NicTool/dns-resource-record/issues) if a valid resource record fails to pass or an invalid resource record passes.
|
|
25
26
|
|
|
@@ -104,31 +105,41 @@ The setters are named: `set` + `Field`, where field is the resource record field
|
|
|
104
105
|
|
|
105
106
|
## FUNCTIONS
|
|
106
107
|
|
|
107
|
-
|
|
108
|
+
### getCanonical
|
|
109
|
+
|
|
110
|
+
```js
|
|
111
|
+
> console.log(new RR.AAAA(null).getCanonical())
|
|
112
|
+
{
|
|
113
|
+
owner: 'host.example.com.',
|
|
114
|
+
address: '2001:0db8:0020:000a:0000:0000:0000:0004',
|
|
115
|
+
class: 'IN',
|
|
116
|
+
ttl: 3600,
|
|
117
|
+
type: 'AAAA'
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### getFields
|
|
122
|
+
|
|
123
|
+
Get the field names for each RR type
|
|
108
124
|
|
|
109
125
|
```js
|
|
110
126
|
> import * as RR from 'dns-resource-record'
|
|
111
|
-
> new RR.A(null).getFields()
|
|
112
|
-
[ 'owner', 'ttl', 'class', 'type', 'address' ]
|
|
127
|
+
> new RR.A(null).getFields() // [ 'owner', 'ttl', 'class', 'type', 'address' ]
|
|
113
128
|
|
|
114
|
-
> new RR.PTR(null).getFields()
|
|
115
|
-
[ 'owner', 'ttl', 'class', 'type', 'dname' ]
|
|
129
|
+
> new RR.PTR(null).getFields() // [ 'owner', 'ttl', 'class', 'type', 'dname' ]
|
|
116
130
|
|
|
117
131
|
> new RR.SSHFP(null).getFields()
|
|
118
|
-
[ 'owner', 'ttl', 'class', 'type', 'algorithm', 'fptype', 'fingerprint' ]
|
|
132
|
+
// [ 'owner', 'ttl', 'class', 'type', 'algorithm', 'fptype', 'fingerprint' ]
|
|
119
133
|
```
|
|
120
134
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
```js
|
|
124
|
-
> new RR.A(null).getRFCs()
|
|
125
|
-
[ 1035 ]
|
|
135
|
+
### getRFCs
|
|
126
136
|
|
|
127
|
-
|
|
128
|
-
[ 2782 ]
|
|
137
|
+
Get a list of RFCs references for each RR type
|
|
129
138
|
|
|
130
|
-
|
|
131
|
-
[ 1035
|
|
139
|
+
```js
|
|
140
|
+
> new RR.A(null).getRFCs() // [ 1035 ]
|
|
141
|
+
> new RR.SRV(null).getRFCs() // [ 2782 ]
|
|
142
|
+
> new RR.MX(null).getRFCs() // [ 1035, 2181, 7505 ]
|
|
132
143
|
```
|
|
133
144
|
|
|
134
145
|
### toBind
|
|
@@ -137,10 +148,10 @@ Validate a record and export to BIND format.
|
|
|
137
148
|
|
|
138
149
|
```js
|
|
139
150
|
console.log(new RR.A(exampleRRs.A).toBind())
|
|
140
|
-
test.example.com 3600 IN A 192.0.2.127
|
|
151
|
+
// test.example.com 3600 IN A 192.0.2.127
|
|
141
152
|
|
|
142
153
|
console.log(new RR.AAAA(exampleRRs.AAAA).toBind())
|
|
143
|
-
test.example.com 3600 IN AAAA 2605:7900:20:a::4
|
|
154
|
+
// test.example.com 3600 IN AAAA 2605:7900:20:a::4
|
|
144
155
|
```
|
|
145
156
|
|
|
146
157
|
### toTinydns
|
|
@@ -148,19 +159,7 @@ test.example.com 3600 IN AAAA 2605:7900:20:a::4
|
|
|
148
159
|
Validate a record and export to tinydns format:
|
|
149
160
|
|
|
150
161
|
```js
|
|
151
|
-
console.log(new RR.A(exampleRRs.A).toTinydns())
|
|
152
|
-
+test.example.com:192.0.2.127:3600::
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### fromTinydns toBind
|
|
156
|
-
|
|
157
|
-
Convert a tinydns line to BIND:
|
|
158
|
-
|
|
159
|
-
```js
|
|
160
|
-
console.log(new RR.CAA({
|
|
161
|
-
tinyline: ':ns1.example.com:257:\\000\\005issue"http\\072\\057\\057letsencrypt.org":3600::\n'
|
|
162
|
-
}).toBind())
|
|
163
|
-
ns1.example.com 3600 IN CAA 0 issue "http://letsencrypt.org"
|
|
162
|
+
console.log(new RR.A(exampleRRs.A).toTinydns()) // +test.example.com:192.0.2.127:3600::
|
|
164
163
|
```
|
|
165
164
|
|
|
166
165
|
### set
|
|
@@ -180,54 +179,71 @@ A(5) [Map] {
|
|
|
180
179
|
|
|
181
180
|
Consider this a "running with scissors" mode.
|
|
182
181
|
|
|
182
|
+
### fromTinydns toBind
|
|
183
|
+
|
|
184
|
+
Convert a tinydns line to BIND:
|
|
185
|
+
|
|
186
|
+
```js
|
|
187
|
+
console.log(new RR.CAA({
|
|
188
|
+
tinyline: ':ns1.example.com:257:\\000\\005issue"http\\072\\057\\057letsencrypt.org":3600::\n'
|
|
189
|
+
}).toBind())
|
|
190
|
+
ns1.example.com 3600 IN CAA 0 issue "http://letsencrypt.org"
|
|
191
|
+
```
|
|
192
|
+
|
|
183
193
|
## Supported Records
|
|
184
194
|
|
|
185
195
|
This module intends to support all current (ie, not officially deprecated) DNS RRs **and** all RRs that are in active use on the internet.
|
|
186
196
|
|
|
187
197
|
PRs are welcome, especially PRs with tests.
|
|
188
198
|
|
|
189
|
-
| **RR** |
|
|
190
|
-
| :------------: |
|
|
191
|
-
|
|
|
192
|
-
|
|
|
193
|
-
| **
|
|
194
|
-
|
|
|
195
|
-
|
|
|
196
|
-
|
|
|
197
|
-
|
|
|
198
|
-
|
|
|
199
|
-
|
|
|
200
|
-
|
|
|
201
|
-
|
|
|
202
|
-
| **
|
|
203
|
-
|
|
|
204
|
-
|
|
|
205
|
-
|
|
|
206
|
-
|
|
|
207
|
-
| **
|
|
208
|
-
| **
|
|
209
|
-
|
|
|
210
|
-
|
|
|
211
|
-
| **
|
|
212
|
-
|
|
|
213
|
-
|
|
|
214
|
-
| **
|
|
215
|
-
|
|
|
216
|
-
| **
|
|
217
|
-
|
|
|
218
|
-
|
|
|
219
|
-
|
|
|
220
|
-
| **
|
|
221
|
-
| **
|
|
222
|
-
|
|
|
223
|
-
|
|
|
224
|
-
|
|
|
225
|
-
| **
|
|
226
|
-
|
|
|
227
|
-
|
|
|
228
|
-
|
|
|
229
|
-
|
|
|
230
|
-
| **
|
|
199
|
+
| **RR** | **BIND / RFC 1035** | **Tinydns** |
|
|
200
|
+
| :------------: | :-----------------: | :----------------: |
|
|
201
|
+
| _Common_ |
|
|
202
|
+
| **A** | :white_check_mark: | :white_check_mark: |
|
|
203
|
+
| **AAAA** | :white_check_mark: | :white_check_mark: |
|
|
204
|
+
| **CNAME** | :white_check_mark: | :white_check_mark: |
|
|
205
|
+
| **HTTPS** | :white_check_mark: | :white_check_mark: |
|
|
206
|
+
| **MX** | :white_check_mark: | :white_check_mark: |
|
|
207
|
+
| **NS** | :white_check_mark: | :white_check_mark: |
|
|
208
|
+
| **PTR** | :white_check_mark: | :white_check_mark: |
|
|
209
|
+
| **SRV** | :white_check_mark: | :white_check_mark: |
|
|
210
|
+
| **TXT** | :white_check_mark: | :white_check_mark: |
|
|
211
|
+
| _Less Common_ |
|
|
212
|
+
| **APL** | :white_check_mark: | :white_check_mark: |
|
|
213
|
+
| **CERT** | :white_check_mark: | :white_check_mark: |
|
|
214
|
+
| **DHCID** | :white_check_mark: | :white_check_mark: |
|
|
215
|
+
| **DNAME** | :white_check_mark: | :white_check_mark: |
|
|
216
|
+
| **HIP** | :white_check_mark: | :white_check_mark: |
|
|
217
|
+
| **KEY** | :white_check_mark: | :white_check_mark: |
|
|
218
|
+
| **KX** | :white_check_mark: | :white_check_mark: |
|
|
219
|
+
| **LOC** | :white_check_mark: | :white_check_mark: |
|
|
220
|
+
| **NAPTR** | :white_check_mark: | :white_check_mark: |
|
|
221
|
+
| **SOA** | :white_check_mark: | :white_check_mark: |
|
|
222
|
+
| **SVCB** | :white_check_mark: | :white_check_mark: |
|
|
223
|
+
| **TSIG** | :white_check_mark: | :white_check_mark: |
|
|
224
|
+
| **URI** | :white_check_mark: | :white_check_mark: |
|
|
225
|
+
| _Security_ |
|
|
226
|
+
| **CAA** | :white_check_mark: | :white_check_mark: |
|
|
227
|
+
| **IPSECKEY** | :white_check_mark: | :white_check_mark: |
|
|
228
|
+
| **OPENPGPKEY** | :white_check_mark: | :white_check_mark: |
|
|
229
|
+
| **SMIMEA** | :white_check_mark: | :white_check_mark: |
|
|
230
|
+
| **SSHFP** | :white_check_mark: | :white_check_mark: |
|
|
231
|
+
| **TLSA** | :white_check_mark: | :white_check_mark: |
|
|
232
|
+
| _DNSSEC_ |
|
|
233
|
+
| **DNSKEY** | :white_check_mark: | :white_check_mark: |
|
|
234
|
+
| **DS** | :white_check_mark: | :white_check_mark: |
|
|
235
|
+
| **NSEC** | :white_check_mark: | :white_check_mark: |
|
|
236
|
+
| **NSEC3** | :white_check_mark: | :white_check_mark: |
|
|
237
|
+
| **NSEC3PARAM** | :white_check_mark: | :white_check_mark: |
|
|
238
|
+
| **RRSIG** | :white_check_mark: | :white_check_mark: |
|
|
239
|
+
| _Deprecated_ |
|
|
240
|
+
| **NXT** | :white_check_mark: | :white_check_mark: |
|
|
241
|
+
| **SPF** | :white_check_mark: | :white_check_mark: |
|
|
242
|
+
| _Obsolete_ |
|
|
243
|
+
| **HINFO** | :white_check_mark: | :white_check_mark: |
|
|
244
|
+
| **RP** | :white_check_mark: | :white_check_mark: |
|
|
245
|
+
| **SIG** | :white_check_mark: | :white_check_mark: |
|
|
246
|
+
| **WKS** | :white_check_mark: | :white_check_mark: |
|
|
231
247
|
|
|
232
248
|
## TIPS
|
|
233
249
|
|
|
@@ -248,13 +264,9 @@ PRs are welcome, especially PRs with tests.
|
|
|
248
264
|
- @nictool/[dns-zone](https://www.npmjs.com/package/@nictool/dns-zone)
|
|
249
265
|
- @nictool/[dns-nameserver](https://www.npmjs.com/package/@nictool/dns-nameserver)
|
|
250
266
|
|
|
251
|
-
## TODO
|
|
252
|
-
|
|
253
|
-
- [ ] export a web page for each RR type
|
|
254
|
-
|
|
255
267
|
## DEVELOP
|
|
256
268
|
|
|
257
269
|
- There are no dependencies. That's no accident.
|
|
258
|
-
-
|
|
270
|
+
- ESM browsers and node.js
|
|
259
271
|
- Platform independence is a goal
|
|
260
|
-
- [x] CI tests are on linux, windows, and
|
|
272
|
+
- [x] CI tests are on linux, windows, and macOS
|
package/lib/readme.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Regenerates the Supported Records table in README.md using getTags() from each RR class.
|
|
3
|
+
|
|
4
|
+
import { readFileSync, writeFileSync } from 'fs'
|
|
5
|
+
import { fileURLToPath } from 'url'
|
|
6
|
+
import { dirname, join } from 'path'
|
|
7
|
+
|
|
8
|
+
import * as RR from '../index.js'
|
|
9
|
+
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
11
|
+
|
|
12
|
+
const tagToGroup = {
|
|
13
|
+
common: 'Common',
|
|
14
|
+
security: 'Security',
|
|
15
|
+
dnssec: 'DNSSEC',
|
|
16
|
+
deprecated: 'Deprecated',
|
|
17
|
+
obsolete: 'Obsolete',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const groupOrder = ['Common', 'Less Common', 'Security', 'DNSSEC', 'Deprecated', 'Obsolete']
|
|
21
|
+
|
|
22
|
+
function getGroup(instance) {
|
|
23
|
+
const tags = instance.getTags()
|
|
24
|
+
for (const [tag, group] of Object.entries(tagToGroup)) {
|
|
25
|
+
if (tags.includes(tag)) return group
|
|
26
|
+
}
|
|
27
|
+
return 'Less Common'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const groups = {}
|
|
31
|
+
for (const name of groupOrder) groups[name] = []
|
|
32
|
+
|
|
33
|
+
for (const [name, cls] of Object.entries(RR)) {
|
|
34
|
+
if (name === 'typeMap' || name === 'default') continue
|
|
35
|
+
if (typeof cls !== 'function') continue
|
|
36
|
+
const instance = new cls(null)
|
|
37
|
+
const group = getGroup(instance)
|
|
38
|
+
groups[group].push(name)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const check = ':white_check_mark:'
|
|
42
|
+
const rows = []
|
|
43
|
+
for (const groupName of groupOrder) {
|
|
44
|
+
const names = groups[groupName]
|
|
45
|
+
if (!names.length) continue
|
|
46
|
+
rows.push(`| *${groupName}* |`)
|
|
47
|
+
for (const name of names.sort()) {
|
|
48
|
+
const cls = RR[name]
|
|
49
|
+
const hasToBind = typeof cls.prototype.toBind === 'function'
|
|
50
|
+
const hasFromBind = typeof cls.prototype.fromBind === 'function'
|
|
51
|
+
const hasToTinydns = typeof cls.prototype.toTinydns === 'function'
|
|
52
|
+
const hasFromTinydns = typeof cls.prototype.fromTinydns === 'function'
|
|
53
|
+
|
|
54
|
+
const bind = hasToBind && hasFromBind ? check : ''
|
|
55
|
+
const tinydns = hasToTinydns && hasFromTinydns ? check : ''
|
|
56
|
+
|
|
57
|
+
rows.push(`| **${name}** | ${bind} | ${tinydns} |`)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const table = [
|
|
62
|
+
`| **RR** | **BIND / RFC 1035** | **Tinydns** |`,
|
|
63
|
+
`| :------------: | :-------------------: | :-----------------: |`,
|
|
64
|
+
...rows,
|
|
65
|
+
].join('\n')
|
|
66
|
+
|
|
67
|
+
const readmePath = join(__dirname, '..', 'README.md')
|
|
68
|
+
const readme = readFileSync(readmePath, 'utf-8')
|
|
69
|
+
|
|
70
|
+
// Replace from the table header line up to (but not including) the ## TIPS section
|
|
71
|
+
const tableHeaderMarker = '\n| **RR** |'
|
|
72
|
+
const tipsSectionMarker = '\n\n## TIPS'
|
|
73
|
+
|
|
74
|
+
const tableStart = readme.indexOf(tableHeaderMarker)
|
|
75
|
+
const tipsStart = readme.indexOf(tipsSectionMarker)
|
|
76
|
+
|
|
77
|
+
if (tableStart === -1 || tipsStart === -1) {
|
|
78
|
+
console.error('Could not locate table boundaries in README.md')
|
|
79
|
+
process.exit(1)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const newReadme = readme.slice(0, tableStart + 1) + table + '\n' + readme.slice(tipsStart)
|
|
83
|
+
writeFileSync(readmePath, newReadme)
|
|
84
|
+
console.log('README.md updated successfully')
|
package/lib/tinydns.js
CHANGED
|
@@ -196,6 +196,16 @@ export function octalToIPv4(str) {
|
|
|
196
196
|
return [24, 16, 8, 0].map((n) => (asInt >> n) & 0xff).join('.')
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
export function ipv6toOctal(ip) {
|
|
200
|
+
return packHex(ip.replace(/:/g, ''))
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export function octalToIPv6(str) {
|
|
204
|
+
return octalToHex(str)
|
|
205
|
+
.match(/(.{4})/g)
|
|
206
|
+
.join(':')
|
|
207
|
+
}
|
|
208
|
+
|
|
199
209
|
export function base64toOctal(str) {
|
|
200
210
|
const bytes = Buffer.from(str, 'base64')
|
|
201
211
|
let escaped = ''
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nictool/dns-resource-record",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "DNS Resource Records",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -11,17 +11,20 @@
|
|
|
11
11
|
],
|
|
12
12
|
"type": "module",
|
|
13
13
|
"scripts": {
|
|
14
|
+
"build": "node lib/readme.js",
|
|
15
|
+
"clean": "rm -rf coverage node_modules package-lock.json",
|
|
14
16
|
"format:check": "npm run prettier; npm run lint",
|
|
15
17
|
"format": "npm run prettier -- --write && npm run lint:fix",
|
|
16
18
|
"lint": "npx eslint **/*.js",
|
|
17
19
|
"lint:fix": "npm run lint -- --fix",
|
|
18
20
|
"prettier": "npx prettier --ignore-path .gitignore --check .",
|
|
19
21
|
"prettier:fix": "npx prettier --ignore-path .gitignore --write .",
|
|
20
|
-
"test": "node --test
|
|
21
|
-
"test:coverage": "
|
|
22
|
+
"test": "node --test",
|
|
23
|
+
"test:coverage": "node --test --experimental-test-coverage",
|
|
24
|
+
"test:coverage:lcov": "mkdir -p coverage && node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage/lcov.info",
|
|
22
25
|
"versions": "npx npm-dep-mgr check",
|
|
23
26
|
"versions:fix": "npx npm-dep-mgr update",
|
|
24
|
-
"watch": "node --test --watch
|
|
27
|
+
"watch": "node --test --watch"
|
|
25
28
|
},
|
|
26
29
|
"repository": {
|
|
27
30
|
"type": "git",
|
|
@@ -48,8 +51,8 @@
|
|
|
48
51
|
"homepage": "https://github.com/NicTool/dns-resource-record#readme",
|
|
49
52
|
"devDependencies": {
|
|
50
53
|
"@eslint/js": "^10.0.1",
|
|
51
|
-
"eslint": "^10.1
|
|
52
|
-
"globals": "^17.
|
|
54
|
+
"eslint": "^10.2.1",
|
|
55
|
+
"globals": "^17.5.0"
|
|
53
56
|
},
|
|
54
57
|
"prettier": {
|
|
55
58
|
"printWidth": 110,
|
package/rr/a.js
CHANGED
|
@@ -16,6 +16,10 @@ export default class A extends RR {
|
|
|
16
16
|
return 'Address'
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
getTags() {
|
|
20
|
+
return ['common']
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
getRdataFields(arg) {
|
|
20
24
|
return ['address']
|
|
21
25
|
}
|
|
@@ -66,6 +70,10 @@ export default class A extends RR {
|
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
/****** EXPORTERS *******/
|
|
73
|
+
getWireRdata() {
|
|
74
|
+
return Buffer.from(this.get('address').split('.').map(Number))
|
|
75
|
+
}
|
|
76
|
+
|
|
69
77
|
toTinydns() {
|
|
70
78
|
return `+${this.getTinyFQDN('owner')}:${this.get('address')}:${this.getTinydnsPostamble()}\n`
|
|
71
79
|
}
|
package/rr/aaaa.js
CHANGED
|
@@ -22,12 +22,16 @@ export default class AAAA extends RR {
|
|
|
22
22
|
return 'Address IPv6'
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
getTags() {
|
|
26
|
+
return ['common']
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
getRdataFields(arg) {
|
|
26
30
|
return ['address']
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
getRFCs() {
|
|
30
|
-
return [3596]
|
|
34
|
+
return [3596, 5952]
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
getTypeId() {
|
|
@@ -40,7 +44,7 @@ export default class AAAA extends RR {
|
|
|
40
44
|
address: '2001:0db8:0020:000a:0000:0000:0000:0004',
|
|
41
45
|
class: 'IN',
|
|
42
46
|
ttl: 3600,
|
|
43
|
-
type: '
|
|
47
|
+
type: 'AAAA',
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
|
|
@@ -138,6 +142,10 @@ export default class AAAA extends RR {
|
|
|
138
142
|
}
|
|
139
143
|
|
|
140
144
|
/****** EXPORTERS *******/
|
|
145
|
+
getWireRdata() {
|
|
146
|
+
return Buffer.from(this.expand(this.get('address'), ''), 'hex')
|
|
147
|
+
}
|
|
148
|
+
|
|
141
149
|
toBind(zone_opts) {
|
|
142
150
|
return `${this.getPrefix(zone_opts)}\t${this.getCompressed()}\n`
|
|
143
151
|
}
|
package/rr/caa.js
CHANGED
package/rr/cert.js
CHANGED
|
@@ -97,6 +97,19 @@ export default class CERT extends RR {
|
|
|
97
97
|
return 37
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
getCanonical() {
|
|
101
|
+
return {
|
|
102
|
+
owner: 'mail.example.com.',
|
|
103
|
+
ttl: 3600,
|
|
104
|
+
class: 'IN',
|
|
105
|
+
type: 'CERT',
|
|
106
|
+
'cert type': 'PGP',
|
|
107
|
+
'key tag': 0,
|
|
108
|
+
algorithm: 0,
|
|
109
|
+
certificate: 'hexidecimalkeystring1',
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
100
113
|
/****** IMPORTERS *******/
|
|
101
114
|
|
|
102
115
|
fromTinydns({ tinyline }) {
|
package/rr/cname.js
CHANGED
|
@@ -25,6 +25,10 @@ export default class CNAME extends RR {
|
|
|
25
25
|
return 'Canonical Name'
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
getTags() {
|
|
29
|
+
return ['common']
|
|
30
|
+
}
|
|
31
|
+
|
|
28
32
|
getRdataFields(arg) {
|
|
29
33
|
return ['cname']
|
|
30
34
|
}
|
|
@@ -37,6 +41,16 @@ export default class CNAME extends RR {
|
|
|
37
41
|
return 5
|
|
38
42
|
}
|
|
39
43
|
|
|
44
|
+
getCanonical() {
|
|
45
|
+
return {
|
|
46
|
+
owner: 'www.example.com.',
|
|
47
|
+
ttl: 3600,
|
|
48
|
+
class: 'IN',
|
|
49
|
+
type: 'CNAME',
|
|
50
|
+
cname: 'web.example.com.',
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
40
54
|
/****** IMPORTERS *******/
|
|
41
55
|
fromTinydns({ tinyline }) {
|
|
42
56
|
// Cfqdn:p:ttl:timestamp:lo
|
|
@@ -65,6 +79,9 @@ export default class CNAME extends RR {
|
|
|
65
79
|
}
|
|
66
80
|
|
|
67
81
|
/****** EXPORTERS *******/
|
|
82
|
+
getWireRdata() {
|
|
83
|
+
return this.wirePackDomain(this.get('cname'))
|
|
84
|
+
}
|
|
68
85
|
|
|
69
86
|
toTinydns() {
|
|
70
87
|
return `C${this.getTinyFQDN('owner')}:${this.get('cname')}:${this.getTinydnsPostamble()}\n`
|
package/rr/dname.js
CHANGED
|
@@ -35,6 +35,16 @@ export default class DNAME extends RR {
|
|
|
35
35
|
return 39
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
getCanonical() {
|
|
39
|
+
return {
|
|
40
|
+
owner: 'example.com.',
|
|
41
|
+
ttl: 3600,
|
|
42
|
+
class: 'IN',
|
|
43
|
+
type: 'DNAME',
|
|
44
|
+
target: 'example.net.',
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
38
48
|
/****** IMPORTERS *******/
|
|
39
49
|
fromTinydns({ tinyline }) {
|
|
40
50
|
// DNAME via generic, :fqdn:n:rdata:ttl:timestamp:lo
|
package/rr/dnskey.js
CHANGED
|
@@ -79,6 +79,10 @@ export default class DNSKEY extends RR {
|
|
|
79
79
|
return 'DNS Public Key'
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
getTags() {
|
|
83
|
+
return ['dnssec']
|
|
84
|
+
}
|
|
85
|
+
|
|
82
86
|
getRdataFields(arg) {
|
|
83
87
|
return ['flags', 'protocol', 'algorithm', 'publickey']
|
|
84
88
|
}
|
|
@@ -91,6 +95,19 @@ export default class DNSKEY extends RR {
|
|
|
91
95
|
return 48
|
|
92
96
|
}
|
|
93
97
|
|
|
98
|
+
getCanonical() {
|
|
99
|
+
return {
|
|
100
|
+
owner: 'example.com.',
|
|
101
|
+
ttl: 3600,
|
|
102
|
+
class: 'IN',
|
|
103
|
+
type: 'DNSKEY',
|
|
104
|
+
flags: 256,
|
|
105
|
+
protocol: 3,
|
|
106
|
+
algorithm: 5,
|
|
107
|
+
publickey: 'AQPSKAsj8...',
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
94
111
|
/****** IMPORTERS *******/
|
|
95
112
|
|
|
96
113
|
fromBind({ bindline }) {
|
package/rr/ds.js
CHANGED
|
@@ -50,6 +50,10 @@ export default class DS extends RR {
|
|
|
50
50
|
return 'Delegation Signer'
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
getTags() {
|
|
54
|
+
return ['dnssec']
|
|
55
|
+
}
|
|
56
|
+
|
|
53
57
|
getRdataFields(arg) {
|
|
54
58
|
return ['key tag', 'algorithm', 'digest type', 'digest']
|
|
55
59
|
}
|
|
@@ -62,6 +66,19 @@ export default class DS extends RR {
|
|
|
62
66
|
return 43
|
|
63
67
|
}
|
|
64
68
|
|
|
69
|
+
getCanonical() {
|
|
70
|
+
return {
|
|
71
|
+
owner: 'example.com.',
|
|
72
|
+
ttl: 3600,
|
|
73
|
+
class: 'IN',
|
|
74
|
+
type: 'DS',
|
|
75
|
+
'key tag': 12345,
|
|
76
|
+
algorithm: 5,
|
|
77
|
+
'digest type': 1,
|
|
78
|
+
digest: 'ABCDEF123...',
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
65
82
|
/****** IMPORTERS *******/
|
|
66
83
|
|
|
67
84
|
fromBind({ bindline }) {
|
package/rr/hinfo.js
CHANGED
|
@@ -22,6 +22,10 @@ export default class HINFO extends RR {
|
|
|
22
22
|
return 'Host Info'
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
getTags() {
|
|
26
|
+
return ['obsolete']
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
getRdataFields(arg) {
|
|
26
30
|
return ['cpu', 'os']
|
|
27
31
|
}
|
|
@@ -34,6 +38,17 @@ export default class HINFO extends RR {
|
|
|
34
38
|
return 13
|
|
35
39
|
}
|
|
36
40
|
|
|
41
|
+
getCanonical() {
|
|
42
|
+
return {
|
|
43
|
+
owner: 'test.example.com.',
|
|
44
|
+
ttl: 3600,
|
|
45
|
+
class: 'IN',
|
|
46
|
+
type: 'HINFO',
|
|
47
|
+
cpu: 'DEC-2060',
|
|
48
|
+
os: 'TOPS20',
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
37
52
|
getQuotedFields() {
|
|
38
53
|
return ['cpu', 'os']
|
|
39
54
|
}
|