pmcf 1.25.1 → 1.26.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/bin/pmcf-location-defs +2 -25
- package/bin/pmcf-named-defs +2 -2
- package/package.json +1 -1
- package/src/dns.mjs +24 -0
- package/types/dns.d.mts +8 -0
package/bin/pmcf-location-defs
CHANGED
|
@@ -22,33 +22,10 @@ console.log("replaces", `mf-location-${location.name}`);
|
|
|
22
22
|
console.log("description", `location definitions for ${location.name}`);
|
|
23
23
|
|
|
24
24
|
async function generateLocationDefs(location, dir) {
|
|
25
|
-
const dns = location.dns;
|
|
26
|
-
const dnsServices = (await Array.fromAsync(dns.services())).sort(
|
|
27
|
-
(a, b) => a.priority - b.priority
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
console.log(dnsServices);
|
|
31
|
-
|
|
32
|
-
const master = dnsServices
|
|
33
|
-
.filter(s => s.priority < 10)
|
|
34
|
-
.map(s => s.ipAddresses)
|
|
35
|
-
.flat();
|
|
36
|
-
const fallback = dnsServices
|
|
37
|
-
.filter(s => s.priority >= 10)
|
|
38
|
-
.map(s => s.ipAddresses)
|
|
39
|
-
.flat();
|
|
40
|
-
|
|
41
25
|
await writeLines(
|
|
42
26
|
join(dir, "etc/systemd/resolved.conf.d"),
|
|
43
27
|
`${location.name}.conf`,
|
|
44
|
-
sectionLines("Resolve",
|
|
45
|
-
DNS: master.join(" "),
|
|
46
|
-
FallbackDNS: fallback.join(" "),
|
|
47
|
-
Domains: dns.domains.join(" "),
|
|
48
|
-
DNSSEC: "no",
|
|
49
|
-
MulticastDNS: "yes",
|
|
50
|
-
LLMNR: "no"
|
|
51
|
-
})
|
|
28
|
+
sectionLines("Resolve", await location.dns.resolvedConfig())
|
|
52
29
|
);
|
|
53
30
|
|
|
54
31
|
await writeLines(
|
|
@@ -75,7 +52,7 @@ async function generateLocationDefs(location, dir) {
|
|
|
75
52
|
|
|
76
53
|
await mkdir(locationDir, { recursive: true });
|
|
77
54
|
|
|
78
|
-
copyFile(
|
|
55
|
+
await copyFile(
|
|
79
56
|
join(location.directory, "location.json"),
|
|
80
57
|
join(locationDir, "location.json")
|
|
81
58
|
);
|
package/bin/pmcf-named-defs
CHANGED
package/package.json
CHANGED
package/src/dns.mjs
CHANGED
|
@@ -33,4 +33,28 @@ export class DNSService extends Base {
|
|
|
33
33
|
get propertyNames() {
|
|
34
34
|
return ["recordTTL", "forwardsTo", "allowedUpdates"];
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
async resolvedConfig() {
|
|
38
|
+
const dnsServices = (await Array.fromAsync(this.services())).sort(
|
|
39
|
+
(a, b) => a.priority - b.priority
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const master = dnsServices
|
|
43
|
+
.filter(s => s.priority < 10)
|
|
44
|
+
.map(s => s.ipAddresses)
|
|
45
|
+
.flat();
|
|
46
|
+
const fallback = dnsServices
|
|
47
|
+
.filter(s => s.priority >= 10)
|
|
48
|
+
.map(s => s.ipAddresses)
|
|
49
|
+
.flat();
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
DNS: master.join(" "),
|
|
53
|
+
FallbackDNS: fallback.join(" "),
|
|
54
|
+
Domains: this.domains.join(" "),
|
|
55
|
+
DNSSEC: "no",
|
|
56
|
+
MulticastDNS: "yes",
|
|
57
|
+
LLMNR: "no"
|
|
58
|
+
};
|
|
59
|
+
}
|
|
36
60
|
}
|
package/types/dns.d.mts
CHANGED
|
@@ -4,5 +4,13 @@ export class DNSService extends Base {
|
|
|
4
4
|
forwardsTo: any[];
|
|
5
5
|
services(): AsyncGenerator<any, void, any>;
|
|
6
6
|
get domains(): any[];
|
|
7
|
+
resolvedConfig(): Promise<{
|
|
8
|
+
DNS: string;
|
|
9
|
+
FallbackDNS: string;
|
|
10
|
+
Domains: string;
|
|
11
|
+
DNSSEC: string;
|
|
12
|
+
MulticastDNS: string;
|
|
13
|
+
LLMNR: string;
|
|
14
|
+
}>;
|
|
7
15
|
}
|
|
8
16
|
import { Base } from "./base.mjs";
|