pmcf 1.102.0 → 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.102.0",
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
  }
@@ -5,8 +5,7 @@ import {
5
5
  writeLines,
6
6
  isIPv6Address,
7
7
  normalizeIPAddress,
8
- isLinkLocal,
9
- isLocalhost
8
+ isLinkLocal
10
9
  } from "../utils.mjs";
11
10
  import { DNSRecord, dnsFullName } from "../dns-utils.mjs";
12
11
  import { addType } from "../types.mjs";
@@ -158,7 +157,7 @@ export class DNSService extends Service {
158
157
  DNS: serviceAddresses(this, {
159
158
  ...DNS_SERVICE_FILTER,
160
159
  priority: "<10"
161
- }).filter(a=>!isLocalhost(a)).join(" "),
160
+ }).join(" "),
162
161
  FallbackDNS: serviceAddresses(this, {
163
162
  ...DNS_SERVICE_FILTER,
164
163
  priority: ">=10"
@@ -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
  ];
@@ -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[];