pmcf 1.101.2 → 1.102.1

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": "1.101.2",
3
+ "version": "1.102.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/service.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Base } from "./base.mjs";
2
2
  import { addType } from "./types.mjs";
3
- import { asArray } from "./utils.mjs";
3
+ import { asArray,isLocalhost } from "./utils.mjs";
4
4
  import { networkAddressProperties } from "./network-support.mjs";
5
5
  import {
6
6
  DNSRecord,
@@ -277,12 +277,13 @@ export const sortByPriority = (a, b) => a.priority - b.priority;
277
277
  export function serviceAddresses(
278
278
  sources,
279
279
  filter,
280
- addressType = "rawAddresses"
280
+ addressType = "rawAddresses",
281
+ addressFilter = a=>!isLocalhost(a)
281
282
  ) {
282
283
  return asArray(sources)
283
284
  .map(ft => Array.from(ft.findServices(filter)))
284
285
  .flat()
285
286
  .sort(sortByPriority)
286
287
  .map(s => s[addressType])
287
- .flat();
288
+ .flat().filter(addressFilter);
288
289
  }
@@ -301,7 +301,7 @@ async function generateZoneDefs(dns, location, packageData) {
301
301
  };
302
302
  configs.push(config);
303
303
 
304
- const locationRecord = DNSRecord("location", "TXT", dns.location.name);
304
+ const locationRecord = DNSRecord("location", "TXT", locationName);
305
305
 
306
306
  const zone = {
307
307
  id: domain,
@@ -62,7 +62,8 @@ export class NTPService extends Service {
62
62
  ...NTP_SERVICE_FILTER,
63
63
  priority: "<20"
64
64
  },
65
- "domainName"
65
+ "domainName",
66
+ ()=>true
66
67
  ).join(" ")
67
68
  }
68
69
  ];
package/src/utils.mjs CHANGED
@@ -94,6 +94,11 @@ export function isLinkLocal(address) {
94
94
  return address.startsWith("fe80");
95
95
  }
96
96
 
97
+ export function isLocalhost(address) {
98
+ const eaddr = encodeIP(address);
99
+ return eaddr === IPV4_LOCALHOST || eaddr === IPV6_LOCALHOST;
100
+ }
101
+
97
102
  export function normalizeIPAddress(address) {
98
103
  address = address.replace(/\/\d+$/, "");
99
104
  if (isIPv4Address(address)) {
@@ -1,4 +1,4 @@
1
- export function serviceAddresses(sources: any, filter: any, addressType?: string): any[];
1
+ export function serviceAddresses(sources: any, filter: any, addressType?: string, addressFilter?: (a: any) => boolean): any[];
2
2
  export namespace ServiceTypeDefinition {
3
3
  export let name: string;
4
4
  export let owners: string[];
package/types/utils.d.mts CHANGED
@@ -9,6 +9,7 @@ export function isIPv4Address(address: any): boolean;
9
9
  export function generateEU64(mac: any): void;
10
10
  export function isIPv6Address(address: any): boolean;
11
11
  export function isLinkLocal(address: any): any;
12
+ export function isLocalhost(address: any): boolean;
12
13
  export function normalizeIPAddress(address: any): any;
13
14
  export function _encode(definition: any, address: any): bigint;
14
15
  export function decodeIPv6(address: any, length: any): string;