pmcf 1.21.0 → 1.21.2

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.
@@ -21,16 +21,29 @@ console.log("replaces", `mf-location-${location.name}`);
21
21
  console.log("description", `location definitions for ${location.name}`);
22
22
 
23
23
  async function generateLocationDefs(location, dir) {
24
- const sl = (await Array.fromAsync(location.dns.services())).map(s=>s.ipAddresses).flat()
25
- const s1 = sl.shift();
24
+ const dns = location.dns;
25
+ const dnsServices = (await Array.fromAsync(dns.services())).sort(
26
+ (a, b) => a.priority - b.priority
27
+ );
28
+
29
+ console.log(dnsServices);
30
+
31
+ const master = dnsServices
32
+ .filter(s => s.priority < 10)
33
+ .map(s => s.ipAddresses)
34
+ .flat();
35
+ const fallback = dnsServices
36
+ .filter(s => s.priority >= 10)
37
+ .map(s => s.ipAddresses)
38
+ .flat();
26
39
 
27
40
  await writeLines(
28
41
  join(dir, "etc/systemd/resolved.conf.d"),
29
42
  `${location.name}.conf`,
30
43
  sectionLines("Resolve", {
31
- DNS: s1,
32
- FallbackDNS: sl.join(","),
33
- Domains: location.domain,
44
+ DNS: master.join(" "),
45
+ FallbackDNS: fallback.join(" "),
46
+ Domains: dns.domains.join(" "),
34
47
  DNSSEC: "no",
35
48
  MulticastDNS: "yes",
36
49
  LLMNR: "no"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "1.21.0",
3
+ "version": "1.21.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/dns.mjs CHANGED
@@ -26,6 +26,10 @@ export class DNSService extends Base {
26
26
  }
27
27
  }
28
28
 
29
+ get domains() {
30
+ return [this.owner.domain];
31
+ }
32
+
29
33
  get propertyNames() {
30
34
  return ["recordTTL", "forwardsTo", "allowedUpdates"];
31
35
  }
package/src/model.mjs CHANGED
@@ -865,7 +865,7 @@ export class Service extends Base {
865
865
 
866
866
  Object.assign(this, data);
867
867
 
868
- this.owner = owner;
868
+ // this.owner = owner;
869
869
 
870
870
  owner.addService(this);
871
871
  }
@@ -914,7 +914,7 @@ export class Service extends Base {
914
914
  }
915
915
 
916
916
  get priority() {
917
- return /*this.#priority || */ this.owner.priority || 99;
917
+ return this.#priority || this.owner.priority || 99;
918
918
  }
919
919
 
920
920
  get weight() {
package/types/dns.d.mts CHANGED
@@ -3,5 +3,6 @@ export class DNSService extends Base {
3
3
  recordTTL: string;
4
4
  forwardsTo: any[];
5
5
  services(): AsyncGenerator<any, void, any>;
6
+ get domains(): any[];
6
7
  }
7
8
  import { Base } from "./base.mjs";