pmcf 6.44.5 → 6.44.7

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
@@ -82,29 +82,29 @@ generates config packages for:
82
82
  * [domainNames](#domainnames)
83
83
  * [InitializationContext](#initializationcontext)
84
84
  * [Parameters](#parameters-14)
85
+ * [SkeletonNetworkInterface](#skeletonnetworkinterface)
86
+ * [networkAddresses](#networkaddresses)
87
+ * [Parameters](#parameters-15)
85
88
  * [zones](#zones)
86
89
  * [addressesStatement](#addressesstatement)
87
- * [Parameters](#parameters-15)
90
+ * [Parameters](#parameters-16)
88
91
  * [SystemdJournalRemoteService](#systemdjournalremoteservice)
89
92
  * [Properties](#properties)
90
93
  * [systemdConfigs](#systemdconfigs)
91
- * [Parameters](#parameters-16)
94
+ * [Parameters](#parameters-17)
92
95
  * [SystemdJournalUploadService](#systemdjournaluploadservice)
93
96
  * [Properties](#properties-1)
94
97
  * [systemdConfigs](#systemdconfigs-1)
95
- * [Parameters](#parameters-17)
98
+ * [Parameters](#parameters-18)
96
99
  * [NetworkAddress](#networkaddress)
97
- * [Parameters](#parameters-18)
100
+ * [Parameters](#parameters-19)
98
101
  * [subnet](#subnet)
99
102
  * [networkInterface](#networkinterface)
100
103
  * [address](#address)
101
104
  * [addresses](#addresses)
102
- * [Parameters](#parameters-19)
103
- * [cidrAddresses](#cidraddresses)
104
105
  * [Parameters](#parameters-20)
105
- * [SkeletonNetworkInterface](#skeletonnetworkinterface)
106
- * [networkAddresses](#networkaddresses)
107
- * [Parameters](#parameters-21)
106
+ * [cidrAddresses](#cidraddresses)
107
+ * [Parameters](#parameters-21)
108
108
  * [families](#families)
109
109
  * [secretName](#secretname)
110
110
  * [directHosts](#directhosts)
@@ -293,7 +293,7 @@ Endpoint based on http
293
293
  ### Parameters
294
294
 
295
295
  * `service` **Service** 
296
- * `address` **any** 
296
+ * `address` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [URL](https://developer.mozilla.org/docs/Web/API/URL/URL))** 
297
297
  * `data` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
298
298
 
299
299
  ### port
@@ -312,6 +312,18 @@ Keeps track of all in flight object creations and loose ends during config initi
312
312
 
313
313
  * `directory` (optional, default `"/"`)
314
314
 
315
+ ## SkeletonNetworkInterface
316
+
317
+ **Extends ServiceOwner**
318
+
319
+ ### networkAddresses
320
+
321
+ #### Parameters
322
+
323
+ * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
324
+
325
+ Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
326
+
315
327
  ## zones
316
328
 
317
329
  Type: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<bind\_zone>
@@ -402,18 +414,6 @@ Returns **Iterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Re
402
414
 
403
415
  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;
404
416
 
405
- ## SkeletonNetworkInterface
406
-
407
- **Extends ServiceOwner**
408
-
409
- ### networkAddresses
410
-
411
- #### Parameters
412
-
413
- * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
414
-
415
- Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
416
-
417
417
  ## families
418
418
 
419
419
  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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "6.44.5",
3
+ "version": "6.44.7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -50,7 +50,7 @@
50
50
  "lint:docs": "documentation lint ./src**/*.mjs"
51
51
  },
52
52
  "dependencies": {
53
- "aggregated-map": "^1.0.10",
53
+ "aggregated-map": "^1.0.11",
54
54
  "content-entry-transform": "^1.7.6",
55
55
  "ip-utilties": "^3.13.1",
56
56
  "npm-pkgbuild": "^22.1.3",
@@ -59,7 +59,7 @@
59
59
  "yaml": "^2.9.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@types/node": "^26.4.1",
62
+ "@types/node": "^26.5.0",
63
63
  "ava": "^8.0.1",
64
64
  "c8": "^12.0.0",
65
65
  "documentation": "^14.0.3",
@@ -15,7 +15,7 @@ import {
15
15
 
16
16
  export const networkAddressType = "network|host|network_interface";
17
17
 
18
- export const extends_attribute = {
18
+ export const extends_attribute = {
19
19
  ...default_collection_attribute_writable,
20
20
  name: "extends"
21
21
  };
@@ -78,6 +78,21 @@ export const clusters_attribute = {
78
78
  backpointer: owner_attribute
79
79
  };
80
80
 
81
+ export const address_attribute = {
82
+ ...string_attribute_writable,
83
+ name: "address"
84
+ };
85
+
86
+ export const cidr_address_attribute = {
87
+ ...string_attribute_writable,
88
+ name: "cidrAddress"
89
+ };
90
+
91
+ export const cidr_addresses_attribute = {
92
+ ...string_collection_attribute_writable,
93
+ name: "cidrAddresses"
94
+ };
95
+
81
96
  export const subnets_attribute = {
82
97
  ...default_collection_attribute_writable,
83
98
  name: "subnets",
@@ -140,15 +155,13 @@ export const networkAttributes = {
140
155
  multicastDNS: { ...boolean_attribute_writable, name: "multicastDNS" }
141
156
  };
142
157
 
158
+
143
159
  export const networkAddressAttributes = {
144
160
  hostName: hostname_attribute,
145
- cidrAddresses: {
146
- ...string_collection_attribute_writable,
147
- name: "cidrAddresses"
148
- },
149
- cidrAddress: { ...string_attribute_writable, name: "cidrAddress" },
161
+ cidrAddresses: cidr_addresses_attribute,
162
+ cidrAddress: cidr_address_attribute,
150
163
  addresses: { ...string_collection_attribute_writable, name: "addresses" },
151
- address: { ...string_attribute_writable, name: "address" }
164
+ address: address_attribute
152
165
  };
153
166
 
154
167
  export const endpointAttributes = {
@@ -162,4 +175,3 @@ export const endpointAttributes = {
162
175
  tls: { ...boolean_attribute_false, name: "tls" },
163
176
  address: { ...string_attribute, name: "address" }
164
177
  };
165
-
package/src/endpoint.mjs CHANGED
@@ -182,7 +182,7 @@ export class HTTPEndpoint extends BaseEndpoint {
182
182
  /**
183
183
  *
184
184
  * @param {Service} service
185
- * @param {*} address
185
+ * @param {string|URL} address
186
186
  * @param {object} data
187
187
  * @param {number} data.port
188
188
  * @param {string} data.pathname
@@ -9,7 +9,7 @@ import { familyIP, formatCIDR, decodeIP, addressType } from "ip-utilties";
9
9
  import { Subnet } from "./subnet.mjs";
10
10
  import { Owner, addType } from "pmcf";
11
11
  import { NetworkInterface } from "./network-interfaces/network-interface.mjs";
12
- import { family_attribute, subnet_attribute } from "./common-attributes.mjs";
12
+ import { family_attribute, subnet_attribute, address_attribute, cidr_address_attribute } from "./common-attributes.mjs";
13
13
  /**
14
14
  *
15
15
  */
@@ -18,9 +18,9 @@ export class NetworkAddress {
18
18
  static priority = 1;
19
19
  static key = "address";
20
20
  static attributes = {
21
- address: { ...string_attribute, name: "address" },
21
+ address: address_attribute,
22
22
  type: type_attribute,
23
- cidrAddress: { ...string_attribute, name: "cidrAddress" },
23
+ cidrAddress: cidr_address_attribute,
24
24
  networkInterface: {
25
25
  ...default_attribute,
26
26
  name: "networkInterface",
@@ -134,7 +134,12 @@ export class kea extends CoreService {
134
134
  {
135
135
  family: FAMILY_UNIX,
136
136
  path: "/run/kea/ctrl-4"
137
- }
137
+ },
138
+ /*{
139
+ family: FAMILY_IPV4,
140
+ port: 53005,
141
+ pathname: "/"
142
+ }*/
138
143
  ]
139
144
  },
140
145
  "kea-control-dhcp6": {
@@ -142,7 +147,12 @@ export class kea extends CoreService {
142
147
  {
143
148
  family: FAMILY_UNIX,
144
149
  path: "/run/kea/ctrl-6"
145
- }
150
+ },
151
+ /*{
152
+ family: FAMILY_IPV6,
153
+ port: 53005,
154
+ pathname: "/"
155
+ }*/
146
156
  ]
147
157
  },
148
158
  "kea-control-ddns": {
@@ -207,7 +217,9 @@ export class kea extends CoreService {
207
217
  "interfaces-config": {
208
218
  interfaces: listenInterfaces(`IPv${family}`)
209
219
  },
210
- "control-sockets": [toUnix(this.endpoint(`kea-control-dhcp${family}`))],
220
+ "control-sockets": this.endpoints(`kea-control-dhcp${family}`).map(e =>
221
+ toSocket(e)
222
+ ),
211
223
  "lease-database": {
212
224
  type: "memfile",
213
225
  "lfc-interval": 3600
@@ -307,11 +319,32 @@ export class kea extends CoreService {
307
319
  return cfg;
308
320
  };
309
321
 
310
- const toUnix = endpoint => {
311
- return {
312
- "socket-type": FAMILY_UNIX,
313
- "socket-name": endpoint?.path
314
- };
322
+ const toSocket = endpoint => {
323
+ switch (endpoint.family) {
324
+ case FAMILY_IPV4:
325
+ case FAMILY_IPV6:
326
+ return {
327
+ "socket-type": "http",
328
+ "socket-address": endpoint.address.hostname,
329
+ "socket-port": endpoint.port,
330
+ authentication: {
331
+ type: "basic",
332
+ realm: "Kea Control Agent",
333
+ directory: "/etc/kea",
334
+ clients: [
335
+ {
336
+ "user-file": "kea-api-user",
337
+ "password-file": "kea-api-password"
338
+ }
339
+ ]
340
+ }
341
+ };
342
+ case FAMILY_UNIX:
343
+ return {
344
+ "socket-type": FAMILY_UNIX,
345
+ "socket-name": endpoint?.path
346
+ };
347
+ }
315
348
  };
316
349
 
317
350
  /*const ctrlAgent = {
@@ -319,9 +352,9 @@ export class kea extends CoreService {
319
352
  "http-host": ctrlAgentEndpoint.hostname,
320
353
  "http-port": ctrlAgentEndpoint.port,
321
354
  "control-sockets": {
322
- dhcp4: toUnix(this.endpoint("kea-control-dhcp4")),
323
- dhcp6: toUnix(this.endpoint("kea-control-dhcp6")),
324
- d2: toUnix(this.endpoint("kea-control-ddns"))
355
+ dhcp4: toSocket(this.endpoint("kea-control-dhcp4")),
356
+ dhcp6: toSocket(this.endpoint("kea-control-dhcp6")),
357
+ d2: toSocket(this.endpoint("kea-control-ddns"))
325
358
  },
326
359
  loggers
327
360
  }
@@ -349,9 +382,7 @@ export class kea extends CoreService {
349
382
  DhcpDdns: {
350
383
  "ip-address": ddnsEndpoint.address,
351
384
  port: ddnsEndpoint.port,
352
- "control-socket": toUnix(
353
- this.endpoint(e => e.type === "kea-control-ddns")
354
- ),
385
+ "control-socket": toSocket(this.endpoint("kea-control-ddns")),
355
386
  "tsig-keys": [],
356
387
  "forward-ddns": {
357
388
  "ddns-domains": dnsServersSlot([...this.domains])
@@ -1,62 +0,0 @@
1
- import {
2
- default_attribute_writable,
3
- string_collection_attribute_writable,
4
- string_attribute_writable,
5
- integer_attribute_writable,
6
- hostname_attribute as hostname_attribute_base,
7
- boolean_attribute_writable
8
- } from "pacc";
9
-
10
- export const networkAddressType = "network|host|network_interface";
11
-
12
- export const networks_attribute = {
13
- ...default_attribute_writable,
14
- name: "networks",
15
- type: "network",
16
- collection: true
17
- };
18
-
19
- export const psk_attribute = { ...string_attribute_writable, name: "psk" };
20
- export const ssid_attribute = { ...string_attribute_writable, name: "ssid" };
21
- export const hostname_attribute = {
22
- ...hostname_attribute_base,
23
- name: "hostName",
24
- writable: true
25
- };
26
-
27
- export const networkAttributes = {
28
- scope: {
29
- ...string_attribute_writable,
30
- name: "scope",
31
- values: ["global", "site", "link", "host"]
32
- // default: "global"
33
- },
34
- class: {
35
- ...string_attribute_writable,
36
- name: "class",
37
- values: ["10GBASE-T", "1000BASE-T", "100BASE-T", "10BASE-T"]
38
- },
39
- kind: {
40
- ...string_attribute_writable,
41
- name: "kind",
42
- values: ["loopback", "ethernet", "wlan", "wireguard", "fiber", "dsl"]
43
- },
44
- ssid: ssid_attribute,
45
- psk: psk_attribute,
46
- secretName: { ...string_attribute_writable, name: "secretName" },
47
- metric: { ...integer_attribute_writable, name: "metric" /*default: 1004*/ },
48
- mtu: { ...integer_attribute_writable, name: "mtu", default: 1500 },
49
- gateway: { ...default_attribute_writable, name: "gateway", type: "host" },
50
- multicastDNS: { ...boolean_attribute_writable, name: "multicastDNS" }
51
- };
52
-
53
- export const networkAddressAttributes = {
54
- hostName: hostname_attribute,
55
- cidrAddresses: {
56
- ...string_collection_attribute_writable,
57
- name: "cidrAddresses"
58
- },
59
- cidrAddress: { ...string_attribute_writable, name: "cidrAddress" },
60
- addresses: { ...string_collection_attribute_writable, name: "addresses" },
61
- address: { ...string_attribute_writable, name: "address" }
62
- };