pmcf 6.66.11 → 6.67.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/README.md +26 -26
- package/bin/pmcf-diagram +5 -5
- package/package.json +1 -1
- package/src/core-service.mjs +4 -4
- package/src/endpoint.mjs +7 -12
- package/src/interfaces/network-interface.mjs +2 -0
- package/src/services/bind.mjs +2 -2
- package/src/services/kea.mjs +23 -12
package/README.md
CHANGED
|
@@ -71,7 +71,7 @@ generates config packages for:
|
|
|
71
71
|
* [expression](#expression)
|
|
72
72
|
* [Parameters](#parameters-11)
|
|
73
73
|
* [isTemplate](#istemplate-1)
|
|
74
|
-
* [
|
|
74
|
+
* [port\_endpoint](#port_endpoint)
|
|
75
75
|
* [Parameters](#parameters-12)
|
|
76
76
|
* [port](#port)
|
|
77
77
|
* [socketAddress](#socketaddress)
|
|
@@ -81,31 +81,31 @@ generates config packages for:
|
|
|
81
81
|
* [domainNames](#domainnames)
|
|
82
82
|
* [InitializationContext](#initializationcontext)
|
|
83
83
|
* [Parameters](#parameters-14)
|
|
84
|
+
* [SkeletonNetworkInterface](#skeletonnetworkinterface)
|
|
85
|
+
* [networkAddresses](#networkaddresses)
|
|
86
|
+
* [Parameters](#parameters-15)
|
|
84
87
|
* [Interface](#interface)
|
|
85
88
|
* [zones](#zones)
|
|
86
89
|
* [addressesStatement](#addressesstatement)
|
|
87
|
-
* [Parameters](#parameters-
|
|
90
|
+
* [Parameters](#parameters-16)
|
|
88
91
|
* [SystemdJournalRemoteService](#systemdjournalremoteservice)
|
|
89
92
|
* [Properties](#properties)
|
|
90
93
|
* [systemdConfigs](#systemdconfigs)
|
|
91
|
-
* [Parameters](#parameters-
|
|
94
|
+
* [Parameters](#parameters-17)
|
|
92
95
|
* [SystemdJournalUploadService](#systemdjournaluploadservice)
|
|
93
96
|
* [Properties](#properties-1)
|
|
94
97
|
* [systemdConfigs](#systemdconfigs-1)
|
|
95
|
-
* [Parameters](#parameters-
|
|
98
|
+
* [Parameters](#parameters-18)
|
|
96
99
|
* [priority](#priority-1)
|
|
97
100
|
* [NetworkAddress](#networkaddress)
|
|
98
|
-
* [Parameters](#parameters-
|
|
101
|
+
* [Parameters](#parameters-19)
|
|
99
102
|
* [subnet](#subnet)
|
|
100
103
|
* [networkInterface](#networkinterface)
|
|
101
104
|
* [address](#address)
|
|
102
105
|
* [addresses](#addresses)
|
|
103
|
-
* [Parameters](#parameters-19)
|
|
104
|
-
* [cidrAddresses](#cidraddresses)
|
|
105
106
|
* [Parameters](#parameters-20)
|
|
106
|
-
* [
|
|
107
|
-
* [
|
|
108
|
-
* [Parameters](#parameters-21)
|
|
107
|
+
* [cidrAddresses](#cidraddresses)
|
|
108
|
+
* [Parameters](#parameters-21)
|
|
109
109
|
* [families](#families)
|
|
110
110
|
* [secretName](#secretname)
|
|
111
111
|
* [subnetForAddress](#subnetforaddress)
|
|
@@ -261,9 +261,9 @@ Returns **any** 
|
|
|
261
261
|
|
|
262
262
|
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 
|
|
263
263
|
|
|
264
|
-
##
|
|
264
|
+
## port\_endpoint
|
|
265
265
|
|
|
266
|
-
**Extends
|
|
266
|
+
**Extends base\_endpoint**
|
|
267
267
|
|
|
268
268
|
Endpoint with an ip port
|
|
269
269
|
|
|
@@ -282,9 +282,9 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
|
|
|
282
282
|
|
|
283
283
|
## url\_endpoint
|
|
284
284
|
|
|
285
|
-
**Extends
|
|
285
|
+
**Extends base\_endpoint**
|
|
286
286
|
|
|
287
|
-
|
|
287
|
+
endpoint based on url
|
|
288
288
|
|
|
289
289
|
### Parameters
|
|
290
290
|
|
|
@@ -308,6 +308,18 @@ Keeps track of all in flight object creations and loose ends during config initi
|
|
|
308
308
|
|
|
309
309
|
* `directory` (optional, default `"/"`)
|
|
310
310
|
|
|
311
|
+
## SkeletonNetworkInterface
|
|
312
|
+
|
|
313
|
+
**Extends Interface**
|
|
314
|
+
|
|
315
|
+
### networkAddresses
|
|
316
|
+
|
|
317
|
+
#### Parameters
|
|
318
|
+
|
|
319
|
+
* `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
|
|
320
|
+
|
|
321
|
+
Returns **Iterable<[NetworkAddress](#networkaddress)>** 
|
|
322
|
+
|
|
311
323
|
## Interface
|
|
312
324
|
|
|
313
325
|
**Extends ServiceOwner**
|
|
@@ -405,18 +417,6 @@ Returns **Iterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Re
|
|
|
405
417
|
|
|
406
418
|
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)>** 
|
|
407
419
|
|
|
408
|
-
## SkeletonNetworkInterface
|
|
409
|
-
|
|
410
|
-
**Extends Interface**
|
|
411
|
-
|
|
412
|
-
### networkAddresses
|
|
413
|
-
|
|
414
|
-
#### Parameters
|
|
415
|
-
|
|
416
|
-
* `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
|
|
417
|
-
|
|
418
|
-
Returns **Iterable<[NetworkAddress](#networkaddress)>** 
|
|
419
|
-
|
|
420
420
|
## families
|
|
421
421
|
|
|
422
422
|
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)>** 
|
package/bin/pmcf-diagram
CHANGED
|
@@ -4,7 +4,7 @@ import { prepare } from "../src/cli.mjs";
|
|
|
4
4
|
|
|
5
5
|
const { root, args } = await prepare();
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const site = root.expression(args[0]);
|
|
8
8
|
|
|
9
9
|
function q(str) {
|
|
10
10
|
return str.match(/^\w+$/) ? str : `"${str}"`;
|
|
@@ -12,7 +12,7 @@ function q(str) {
|
|
|
12
12
|
|
|
13
13
|
console.log("graph G {");
|
|
14
14
|
console.log(" node [shape=record];");
|
|
15
|
-
for await (const host of
|
|
15
|
+
for await (const host of site.hosts.values()) {
|
|
16
16
|
if (host.clusters.size === 0) {
|
|
17
17
|
console.log(
|
|
18
18
|
` ${q(host.name)} [label="${host.name}|{${[
|
|
@@ -25,7 +25,7 @@ for await (const host of location.hosts.values()) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
for await (const network of
|
|
28
|
+
for await (const network of site.networks.values()) {
|
|
29
29
|
console.log(
|
|
30
30
|
` ${q(network.name)} [label="${network.name}\\n${[...network.subnets.keys()]
|
|
31
31
|
.map(s => s.address)
|
|
@@ -46,7 +46,7 @@ for await (const network of location.networks.values()) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
for await (const cluster of
|
|
49
|
+
for await (const cluster of site.clusters.values()) {
|
|
50
50
|
console.log(` subgraph cluster_${cluster.name} {`);
|
|
51
51
|
|
|
52
52
|
for (const ni of cluster.members) {
|
|
@@ -73,7 +73,7 @@ for await (const cluster of location.clusters.values()) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/*
|
|
76
|
-
for (const bridge of
|
|
76
|
+
for (const bridge of site.bridges) {
|
|
77
77
|
console.log(` ${[...bridge].map(b => q(b.name)).join(" -- ")};`);
|
|
78
78
|
}
|
|
79
79
|
*/
|
package/package.json
CHANGED
package/src/core-service.mjs
CHANGED
|
@@ -15,8 +15,8 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
base,
|
|
17
17
|
host,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
endpoint,
|
|
19
|
+
domain_endpoint,
|
|
20
20
|
url_endpoint,
|
|
21
21
|
unix_endpoint
|
|
22
22
|
} from "pmcf";
|
|
@@ -182,13 +182,13 @@ export class CoreService extends base {
|
|
|
182
182
|
result.push(he);
|
|
183
183
|
}
|
|
184
184
|
} else {
|
|
185
|
-
result.push(new
|
|
185
|
+
result.push(new endpoint(this, na, options));
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
if (!domainNames.has(this.domainName)) {
|
|
190
190
|
domainNames.add(this.domainName);
|
|
191
|
-
result.push(new
|
|
191
|
+
result.push(new domain_endpoint(this, this.domainName, options));
|
|
192
192
|
}
|
|
193
193
|
break;
|
|
194
194
|
}
|
package/src/endpoint.mjs
CHANGED
|
@@ -5,8 +5,7 @@ import { CoreService } from "./core-service.mjs";
|
|
|
5
5
|
import { family_attribute, endpointAttributes } from "./common-attributes.mjs";
|
|
6
6
|
import { FAMILY_DNS, FAMILY_UNIX, PROTOCOL_TCP } from "./constants.mjs";
|
|
7
7
|
|
|
8
|
-
class
|
|
9
|
-
static name = "base_endpoint";
|
|
8
|
+
class base_endpoint {
|
|
10
9
|
static priority = 1.1;
|
|
11
10
|
static owners = [CoreService, "network_interface"];
|
|
12
11
|
static key = "type";
|
|
@@ -54,9 +53,7 @@ class BaseEndpoint {
|
|
|
54
53
|
/**
|
|
55
54
|
* Endpoint with an ip port
|
|
56
55
|
*/
|
|
57
|
-
class
|
|
58
|
-
static name = "port_endpoint";
|
|
59
|
-
|
|
56
|
+
class port_endpoint extends base_endpoint {
|
|
60
57
|
static {
|
|
61
58
|
addType(this);
|
|
62
59
|
}
|
|
@@ -95,8 +92,7 @@ class PortEndpoint extends BaseEndpoint {
|
|
|
95
92
|
}
|
|
96
93
|
}
|
|
97
94
|
|
|
98
|
-
export class
|
|
99
|
-
static name = "endpoint";
|
|
95
|
+
export class endpoint extends port_endpoint {
|
|
100
96
|
static attributes = {
|
|
101
97
|
family: family_attribute,
|
|
102
98
|
addressType: { ...string_attribute, name: "addressType" }
|
|
@@ -136,8 +132,7 @@ export class Endpoint extends PortEndpoint {
|
|
|
136
132
|
}
|
|
137
133
|
}
|
|
138
134
|
|
|
139
|
-
export class
|
|
140
|
-
static name = "domain_endpoint";
|
|
135
|
+
export class domain_endpoint extends port_endpoint {
|
|
141
136
|
static attributes = {
|
|
142
137
|
domainName: { ...string_attribute, name: "domainName" }
|
|
143
138
|
};
|
|
@@ -169,9 +164,9 @@ export class DomainNameEndpoint extends PortEndpoint {
|
|
|
169
164
|
}
|
|
170
165
|
|
|
171
166
|
/**
|
|
172
|
-
*
|
|
167
|
+
* endpoint based on url
|
|
173
168
|
*/
|
|
174
|
-
export class url_endpoint extends
|
|
169
|
+
export class url_endpoint extends base_endpoint {
|
|
175
170
|
static attributes = {
|
|
176
171
|
url: url_attribute,
|
|
177
172
|
addressType: { ...string_attribute, name: "addressType" }
|
|
@@ -262,7 +257,7 @@ export class url_endpoint extends BaseEndpoint {
|
|
|
262
257
|
}
|
|
263
258
|
}
|
|
264
259
|
|
|
265
|
-
export class unix_endpoint extends
|
|
260
|
+
export class unix_endpoint extends base_endpoint {
|
|
266
261
|
static attributes = {
|
|
267
262
|
url: url_attribute
|
|
268
263
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import {
|
|
3
3
|
string_attribute_writable,
|
|
4
|
+
string_set_attribute_writable,
|
|
4
5
|
default_collection_attribute_writable
|
|
5
6
|
} from "pacc";
|
|
6
7
|
import { network_attribute } from "../common-attributes.mjs";
|
|
@@ -54,6 +55,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
54
55
|
},
|
|
55
56
|
hwaddr: { ...string_attribute_writable, name: "hwaddr" },
|
|
56
57
|
dhcpClientId: { ...string_attribute_writable, name: "dhcpClientId" },
|
|
58
|
+
dhcpClientClasses: { ...string_set_attribute_writable, name: "dhcpClientClasses" },
|
|
57
59
|
destination: { ...string_attribute_writable, name: "destination" }
|
|
58
60
|
|
|
59
61
|
/*
|
package/src/services/bind.mjs
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import {
|
|
22
22
|
base,
|
|
23
23
|
CoreService,
|
|
24
|
-
|
|
24
|
+
endpoint,
|
|
25
25
|
endpointAddresses,
|
|
26
26
|
addresses,
|
|
27
27
|
networkAddressType,
|
|
@@ -753,7 +753,7 @@ export class bind extends CoreService {
|
|
|
753
753
|
static attributes = {
|
|
754
754
|
forwarders: {
|
|
755
755
|
...default_collection_attribute_writable,
|
|
756
|
-
type:
|
|
756
|
+
type: endpoint,
|
|
757
757
|
name: "forwarders",
|
|
758
758
|
deferredExpression: true
|
|
759
759
|
},
|
package/src/services/kea.mjs
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
addType,
|
|
20
20
|
Subnet,
|
|
21
21
|
CoreService,
|
|
22
|
-
|
|
22
|
+
endpoint,
|
|
23
23
|
sortDescendingByPriority,
|
|
24
24
|
bind_key,
|
|
25
25
|
systemdCredentialFileName,
|
|
@@ -66,7 +66,7 @@ export class kea extends CoreService {
|
|
|
66
66
|
},
|
|
67
67
|
dnsServerEndpoints: {
|
|
68
68
|
...default_collection_attribute_writable,
|
|
69
|
-
type:
|
|
69
|
+
type: endpoint,
|
|
70
70
|
name: "dnsServerEndpoints",
|
|
71
71
|
deferredExpression: true
|
|
72
72
|
},
|
|
@@ -424,7 +424,7 @@ export class kea extends CoreService {
|
|
|
424
424
|
[...hwmap]
|
|
425
425
|
.map(([k, networkInterface]) => {
|
|
426
426
|
let ip = {};
|
|
427
|
-
|
|
427
|
+
const addr = networkInterface.networkAddress(
|
|
428
428
|
n => n.family === `IPv${family}`
|
|
429
429
|
)?.address;
|
|
430
430
|
|
|
@@ -435,20 +435,31 @@ export class kea extends CoreService {
|
|
|
435
435
|
: { "ip-address": addr };
|
|
436
436
|
}
|
|
437
437
|
|
|
438
|
-
|
|
438
|
+
const other = {
|
|
439
|
+
"hw-address": k
|
|
440
|
+
};
|
|
439
441
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
442
|
+
switch (family) {
|
|
443
|
+
case "4":
|
|
444
|
+
{
|
|
445
|
+
const dhcpClientId = networkInterface.dhcpClientId;
|
|
446
|
+
if (dhcpClientId !== undefined) {
|
|
447
|
+
other["client-id"] = dhcpClientId;
|
|
448
|
+
delete other["hw-address"];
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
break;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
const dhcpClientClasses = networkInterface.dhcpClientClasses;
|
|
455
|
+
if (dhcpClientClasses !== undefined) {
|
|
456
|
+
other["client-classes"] = [...dhcpClientClasses];
|
|
445
457
|
}
|
|
446
458
|
|
|
447
459
|
return {
|
|
448
|
-
...ids,
|
|
449
|
-
...ip,
|
|
450
460
|
hostname: networkInterface.domainName,
|
|
451
|
-
|
|
461
|
+
...ip,
|
|
462
|
+
...other
|
|
452
463
|
};
|
|
453
464
|
})
|
|
454
465
|
.sort((a, b) => a.hostname?.localeCompare(b.hostname));
|