pmcf 2.49.1 → 2.51.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/package.json +4 -4
- package/src/endpoint.mjs +14 -2
- package/src/services/dhcp.mjs +47 -15
- package/src/subnet.mjs +6 -0
- package/types/cluster.d.mts +1 -1
- package/types/endpoint.d.mts +4 -3
- package/types/subnet.d.mts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.51.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"ip-utilties": "^1.3.3",
|
|
49
|
-
"npm-pkgbuild": "^18.
|
|
49
|
+
"npm-pkgbuild": "^18.2.3",
|
|
50
50
|
"pacc": "^3.4.2",
|
|
51
51
|
"pkg-dir": "^8.0.0"
|
|
52
52
|
},
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"ava": "^6.3.0",
|
|
56
56
|
"c8": "^10.1.3",
|
|
57
57
|
"documentation": "^14.0.3",
|
|
58
|
-
"semantic-release": "^24.2.
|
|
58
|
+
"semantic-release": "^24.2.4",
|
|
59
59
|
"typescript": "^5.8.3"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
|
-
"node": ">=22.15.
|
|
62
|
+
"node": ">=22.15.1"
|
|
63
63
|
},
|
|
64
64
|
"repository": {
|
|
65
65
|
"type": "git",
|
package/src/endpoint.mjs
CHANGED
|
@@ -90,9 +90,21 @@ export class DomainNameEndpoint extends PortEndpoint {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
export class HTTPEndpoint extends PortEndpoint {
|
|
93
|
-
constructor(service,
|
|
93
|
+
constructor(service, address, data) {
|
|
94
94
|
super(service, data);
|
|
95
|
-
|
|
95
|
+
|
|
96
|
+
for (const name of ["path"]) {
|
|
97
|
+
if (data[name] !== undefined) {
|
|
98
|
+
this[name] = data[name];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (typeof address === "string") {
|
|
103
|
+
this.url = address;
|
|
104
|
+
} else {
|
|
105
|
+
this.url = "http://" + address.address + ":" + data.port + data.path;
|
|
106
|
+
this.host = address.address;
|
|
107
|
+
}
|
|
96
108
|
}
|
|
97
109
|
|
|
98
110
|
get address() {
|
package/src/services/dhcp.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
ServiceTypeDefinition,
|
|
6
6
|
Endpoint,
|
|
7
7
|
UnixEndpoint,
|
|
8
|
+
HTTPEndpoint,
|
|
8
9
|
serviceEndpoints,
|
|
9
10
|
SUBNET_LOCALHOST_IPV4,
|
|
10
11
|
SUBNET_LOCALHOST_IPV6
|
|
@@ -24,6 +25,8 @@ const DHCPServiceTypeDefinition = {
|
|
|
24
25
|
const controlAgentEndpoint = {
|
|
25
26
|
type: "kea-control-agent",
|
|
26
27
|
port: 8000,
|
|
28
|
+
path: "/",
|
|
29
|
+
method: "get",
|
|
27
30
|
protocol: "tcp",
|
|
28
31
|
tls: false
|
|
29
32
|
};
|
|
@@ -75,10 +78,12 @@ export class DHCPService extends Service {
|
|
|
75
78
|
const endpoints = super.endpoints(filter);
|
|
76
79
|
|
|
77
80
|
for (const na of this.host.networkAddresses(
|
|
78
|
-
na => na.networkInterface.kind === "
|
|
81
|
+
na => na.networkInterface.kind === "loopback"
|
|
79
82
|
)) {
|
|
80
|
-
endpoints.push(
|
|
81
|
-
|
|
83
|
+
endpoints.push(
|
|
84
|
+
new HTTPEndpoint(this, na, controlAgentEndpoint),
|
|
85
|
+
new Endpoint(this, na, ddnsEndpoint)
|
|
86
|
+
);
|
|
82
87
|
}
|
|
83
88
|
|
|
84
89
|
endpoints.push(
|
|
@@ -117,6 +122,10 @@ export class DHCPService extends Service {
|
|
|
117
122
|
}
|
|
118
123
|
};
|
|
119
124
|
|
|
125
|
+
const ctrlAgentEndpoint = this.endpoint(
|
|
126
|
+
e => e.type === "kea-control-agent"
|
|
127
|
+
);
|
|
128
|
+
|
|
120
129
|
const commonConfig = {
|
|
121
130
|
"lease-database": {
|
|
122
131
|
type: "memfile",
|
|
@@ -135,7 +144,35 @@ export class DHCPService extends Service {
|
|
|
135
144
|
},
|
|
136
145
|
"renew-timer": 900,
|
|
137
146
|
"rebind-timer": 1800,
|
|
138
|
-
"valid-lifetime": 3600
|
|
147
|
+
"valid-lifetime": 3600,
|
|
148
|
+
"hooks-libraries": [
|
|
149
|
+
{
|
|
150
|
+
library: "/usr/lib/kea/hooks/libdhcp_lease_cmds.so"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
library: "/usr/lib/kea/hooks/libdhcp_ha.so",
|
|
154
|
+
parameters: {
|
|
155
|
+
"high-availability": [
|
|
156
|
+
{
|
|
157
|
+
"this-server-name": name,
|
|
158
|
+
mode: "hot-standby",
|
|
159
|
+
peers: [
|
|
160
|
+
{
|
|
161
|
+
name: name,
|
|
162
|
+
url: ctrlAgentEndpoint.url,
|
|
163
|
+
role: "primary"
|
|
164
|
+
} /*,
|
|
165
|
+
{
|
|
166
|
+
name: "server2",
|
|
167
|
+
url: "http://172.28.0.254:8000/",
|
|
168
|
+
role: "standby"
|
|
169
|
+
}*/
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
]
|
|
139
176
|
};
|
|
140
177
|
|
|
141
178
|
const loggers = [
|
|
@@ -159,8 +196,8 @@ export class DHCPService extends Service {
|
|
|
159
196
|
|
|
160
197
|
const ctrlAgent = {
|
|
161
198
|
"Control-agent": {
|
|
162
|
-
"http-host":
|
|
163
|
-
"http-port":
|
|
199
|
+
"http-host": ctrlAgentEndpoint?.host,
|
|
200
|
+
"http-port": ctrlAgentEndpoint?.port,
|
|
164
201
|
"control-sockets": {
|
|
165
202
|
dhcp4: toUnix(this.endpoint(e => e.type === "kea-control-dhcp4")),
|
|
166
203
|
dhcp6: toUnix(this.endpoint(e => e.type === "kea-control-dhcp6")),
|
|
@@ -189,10 +226,7 @@ export class DHCPService extends Service {
|
|
|
189
226
|
"control-socket": toUnix(
|
|
190
227
|
this.endpoint(e => e.type === "kea-control-ddns")
|
|
191
228
|
),
|
|
192
|
-
|
|
193
|
-
"socket-type": "unix",
|
|
194
|
-
"socket-name": "/run/kea/ddns-ctrl-socket"
|
|
195
|
-
} */ "tsig-keys": [],
|
|
229
|
+
"tsig-keys": [],
|
|
196
230
|
"forward-ddns": {
|
|
197
231
|
"ddns-domains": dnsServersSlot([...this.domains])
|
|
198
232
|
},
|
|
@@ -249,10 +283,8 @@ export class DHCPService extends Service {
|
|
|
249
283
|
);
|
|
250
284
|
|
|
251
285
|
const subnets = [...this.subnets].filter(
|
|
252
|
-
s =>
|
|
253
|
-
|
|
254
|
-
s !== SUBNET_LOCALHOST_IPV6 /* s.address !== "127/8"*/
|
|
255
|
-
); // TODO no localhost
|
|
286
|
+
s => s !== SUBNET_LOCALHOST_IPV4 && s !== SUBNET_LOCALHOST_IPV6
|
|
287
|
+
);
|
|
256
288
|
const dhcp4 = {
|
|
257
289
|
Dhcp4: {
|
|
258
290
|
...commonConfig,
|
|
@@ -282,7 +314,7 @@ export class DHCPService extends Service {
|
|
|
282
314
|
return {
|
|
283
315
|
id: index + 1,
|
|
284
316
|
subnet: subnet.longAddress,
|
|
285
|
-
pools: [{ pool: subnet.
|
|
317
|
+
pools: [{ pool: subnet.dhcpUsableAddressRange.join(" - ") }],
|
|
286
318
|
"option-data": [
|
|
287
319
|
{
|
|
288
320
|
name: "routers",
|
package/src/subnet.mjs
CHANGED
|
@@ -64,6 +64,12 @@ export class Subnet extends Base {
|
|
|
64
64
|
return rangeIP(this.prefix, this.prefixLength, 1, 1).map(a => decodeIP(a));
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
get dhcpUsableAddressRange()
|
|
68
|
+
{
|
|
69
|
+
/* TODO where to take values from ? */
|
|
70
|
+
return rangeIP(this.prefix, this.prefixLength, 51, 6).map(a => decodeIP(a));
|
|
71
|
+
}
|
|
72
|
+
|
|
67
73
|
get address() {
|
|
68
74
|
return this.name;
|
|
69
75
|
}
|
package/types/cluster.d.mts
CHANGED
|
@@ -350,7 +350,7 @@ export class Cluster extends Host {
|
|
|
350
350
|
get backups(): Set<any>;
|
|
351
351
|
get members(): Set<any>;
|
|
352
352
|
preparePackages(stagingDir: any): AsyncGenerator<{
|
|
353
|
-
sources: AsyncIterable<import("content-entry").ContentEntry>[];
|
|
353
|
+
sources: AsyncIterable<import("content-entry").ContentEntry | import("content-entry").CollectionEntry>[];
|
|
354
354
|
outputs: any;
|
|
355
355
|
properties: {
|
|
356
356
|
name: string;
|
package/types/endpoint.d.mts
CHANGED
|
@@ -15,9 +15,10 @@ export class DomainNameEndpoint extends PortEndpoint {
|
|
|
15
15
|
get address(): any;
|
|
16
16
|
}
|
|
17
17
|
export class HTTPEndpoint extends PortEndpoint {
|
|
18
|
-
constructor(service: any,
|
|
19
|
-
url:
|
|
20
|
-
|
|
18
|
+
constructor(service: any, address: any, data: any);
|
|
19
|
+
url: string;
|
|
20
|
+
host: any;
|
|
21
|
+
get address(): string;
|
|
21
22
|
}
|
|
22
23
|
export class UnixEndpoint extends BaseEndpoint {
|
|
23
24
|
constructor(service: any, path: any, data: any);
|
package/types/subnet.d.mts
CHANGED