pmcf 2.24.1 → 2.24.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.24.1",
3
+ "version": "2.24.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/dns-utils.mjs CHANGED
@@ -5,6 +5,13 @@ export function dnsFullName(name) {
5
5
  return name.endsWith(".") ? name : name + ".";
6
6
  }
7
7
 
8
+ export function dnsRecordTypeForAddressFamily(family) {
9
+ switch(family) {
10
+ case 'IPv4': return "A";
11
+ case 'IPv6': return "AAAA";
12
+ }
13
+ }
14
+
8
15
  export function DNSRecord(key, type, ...values) {
9
16
  let pad = "";
10
17
 
@@ -36,7 +36,7 @@ export class NetworkAddress {
36
36
  }
37
37
 
38
38
  get domainNames() {
39
- this.networkInterface.domainNames;
39
+ return this.networkInterface.domainNames;
40
40
  }
41
41
 
42
42
  get family() {
@@ -1,9 +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 { isIPv6, isLinkLocal, reverseArpa } from "ip-utilties";
4
+ import { isLinkLocal, reverseArpa } from "ip-utilties";
5
5
  import { writeLines } from "../utils.mjs";
6
- import { DNSRecord, dnsFullName } from "../dns-utils.mjs";
6
+ import {
7
+ DNSRecord,
8
+ dnsFullName,
9
+ dnsRecordTypeForAddressFamily
10
+ } from "../dns-utils.mjs";
7
11
  import { addType } from "../types.mjs";
8
12
  import { ServiceTypeDefinition, serviceAddresses } from "../service.mjs";
9
13
  import {
@@ -299,7 +303,7 @@ async function generateZoneDefs(dns, location, packageData) {
299
303
  na => na.networkInterface.kind != "loopback"
300
304
  )) {
301
305
  zone.records.add(
302
- DNSRecord("@", na.family === "IPv6" ? "AAAA" : "A", na.address)
306
+ DNSRecord("@", dnsRecordTypeForAddressFamily(na.family), na.address)
303
307
  );
304
308
  }
305
309
  }
@@ -364,7 +368,8 @@ async function generateZoneDefs(dns, location, packageData) {
364
368
  address,
365
369
  subnet,
366
370
  networkInterface,
367
- domainNames
371
+ domainNames,
372
+ family
368
373
  } of location.networkAddresses()) {
369
374
  if (
370
375
  !dns.exclude.has(networkInterface.network) &&
@@ -381,7 +386,7 @@ async function generateZoneDefs(dns, location, packageData) {
381
386
  zone.records.add(
382
387
  DNSRecord(
383
388
  dnsFullName(domainName),
384
- isIPv6(address) ? "AAAA" : "A",
389
+ dnsRecordTypeForAddressFamily(family),
385
390
  address
386
391
  )
387
392
  );
@@ -1,4 +1,5 @@
1
1
  export function dnsFullName(name: any): any;
2
+ export function dnsRecordTypeForAddressFamily(family: any): "A" | "AAAA";
2
3
  export function DNSRecord(key: any, type: any, ...values: any[]): {
3
4
  key: any;
4
5
  toString: (maxKeyLength?: number, ttl?: string) => string;
@@ -10,7 +10,7 @@ export class NetworkAddress {
10
10
  /** @type {Subnet} */ subnet: Subnet;
11
11
  /** @type {NetworkInterface} */ networkInterface: NetworkInterface;
12
12
  /** @type {string|Uint8Array|Uint16Array} */ address: string | Uint8Array | Uint16Array;
13
- get domainNames(): void;
13
+ get domainNames(): any;
14
14
  get family(): any;
15
15
  get cidrAddress(): any;
16
16
  }