pmcf 6.24.0 → 6.25.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
@@ -62,6 +62,7 @@ generates config packages for:
62
62
  * [Parameters](#parameters-8)
63
63
  * [templateContent](#templatecontent)
64
64
  * [Parameters](#parameters-9)
65
+ * [enabled](#enabled)
65
66
  * [isTemplate](#istemplate)
66
67
  * [expand](#expand)
67
68
  * [Parameters](#parameters-10)
@@ -78,30 +79,30 @@ generates config packages for:
78
79
  * [domainNames](#domainnames)
79
80
  * [InitializationContext](#initializationcontext)
80
81
  * [Parameters](#parameters-14)
82
+ * [SkeletonNetworkInterface](#skeletonnetworkinterface)
83
+ * [networkAddresses](#networkaddresses)
84
+ * [Parameters](#parameters-15)
81
85
  * [zones](#zones)
82
86
  * [type](#type)
83
87
  * [addressesStatement](#addressesstatement)
84
- * [Parameters](#parameters-15)
88
+ * [Parameters](#parameters-16)
85
89
  * [SystemdJournalRemoteService](#systemdjournalremoteservice)
86
90
  * [Properties](#properties)
87
91
  * [systemdConfigs](#systemdconfigs)
88
- * [Parameters](#parameters-16)
92
+ * [Parameters](#parameters-17)
89
93
  * [SystemdJournalUploadService](#systemdjournaluploadservice)
90
94
  * [Properties](#properties-1)
91
95
  * [systemdConfigs](#systemdconfigs-1)
92
- * [Parameters](#parameters-17)
96
+ * [Parameters](#parameters-18)
93
97
  * [NetworkAddress](#networkaddress)
94
- * [Parameters](#parameters-18)
98
+ * [Parameters](#parameters-19)
95
99
  * [subnet](#subnet)
96
100
  * [networkInterface](#networkinterface)
97
101
  * [address](#address)
98
102
  * [addresses](#addresses)
99
- * [Parameters](#parameters-19)
100
- * [cidrAddresses](#cidraddresses)
101
103
  * [Parameters](#parameters-20)
102
- * [SkeletonNetworkInterface](#skeletonnetworkinterface)
103
- * [networkAddresses](#networkaddresses)
104
- * [Parameters](#parameters-21)
104
+ * [cidrAddresses](#cidraddresses)
105
+ * [Parameters](#parameters-21)
105
106
  * [families](#families)
106
107
  * [secretName](#secretname)
107
108
  * [directHosts](#directhosts)
@@ -218,6 +219,10 @@ Returns **any** 
218
219
 
219
220
  Returns **AsyncIterable\<ContentProvider>**&#x20;
220
221
 
222
+ ### enabled
223
+
224
+ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
225
+
221
226
  ### isTemplate
222
227
 
223
228
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
@@ -296,6 +301,18 @@ Keeps track of all in flight object creations and loose ends during config initi
296
301
 
297
302
  * `directory` (optional, default `"/"`)
298
303
 
304
+ ## SkeletonNetworkInterface
305
+
306
+ **Extends ServiceOwner**
307
+
308
+ ### networkAddresses
309
+
310
+ #### Parameters
311
+
312
+ * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
313
+
314
+ Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
315
+
299
316
  ## zones
300
317
 
301
318
  Type: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<bind\_zone>
@@ -392,18 +409,6 @@ Returns **Iterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Re
392
409
 
393
410
  Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**&#x20;
394
411
 
395
- ## SkeletonNetworkInterface
396
-
397
- **Extends ServiceOwner**
398
-
399
- ### networkAddresses
400
-
401
- #### Parameters
402
-
403
- * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
404
-
405
- Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
406
-
407
412
  ## families
408
413
 
409
414
  Returns **[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;
package/bin/pmcf-info CHANGED
@@ -2,15 +2,25 @@
2
2
  import { extendingAttributeIterator } from "pacc";
3
3
  import { prepare } from "../src/cli.mjs";
4
4
 
5
- const { root, args, options } = await prepare({});
5
+ const { root, args, options } = await prepare({
6
+ maxDepth: {
7
+ type: "string",
8
+ short: "m"
9
+ }
10
+ });
6
11
 
7
12
  for (const expression of args) {
8
13
  const result = root.expression(expression);
9
14
 
10
- show(result);
15
+ show(result, 0, { short: false, maxDepth: options.maxDepth });
11
16
  }
12
17
 
13
- function show(value, indent = 0, short = false) {
18
+ function show(value, indent = 0, options = { short: false, maxDepth: 5 }) {
19
+ if (indent >= options.maxDepth) {
20
+ console.log("...");
21
+ return;
22
+ }
23
+
14
24
  switch (typeof value) {
15
25
  case "string":
16
26
  case "number":
@@ -23,7 +33,7 @@ function show(value, indent = 0, short = false) {
23
33
 
24
34
  if (value instanceof Iterator || Array.isArray(value)) {
25
35
  for (const v of value) {
26
- show(v, indent);
36
+ show(v, indent, options);
27
37
  }
28
38
  } else {
29
39
  const type = value.constructor;
@@ -32,7 +42,12 @@ function show(value, indent = 0, short = false) {
32
42
  const name = (attribute, l = indent + 1) =>
33
43
  prefix(l) + attribute.name.padEnd(ml) + ": ";
34
44
 
35
- if (short) {
45
+ if (value instanceof Set || Array.isArray(value)) {
46
+ console.log([...value].join(" "));
47
+ return;
48
+ }
49
+
50
+ if (options.short) {
36
51
  console.log(`${prefix()}${value[type.key]}:`);
37
52
  } else {
38
53
  console.log(`${prefix()}${value.fullName}(${type.name}):`);
@@ -71,9 +86,14 @@ function show(value, indent = 0, short = false) {
71
86
  if (v !== undefined) {
72
87
  if (attribute.collection) {
73
88
  if (attribute.backpointer) {
74
- console.log(name(attribute));
75
- for (const o of v.values()) {
76
- show(o, indent + 2, true);
89
+ if (indent + 2 >= options.maxDepth) {
90
+ console.log(name(attribute), "...");
91
+ } else {
92
+ console.log(name(attribute));
93
+
94
+ for (const o of v.values()) {
95
+ show(o, indent + 2, { ...options, short: true });
96
+ }
77
97
  }
78
98
  } else {
79
99
  const l = [...v];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "6.24.0",
3
+ "version": "6.25.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,7 +1,8 @@
1
1
  import { join } from "node:path";
2
2
  import {
3
3
  string_attribute_writable,
4
- default_collection_attribute_writable
4
+ default_collection_attribute_writable,
5
+ number_attribute_writable
5
6
  } from "pacc";
6
7
  import { network_attribute } from "../common-attributes.mjs";
7
8
  import { Host, cidrAddresses, addType } from "pmcf";
@@ -52,7 +53,12 @@ export class NetworkInterface extends SkeletonNetworkInterface {
52
53
  private: true
53
54
  },
54
55
  hwaddr: { ...string_attribute_writable, name: "hwaddr" },
55
- destination: { ...string_attribute_writable, name: "destination" }
56
+ destination: { ...string_attribute_writable, name: "destination" },
57
+
58
+ /*
59
+ InitialCongestionWindow: { ...number_attribute_writable, name: "InitialCongestionWindow", default: 10, configurable: true },
60
+ InitialAdvertisedReceiveWindow: { ...number_attribute_writable, name: "InitialAdvertisedReceiveWindow", default: 10, configurable: true },
61
+ */
56
62
  };
57
63
 
58
64
  static {
@@ -77,14 +77,38 @@ export const ServiceTypes = {
77
77
  },
78
78
  ldap: {
79
79
  endpoints: [
80
- { family: FAMILY_IPV4, scheme: "ldap", protocol: "tcp", port: 389, tls: false },
81
- { family: FAMILY_IPV6, scheme: "ldap", protocol: "tcp", port: 389, tls: false }
80
+ {
81
+ family: FAMILY_IPV4,
82
+ scheme: "ldap",
83
+ protocol: "tcp",
84
+ port: 389,
85
+ tls: false
86
+ },
87
+ {
88
+ family: FAMILY_IPV6,
89
+ scheme: "ldap",
90
+ protocol: "tcp",
91
+ port: 389,
92
+ tls: false
93
+ }
82
94
  ]
83
95
  },
84
96
  ldaps: {
85
97
  endpoints: [
86
- { family: FAMILY_IPV4, scheme: "ldaps", protocol: "tcp", port: 636, tls: true },
87
- { family: FAMILY_IPV6, scheme: "ldaps", protocol: "tcp", port: 636, tls: true }
98
+ {
99
+ family: FAMILY_IPV4,
100
+ scheme: "ldaps",
101
+ protocol: "tcp",
102
+ port: 636,
103
+ tls: true
104
+ },
105
+ {
106
+ family: FAMILY_IPV6,
107
+ scheme: "ldaps",
108
+ protocol: "tcp",
109
+ port: 636,
110
+ tls: true
111
+ }
88
112
  ]
89
113
  },
90
114
  ldapi: {
@@ -92,21 +116,57 @@ export const ServiceTypes = {
92
116
  },
93
117
  http: {
94
118
  endpoints: [
95
- { family: FAMILY_IPV4, scheme: "http", protocol: "tcp", port: 80, tls: false },
96
- { family: FAMILY_IPV6, scheme: "http", protocol: "tcp", port: 80, tls: false }
119
+ {
120
+ family: FAMILY_IPV4,
121
+ scheme: "http",
122
+ protocol: "tcp",
123
+ port: 80,
124
+ tls: false
125
+ },
126
+ {
127
+ family: FAMILY_IPV6,
128
+ scheme: "http",
129
+ protocol: "tcp",
130
+ port: 80,
131
+ tls: false
132
+ }
97
133
  ]
98
134
  },
99
135
  https: {
100
136
  endpoints: [
101
- { family: FAMILY_IPV4, scheme: "https", protocol: "tcp", port: 443, tls: true },
102
- { family: FAMILY_IPV6, scheme: "https", protocol: "tcp", port: 443, tls: true }
137
+ {
138
+ family: FAMILY_IPV4,
139
+ scheme: "https",
140
+ protocol: "tcp",
141
+ port: 443,
142
+ tls: true
143
+ },
144
+ {
145
+ family: FAMILY_IPV6,
146
+ scheme: "https",
147
+ protocol: "tcp",
148
+ port: 443,
149
+ tls: true
150
+ }
103
151
  ],
104
152
  dnsRecord: { type: "HTTPS", parameters: { alpn: "h2" } }
105
153
  },
106
154
  http3: {
107
155
  endpoints: [
108
- { family: FAMILY_IPV4, scheme: "https", protocol: "udp", port: 443, tls: true },
109
- { family: FAMILY_IPV6, scheme: "https", protocol: "udp", port: 443, tls: true }
156
+ {
157
+ family: FAMILY_IPV4,
158
+ scheme: "https",
159
+ protocol: "udp",
160
+ port: 443,
161
+ tls: true
162
+ },
163
+ {
164
+ family: FAMILY_IPV6,
165
+ scheme: "https",
166
+ protocol: "udp",
167
+ port: 443,
168
+ tls: true
169
+ }
110
170
  ],
111
171
  dnsRecord: {
112
172
  type: "HTTPS",
@@ -168,13 +228,18 @@ export const ServiceTypes = {
168
228
  { family: FAMILY_IPV6, protocol: "udp", port: 546, tls: false }
169
229
  ]
170
230
  },
171
- "dhcpv6-server": { endpoints: [{ family: FAMILY_IPV6, port: 547, tls: false }] },
231
+ "dhcpv6-server": {
232
+ endpoints: [{ family: FAMILY_IPV6, port: 547, tls: false }]
233
+ },
172
234
  smb: {
173
235
  endpoints: [
174
236
  { family: FAMILY_IPV4, protocol: "tcp", port: 445, tls: false },
175
237
  { family: FAMILY_IPV6, protocol: "tcp", port: 445, tls: false }
176
238
  ]
177
239
  },
240
+ nginx: {
241
+ extends: ["http", "https", "http3"]
242
+ },
178
243
  timemachine: {
179
244
  extends: ["smb"],
180
245
  dnsRecord: {
@@ -401,7 +401,8 @@ class bind_group extends Base {
401
401
  );
402
402
 
403
403
  const reverseZone =
404
- this.hasReverse && na.subnet.prefix &&
404
+ this.hasReverse &&
405
+ na.subnet.prefix &&
405
406
  this._zones.getOrInsertComputed(
406
407
  reverseArpa(na.subnet.prefix),
407
408
  domain =>
@@ -585,6 +586,10 @@ function addressesStatement(prefix, objects, empty = false, indent = "") {
585
586
 
586
587
  export class bind extends ExtraSourceService {
587
588
  static attributes = {
589
+ forwarders: {
590
+ ...default_collection_attribute,
591
+ name: "forwarders"
592
+ },
588
593
  groups: {
589
594
  ...default_collection_attribute_writable,
590
595
  name: "groups",
@@ -647,7 +652,7 @@ export class bind extends ExtraSourceService {
647
652
  return this.primaries ? "secondary" : "primary";
648
653
  }
649
654
 
650
- async writeForwarders(outputControl) {
655
+ get forwarders() {
651
656
  const forwarders = serviceEndpoints(this.source, {
652
657
  services: "services[types[dns] && priority>=100 && priority<200]",
653
658
  endpoints: endpoint => endpoint.family !== FAMILY_DNS,
@@ -655,6 +660,12 @@ export class bind extends ExtraSourceService {
655
660
  limit: 5
656
661
  });
657
662
 
663
+ return forwarders;
664
+ }
665
+
666
+ async writeForwarders(outputControl) {
667
+ const forwarders = this.forwarders;
668
+
658
669
  if (forwarders.length) {
659
670
  await writeLines(
660
671
  join(outputControl.dir, "etc/named/options"),