pmcf 6.7.5 → 6.8.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/bin/pmcf-info CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { extendingAttributeIterator } from "pacc";
2
3
  import { prepare } from "../src/cli.mjs";
3
4
 
4
5
  const { root, args, options } = await prepare({});
@@ -15,7 +16,14 @@ function show(value) {
15
16
  show(v);
16
17
  }
17
18
  } else {
18
- console.log(`${value.fullName}:`);
19
+ console.log(`${value.fullName}(${value.constructor.name}):`);
20
+
21
+ for (const [path, attribute] of extendingAttributeIterator(
22
+ value,
23
+ attribute => !attribute.private
24
+ )) {
25
+ console.log(path);
26
+ }
19
27
  ex(value);
20
28
  }
21
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "6.7.5",
3
+ "version": "6.8.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -101,7 +101,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
101
101
  }
102
102
 
103
103
  get hostName() {
104
- return this.attribute("_hostName") ?? this.host.hostName;
104
+ return this.attribute("_hostName") ?? this.host?.hostName;
105
105
  }
106
106
 
107
107
  set hostName(value) {
@@ -143,9 +143,21 @@ export class kea extends CoreService {
143
143
 
144
144
  const network = this.network;
145
145
  const host = this.host;
146
+
147
+ const source = host.owner;
146
148
  const name = host.name;
147
149
 
148
- const dnsServerEndpoints = serviceEndpoints(network, {
150
+ const subnets = [
151
+ ...new Set(
152
+ [...this.subnets.values()].filter(
153
+ s => s !== SUBNET_LOCALHOST_IPV4 && s !== SUBNET_LOCALHOST_IPV6
154
+ )
155
+ )
156
+ ]; // TODO should be normal
157
+
158
+ //console.log(source.fullName, [...source.hosts.keys()]);
159
+
160
+ const dnsServerEndpoints = serviceEndpoints(source, {
149
161
  services: "services[types[dns] && priority>=300]",
150
162
  endpoints: endpoint => endpoint.networkInterface?.kind !== "loopback"
151
163
  });
@@ -156,7 +168,7 @@ export class kea extends CoreService {
156
168
 
157
169
  const peers = async family =>
158
170
  Array.from(
159
- network.expression(
171
+ source.expression(
160
172
  `services[types[kea] && priority>=${Math.min(this.priority, 100)}]`
161
173
  )
162
174
  )
@@ -311,12 +323,6 @@ export class kea extends CoreService {
311
323
 
312
324
  const ddnsEndpoint = this.endpoint("kea-ddns");
313
325
 
314
- const subnetPrefixes = new Set(
315
- [...this.subnets.values()]
316
- .filter(s => s !== SUBNET_LOCALHOST_IPV4 && s !== SUBNET_LOCALHOST_IPV6)
317
- .map(s => s.prefix)
318
- );
319
-
320
326
  const ddns = {
321
327
  DhcpDdns: {
322
328
  "ip-address": ddnsEndpoint.address,
@@ -330,7 +336,7 @@ export class kea extends CoreService {
330
336
  },
331
337
  "reverse-ddns": {
332
338
  "ddns-domains": dnsServersSlot(
333
- [...subnetPrefixes].map(prefix => reverseArpa(prefix))
339
+ subnets.map(s => s.prefix).map(prefix => reverseArpa(prefix))
334
340
  )
335
341
  },
336
342
 
@@ -350,7 +356,7 @@ export class kea extends CoreService {
350
356
  const hwmap = new Map();
351
357
  const hostNames = new Set();
352
358
 
353
- for await (const { networkInterface } of network.networkAddresses()) {
359
+ for await (const { networkInterface } of source.networkAddresses()) {
354
360
  if (networkInterface.hwaddr) {
355
361
  if (!hostNames.has(networkInterface.hostName)) {
356
362
  hwmap.set(networkInterface.hwaddr, networkInterface);
@@ -379,7 +385,7 @@ export class kea extends CoreService {
379
385
  "client-classes": ["SKIP_DDNS"]
380
386
  };
381
387
  })
382
- .sort((a, b) => a.hostname.localeCompare(b.hostname));
388
+ .sort((a, b) => a.hostname?.localeCompare(b.hostname));
383
389
 
384
390
  const listenInterfaces = family =>
385
391
  this.endpoints(
@@ -393,10 +399,6 @@ export class kea extends CoreService {
393
399
  endpoint => `${endpoint.networkInterface.name}/${endpoint.address}`
394
400
  );
395
401
 
396
- const subnets = [...this.subnets.values()].filter(
397
- s => s !== SUBNET_LOCALHOST_IPV4 && s !== SUBNET_LOCALHOST_IPV6
398
- );
399
-
400
402
  const pools = subnet => {
401
403
  return subnet.dhcpPools.map(pool => {
402
404
  return { pool: Array.isArray(pool) ? pool.join(" - ") : pool };