pmcf 2.30.0 → 2.31.0

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/README.md CHANGED
@@ -20,14 +20,21 @@
20
20
 
21
21
  ### Table of Contents
22
22
 
23
- * [NetworkAddress](#networkaddress)
23
+ * [networkAddresses](#networkaddresses)
24
24
  * [Parameters](#parameters)
25
- * [Properties](#properties)
25
+ * [NetworkAddress](#networkaddress)
26
+ * [Parameters](#parameters-1)
26
27
  * [subnet](#subnet)
27
28
  * [networkInterface](#networkinterface)
28
29
  * [address](#address)
29
- * [networkAddresses](#networkaddresses)
30
- * [Parameters](#parameters-1)
30
+
31
+ ## networkAddresses
32
+
33
+ ### Parameters
34
+
35
+ * `filter` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
36
+
37
+ Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
31
38
 
32
39
  ## NetworkAddress
33
40
 
@@ -37,14 +44,6 @@
37
44
  * `address` &#x20;
38
45
  * `subnet` &#x20;
39
46
 
40
- ### Properties
41
-
42
- * `networkInterface` **NetworkInterface**&#x20;
43
- * `address` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [Uint16Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array))**&#x20;
44
- * `family` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
45
- * `subnet` **Subnet**&#x20;
46
- * `domainNames` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**&#x20;
47
-
48
47
  ### subnet
49
48
 
50
49
  Type: Subnet
@@ -57,14 +56,6 @@ Type: NetworkInterface
57
56
 
58
57
  Type: ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [Uint16Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array))
59
58
 
60
- ## networkAddresses
61
-
62
- ### Parameters
63
-
64
- * `filter` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
65
-
66
- Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
67
-
68
59
  # install
69
60
 
70
61
  With [npm](http://npmjs.org) do:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.30.0",
3
+ "version": "2.31.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -190,7 +190,7 @@ export class Base {
190
190
  assign(property, value);
191
191
  } else {
192
192
  const factory =
193
- property.type.factoryFor?.(this,value) || property.type.clazz;
193
+ property.type.factoryFor?.(this, value) || property.type.clazz;
194
194
 
195
195
  assign(
196
196
  property,
package/src/host.mjs CHANGED
@@ -447,6 +447,12 @@ export class Host extends Base {
447
447
  return addresses(this.networkAddresses());
448
448
  }
449
449
 
450
+ *subnets() {
451
+ for (const networkInterface of this.networkInterfaces.values()) {
452
+ yield* networkInterface.subnets;
453
+ }
454
+ }
455
+
450
456
  async publicKey(type = "ed25519") {
451
457
  return readFile(join(this.directory, `ssh_host_${type}_key.pub`), "utf8");
452
458
  }
@@ -56,6 +56,11 @@ export class SkeletonNetworkInterface extends Base {
56
56
  this._network = network;
57
57
  }
58
58
 
59
+ *subnets ()
60
+ {
61
+ yield *this.ipAddresses.values();
62
+ }
63
+
59
64
  get ipAddresses() {
60
65
  return new Map();
61
66
  }
@@ -207,7 +207,7 @@ export class DNSService extends ExtraSourceService {
207
207
  ...DNS_SERVICE_FILTER,
208
208
  priority: ">=10"
209
209
  }).join(" "),
210
- Domains: [...this.domains].join(" "),
210
+ Domains: [...this.localDomains].join(" "),
211
211
  DNSSEC: "no",
212
212
  MulticastDNS: this.network.multicastDNS ? "yes" : "no",
213
213
  LLMNR: "no"
package/src/subnet.mjs CHANGED
@@ -98,8 +98,8 @@ export const SUBNET_LOCALHOST_IPV6 = new Subnet(_owner, "::1/128");
98
98
  export function subnets(sources) {
99
99
  const all = new Set();
100
100
 
101
- for (const owner of sources) {
102
- for (const subnet of owner.subnets()) {
101
+ for (const source of sources) {
102
+ for (const subnet of source.subnets()) {
103
103
  all.add(subnet);
104
104
  }
105
105
  }
package/types/host.d.mts CHANGED
@@ -237,6 +237,7 @@ export class Host extends Base {
237
237
  networkAddresses(filter: any): Generator<any, void, any>;
238
238
  get address(): any;
239
239
  get addresses(): any[];
240
+ subnets(): Generator<any, void, any>;
240
241
  publicKey(type?: string): Promise<string>;
241
242
  preparePackages(dir: any): AsyncGenerator<{
242
243
  dir: any;
@@ -9,6 +9,7 @@ export class SkeletonNetworkInterface extends Base {
9
9
  matches(other: any): boolean;
10
10
  set network(network: any);
11
11
  get network(): any;
12
+ subnets(): Generator<any, void, unknown>;
12
13
  get ipAddresses(): Map<any, any>;
13
14
  /**
14
15
  *