pmcf 2.51.3 → 2.51.5
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 +1 -1
- package/src/endpoint.mjs +20 -8
- package/src/service.mjs +7 -4
- package/src/services/dhcp.mjs +54 -62
- package/types/endpoint.d.mts +5 -3
package/package.json
CHANGED
package/src/endpoint.mjs
CHANGED
|
@@ -93,20 +93,32 @@ export class HTTPEndpoint extends PortEndpoint {
|
|
|
93
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
96
|
if (typeof address === "string") {
|
|
97
|
+
this.url = new URL(address);
|
|
98
|
+
} else if (address instanceof URL) {
|
|
103
99
|
this.url = address;
|
|
104
100
|
} else {
|
|
105
|
-
this.url =
|
|
106
|
-
|
|
101
|
+
this.url = new URL(
|
|
102
|
+
"http://" +
|
|
103
|
+
(address.family === "IPv6"
|
|
104
|
+
? "[" + address.address + "]"
|
|
105
|
+
: address.address) +
|
|
106
|
+
":" +
|
|
107
|
+
data.port +
|
|
108
|
+
data.path
|
|
109
|
+
);
|
|
110
|
+
this.hostname = address.address;
|
|
107
111
|
}
|
|
108
112
|
}
|
|
109
113
|
|
|
114
|
+
get port() {
|
|
115
|
+
return this.url.port || 80;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
get pathname() {
|
|
119
|
+
return this.url.pathname;
|
|
120
|
+
}
|
|
121
|
+
|
|
110
122
|
get address() {
|
|
111
123
|
return this.url;
|
|
112
124
|
}
|
package/src/service.mjs
CHANGED
|
@@ -38,7 +38,7 @@ const ServiceTypes = {
|
|
|
38
38
|
ssh: { endpoints: [{ protocol: "tcp", port: 22, tls: false }] },
|
|
39
39
|
imap: { endpoints: [{ protocol: "tcp", port: 143, tls: false }] },
|
|
40
40
|
imaps: { endpoints: [{ protocol: "tcp", port: 993, tls: true }] },
|
|
41
|
-
dhcp: { endpoints: [{
|
|
41
|
+
dhcp: { endpoints: [{ protocol: "udp", port: 547, tls: false }] },
|
|
42
42
|
"dhcpv6-client": {
|
|
43
43
|
endpoints: [
|
|
44
44
|
{ protocol: "tcp", port: 546, tls: false },
|
|
@@ -208,7 +208,7 @@ export class Service extends Base {
|
|
|
208
208
|
|
|
209
209
|
return filter ? result.filter(filter) : result;
|
|
210
210
|
}
|
|
211
|
-
|
|
211
|
+
|
|
212
212
|
endpoint(filter) {
|
|
213
213
|
return this.endpoints(filter)[0];
|
|
214
214
|
}
|
|
@@ -216,7 +216,7 @@ export class Service extends Base {
|
|
|
216
216
|
address(
|
|
217
217
|
options = {
|
|
218
218
|
endpoints: e => e.networkInterface?.kind !== "loopbak",
|
|
219
|
-
select: e => e.domainName||e.address,
|
|
219
|
+
select: e => e.domainName || e.address,
|
|
220
220
|
limit: 1,
|
|
221
221
|
join: ""
|
|
222
222
|
}
|
|
@@ -275,7 +275,10 @@ export class Service extends Base {
|
|
|
275
275
|
|
|
276
276
|
if (hasSVRRecords) {
|
|
277
277
|
for (const ep of this.endpoints(
|
|
278
|
-
e =>
|
|
278
|
+
e =>
|
|
279
|
+
e.protocol &&
|
|
280
|
+
e.networkInterface &&
|
|
281
|
+
e.networkInterface.kind !== "loopback"
|
|
279
282
|
)) {
|
|
280
283
|
records.push(
|
|
281
284
|
DNSRecord(
|
package/src/services/dhcp.mjs
CHANGED
|
@@ -143,45 +143,7 @@ export class DHCPService extends Service {
|
|
|
143
143
|
};
|
|
144
144
|
});
|
|
145
145
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const commonConfig = {
|
|
149
|
-
"lease-database": {
|
|
150
|
-
type: "memfile",
|
|
151
|
-
"lfc-interval": 3600
|
|
152
|
-
},
|
|
153
|
-
"multi-threading": {
|
|
154
|
-
"enable-multi-threading": false
|
|
155
|
-
},
|
|
156
|
-
"expired-leases-processing": {
|
|
157
|
-
"reclaim-timer-wait-time": 10,
|
|
158
|
-
"flush-reclaimed-timer-wait-time": 25,
|
|
159
|
-
"hold-reclaimed-time": 3600,
|
|
160
|
-
"max-reclaim-leases": 100,
|
|
161
|
-
"max-reclaim-time": 250,
|
|
162
|
-
"unwarned-reclaim-cycles": 5
|
|
163
|
-
},
|
|
164
|
-
"renew-timer": 900,
|
|
165
|
-
"rebind-timer": 1800,
|
|
166
|
-
"valid-lifetime": 3600,
|
|
167
|
-
"hooks-libraries": [
|
|
168
|
-
{
|
|
169
|
-
library: "/usr/lib/kea/hooks/libdhcp_lease_cmds.so"
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
library: "/usr/lib/kea/hooks/libdhcp_ha.so",
|
|
173
|
-
parameters: {
|
|
174
|
-
"high-availability": [
|
|
175
|
-
{
|
|
176
|
-
"this-server-name": name,
|
|
177
|
-
mode: "hot-standby",
|
|
178
|
-
peers
|
|
179
|
-
}
|
|
180
|
-
]
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
]
|
|
184
|
-
};
|
|
146
|
+
peers.length = 2;
|
|
185
147
|
|
|
186
148
|
const loggers = [
|
|
187
149
|
{
|
|
@@ -195,6 +157,54 @@ export class DHCPService extends Service {
|
|
|
195
157
|
}
|
|
196
158
|
];
|
|
197
159
|
|
|
160
|
+
const commonConfig = family => {
|
|
161
|
+
return {
|
|
162
|
+
"interfaces-config": {
|
|
163
|
+
interfaces: listenInterfaces(`IPv${family}`)
|
|
164
|
+
},
|
|
165
|
+
"control-socket": toUnix(
|
|
166
|
+
this.endpoint(e => e.type === `kea-control-dhcp${family}`)
|
|
167
|
+
),
|
|
168
|
+
"lease-database": {
|
|
169
|
+
type: "memfile",
|
|
170
|
+
"lfc-interval": 3600
|
|
171
|
+
},
|
|
172
|
+
"multi-threading": {
|
|
173
|
+
"enable-multi-threading": false
|
|
174
|
+
},
|
|
175
|
+
"expired-leases-processing": {
|
|
176
|
+
"reclaim-timer-wait-time": 10,
|
|
177
|
+
"flush-reclaimed-timer-wait-time": 25,
|
|
178
|
+
"hold-reclaimed-time": 3600,
|
|
179
|
+
"max-reclaim-leases": 100,
|
|
180
|
+
"max-reclaim-time": 250,
|
|
181
|
+
"unwarned-reclaim-cycles": 5
|
|
182
|
+
},
|
|
183
|
+
"renew-timer": 900,
|
|
184
|
+
"rebind-timer": 1800,
|
|
185
|
+
"valid-lifetime": 3600,
|
|
186
|
+
"hooks-libraries": [
|
|
187
|
+
{
|
|
188
|
+
library: "/usr/lib/kea/hooks/libdhcp_lease_cmds.so"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
library: "/usr/lib/kea/hooks/libdhcp_ha.so",
|
|
192
|
+
parameters: {
|
|
193
|
+
"high-availability": [
|
|
194
|
+
{
|
|
195
|
+
"this-server-name": name,
|
|
196
|
+
mode: "hot-standby",
|
|
197
|
+
peers
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
"dhcp-ddns": dhcpServerDdns,
|
|
204
|
+
loggers
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
|
|
198
208
|
const toUnix = endpoint => {
|
|
199
209
|
return {
|
|
200
210
|
"socket-type": "unix",
|
|
@@ -251,7 +261,7 @@ export class DHCPService extends Service {
|
|
|
251
261
|
|
|
252
262
|
const dhcpServerDdns = {
|
|
253
263
|
"enable-updates": true,
|
|
254
|
-
"server-
|
|
264
|
+
"server-ip": ddnsEndpoint.address,
|
|
255
265
|
"server-port": ddnsEndpoint.port,
|
|
256
266
|
"max-queue-size": 64,
|
|
257
267
|
"ncr-protocol": "UDP",
|
|
@@ -297,14 +307,7 @@ export class DHCPService extends Service {
|
|
|
297
307
|
);
|
|
298
308
|
const dhcp4 = {
|
|
299
309
|
Dhcp4: {
|
|
300
|
-
...commonConfig,
|
|
301
|
-
"interfaces-config": {
|
|
302
|
-
interfaces: listenInterfaces("IPv4")
|
|
303
|
-
},
|
|
304
|
-
"control-socket": {
|
|
305
|
-
"socket-type": "unix",
|
|
306
|
-
"socket-name": "/run/kea/4-ctrl-socket"
|
|
307
|
-
},
|
|
310
|
+
...commonConfig("4"),
|
|
308
311
|
"option-data": [
|
|
309
312
|
{
|
|
310
313
|
name: "domain-name-servers",
|
|
@@ -333,21 +336,12 @@ export class DHCPService extends Service {
|
|
|
333
336
|
],
|
|
334
337
|
reservations
|
|
335
338
|
};
|
|
336
|
-
})
|
|
337
|
-
"dhcp-ddns": dhcpServerDdns,
|
|
338
|
-
loggers
|
|
339
|
+
})
|
|
339
340
|
}
|
|
340
341
|
};
|
|
341
342
|
const dhcp6 = {
|
|
342
343
|
Dhcp6: {
|
|
343
|
-
...commonConfig,
|
|
344
|
-
"interfaces-config": {
|
|
345
|
-
interfaces: listenInterfaces("IPv6")
|
|
346
|
-
},
|
|
347
|
-
"control-socket": {
|
|
348
|
-
"socket-type": "unix",
|
|
349
|
-
"socket-name": "/run/kea/6-ctrl-socket"
|
|
350
|
-
},
|
|
344
|
+
...commonConfig("6"),
|
|
351
345
|
"preferred-lifetime": 3000,
|
|
352
346
|
"option-data": [
|
|
353
347
|
{
|
|
@@ -380,9 +374,7 @@ export class DHCPService extends Service {
|
|
|
380
374
|
}*/
|
|
381
375
|
]
|
|
382
376
|
};
|
|
383
|
-
})
|
|
384
|
-
"dhcp-ddns": dhcpServerDdns,
|
|
385
|
-
loggers
|
|
377
|
+
})
|
|
386
378
|
}
|
|
387
379
|
};
|
|
388
380
|
|
package/types/endpoint.d.mts
CHANGED
|
@@ -16,9 +16,11 @@ export class DomainNameEndpoint extends PortEndpoint {
|
|
|
16
16
|
}
|
|
17
17
|
export class HTTPEndpoint extends PortEndpoint {
|
|
18
18
|
constructor(service: any, address: any, data: any);
|
|
19
|
-
url:
|
|
20
|
-
|
|
21
|
-
get
|
|
19
|
+
url: URL;
|
|
20
|
+
hostname: any;
|
|
21
|
+
get port(): string | 80;
|
|
22
|
+
get pathname(): string;
|
|
23
|
+
get address(): URL;
|
|
22
24
|
}
|
|
23
25
|
export class UnixEndpoint extends BaseEndpoint {
|
|
24
26
|
constructor(service: any, path: any, data: any);
|