pmcf 6.29.3 → 6.30.0
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/package.json +1 -1
- package/src/services/bind.mjs +38 -16
package/package.json
CHANGED
package/src/services/bind.mjs
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { createHmac } from "node:crypto";
|
|
3
3
|
import { FileContentProvider } from "npm-pkgbuild";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
reverseArpa,
|
|
6
|
+
FAMILY_IPV4,
|
|
7
|
+
FAMILY_IPV6,
|
|
8
|
+
ADDRESS_TYPE_LOOPBACK,
|
|
9
|
+
addressType
|
|
10
|
+
} from "ip-utilties";
|
|
5
11
|
import {
|
|
6
12
|
default_collection_attribute,
|
|
7
13
|
default_collection_attribute_writable,
|
|
@@ -127,8 +133,12 @@ class bind_zone_config extends Base {
|
|
|
127
133
|
|
|
128
134
|
/** @type {bind_zone[]} */ zones = [];
|
|
129
135
|
|
|
136
|
+
get service() {
|
|
137
|
+
return this.owner.service;
|
|
138
|
+
}
|
|
139
|
+
|
|
130
140
|
get type() {
|
|
131
|
-
return this.
|
|
141
|
+
return this.service.serverType;
|
|
132
142
|
}
|
|
133
143
|
|
|
134
144
|
constructor(owner, name) {
|
|
@@ -169,7 +179,20 @@ class bind_zone_config extends Base {
|
|
|
169
179
|
);
|
|
170
180
|
break;
|
|
171
181
|
case "secondary":
|
|
172
|
-
|
|
182
|
+
const primaries = [...this.service.primaries]
|
|
183
|
+
.map(e => e.endpoints())
|
|
184
|
+
.flat()
|
|
185
|
+
.filter(
|
|
186
|
+
e =>
|
|
187
|
+
e.networkAddress &&
|
|
188
|
+
addressType(e.networkAddress.address) !==
|
|
189
|
+
ADDRESS_TYPE_LOOPBACK
|
|
190
|
+
)
|
|
191
|
+
.map(e => e.networkAddress.address);
|
|
192
|
+
|
|
193
|
+
content.push(
|
|
194
|
+
...addressesStatement(". primaries", primaries, false, " ")
|
|
195
|
+
);
|
|
173
196
|
break;
|
|
174
197
|
}
|
|
175
198
|
content.push(` notify ${yesno(group.notify)};`);
|
|
@@ -231,7 +254,9 @@ export class bind_acl extends bind_object {
|
|
|
231
254
|
async packageContent(outputControl) {
|
|
232
255
|
const acls = addressesStatement(
|
|
233
256
|
`acl ${this.name}`,
|
|
234
|
-
addresses(this.entries, { aggregate: true })
|
|
257
|
+
addresses(this.entries, { aggregate: true }),
|
|
258
|
+
"any;",
|
|
259
|
+
" "
|
|
235
260
|
);
|
|
236
261
|
|
|
237
262
|
if (acls.length) {
|
|
@@ -592,25 +617,22 @@ class bind_group extends bind_object {
|
|
|
592
617
|
function addressesStatement(prefix, objects, empty = false, indent = "") {
|
|
593
618
|
const body = asArray(objects).map(value => {
|
|
594
619
|
if (typeof value !== "string") {
|
|
595
|
-
|
|
596
|
-
value = value.name;
|
|
597
|
-
} else {
|
|
598
|
-
value = value.address;
|
|
599
|
-
|
|
600
|
-
// console.log(value);
|
|
601
|
-
//value = [...value];
|
|
602
|
-
}
|
|
620
|
+
return value.name ?? value.address;
|
|
603
621
|
}
|
|
604
622
|
|
|
605
|
-
return
|
|
623
|
+
return value;
|
|
606
624
|
});
|
|
607
625
|
|
|
608
|
-
if (body.length) {
|
|
609
|
-
|
|
626
|
+
if (body.length > 0) {
|
|
627
|
+
if (body.length < 3) {
|
|
628
|
+
return [`${prefix} {${body.map(b => ` ${b};`).join("")} };`];
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
return [`${prefix} {`, body.map(b => `${indent}${b};`), `${indent}};`];
|
|
610
632
|
}
|
|
611
633
|
|
|
612
634
|
if (empty) {
|
|
613
|
-
return [`${
|
|
635
|
+
return [`${prefix} { ${empty} };`];
|
|
614
636
|
}
|
|
615
637
|
|
|
616
638
|
return [];
|