@nictool/dns-resource-record 1.8.0 → 1.8.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 +5 -0
- package/README.md +1 -1
- package/lib/bind.js +15 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@ Notable changes to this project are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
#### Unreleased
|
|
6
6
|
|
|
7
|
+
### [1.8.1] - 2026-07-25
|
|
8
|
+
|
|
9
|
+
- rr/bind: merge charstrs for opaque rdata types
|
|
10
|
+
|
|
7
11
|
### [1.8.0] - 2026-05-25
|
|
8
12
|
|
|
9
13
|
- lib/wire.js — hardened readWireName()
|
|
@@ -432,3 +436,4 @@ Notable changes to this project are documented in this file.
|
|
|
432
436
|
[1.6.1]: https://github.com/NicTool/dns-resource-record/releases/tag/v1.6.1
|
|
433
437
|
[1.7.0]: https://github.com/NicTool/dns-resource-record/releases/tag/v1.7.0
|
|
434
438
|
[1.8.0]: https://github.com/NicTool/dns-resource-record/releases/tag/v1.8.0
|
|
439
|
+
[1.8.1]: https://github.com/NicTool/dns-resource-record/releases/tag/v1.8.1
|
package/README.md
CHANGED
|
@@ -373,7 +373,7 @@ Master zone file expansions (relative domain names) are handled by [dns-zone](ht
|
|
|
373
373
|
|
|
374
374
|
The `toBind()` method accepts a zone-options object (typically supplied by
|
|
375
375
|
[dns-zone](https://github.com/NicTool/dns-zone) when emitting full zone files)
|
|
376
|
-
to
|
|
376
|
+
to omit redundant per-record output:
|
|
377
377
|
|
|
378
378
|
```js
|
|
379
379
|
record.toBind({
|
package/lib/bind.js
CHANGED
|
@@ -51,8 +51,12 @@ export function parseBindLine(line, RRClasses) {
|
|
|
51
51
|
return res
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
function fieldTypeOf(def) {
|
|
55
|
+
return Array.isArray(def) ? def[1] : null
|
|
56
|
+
}
|
|
57
|
+
|
|
54
58
|
export function fromBind(rrInstance, opts) {
|
|
55
|
-
const { owner, ttl, cls, rdata } = opts
|
|
59
|
+
const { owner, ttl, class: cls, rdata } = opts
|
|
56
60
|
const result = {
|
|
57
61
|
owner,
|
|
58
62
|
ttl,
|
|
@@ -62,15 +66,23 @@ export function fromBind(rrInstance, opts) {
|
|
|
62
66
|
|
|
63
67
|
const fields = rrInstance.getFields('rdata')
|
|
64
68
|
const rdataDefs = rrInstance.constructor.rdataFields ?? []
|
|
69
|
+
const opaqueTypes = new Set(['str', 'hex', 'base64'])
|
|
65
70
|
for (let i = 0; i < fields.length; i++) {
|
|
66
71
|
const isLastField = i === fields.length - 1
|
|
72
|
+
|
|
73
|
+
// RFC 1035 §5.1: opaque rdata (hex digests, base64 keys) may be split across
|
|
74
|
+
// whitespace and parenthesized continuations; rejoin it into one value.
|
|
75
|
+
if (isLastField && opaqueTypes.has(fieldTypeOf(rdataDefs[i]))) {
|
|
76
|
+
result[fields[i]] = rdata.slice(i).join('')
|
|
77
|
+
break
|
|
78
|
+
}
|
|
79
|
+
|
|
67
80
|
if (isLastField && rrInstance.isQuotedField(fields[i])) {
|
|
68
81
|
// Collect all remaining tokens for TXT/etc
|
|
69
82
|
const tokens = rdata.slice(i).map((s) => s.replace(/^"|"$/g, ''))
|
|
70
83
|
// For `charstrs` (TXT), preserve multi-string boundaries (RFC 1035 §3.3.14).
|
|
71
84
|
// For `qstr`/`qcharstr` (single character-string), join into one string.
|
|
72
|
-
const
|
|
73
|
-
const fieldType = Array.isArray(def) ? def[1] : null
|
|
85
|
+
const fieldType = fieldTypeOf(rdataDefs[i])
|
|
74
86
|
result[fields[i]] = fieldType === 'charstrs' && tokens.length > 1 ? tokens : tokens.join('')
|
|
75
87
|
break
|
|
76
88
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nictool/dns-resource-record",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "DNS Resource Records",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
],
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@eslint/js": "^10.0.1",
|
|
74
|
-
"eslint": "^10.
|
|
75
|
-
"globals": "^17.
|
|
74
|
+
"eslint": "^10.8.0",
|
|
75
|
+
"globals": "^17.7.0"
|
|
76
76
|
},
|
|
77
77
|
"prettier": {
|
|
78
78
|
"printWidth": 110,
|