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.
@@ -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
  );
@@ -42,8 +42,8 @@ async function generateNamedDefs(owner, targetDir) {
42
42
  const createRecord = (key, type, value) => {
43
43
  return {
44
44
  key,
45
- type,
46
- value,
45
+ /*type,
46
+ value,*/
47
47
  toString: () =>
48
48
  `${key.padEnd(maxKeyLength, " ")} ${ttl} IN ${type.padEnd(
49
49
  5,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "1.25.1",
3
+ "version": "1.26.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
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";