pmcf 2.51.5 → 2.51.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/package.json +1 -1
- package/src/endpoint.mjs +15 -4
- package/src/services/dhcp.mjs +23 -27
- package/src/subnet.mjs +4 -3
- package/types/endpoint.d.mts +5 -2
- package/types/subnet.d.mts +1 -1
package/package.json
CHANGED
package/src/endpoint.mjs
CHANGED
|
@@ -89,7 +89,7 @@ export class DomainNameEndpoint extends PortEndpoint {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
export class HTTPEndpoint extends
|
|
92
|
+
export class HTTPEndpoint extends BaseEndpoint {
|
|
93
93
|
constructor(service, address, data) {
|
|
94
94
|
super(service, data);
|
|
95
95
|
|
|
@@ -98,21 +98,24 @@ export class HTTPEndpoint extends PortEndpoint {
|
|
|
98
98
|
} else if (address instanceof URL) {
|
|
99
99
|
this.url = address;
|
|
100
100
|
} else {
|
|
101
|
+
this.family = address.family;
|
|
101
102
|
this.url = new URL(
|
|
102
|
-
"http://" +
|
|
103
|
+
(data.tls ? "https://" : "http://") +
|
|
103
104
|
(address.family === "IPv6"
|
|
104
105
|
? "[" + address.address + "]"
|
|
105
106
|
: address.address) +
|
|
106
107
|
":" +
|
|
107
108
|
data.port +
|
|
108
|
-
data.
|
|
109
|
+
(data.pathname || "/")
|
|
109
110
|
);
|
|
110
111
|
this.hostname = address.address;
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
get port() {
|
|
115
|
-
return
|
|
116
|
+
return (
|
|
117
|
+
this.url.port || (this.url.toString().startsWith("https:") ? 443 : 80)
|
|
118
|
+
);
|
|
116
119
|
}
|
|
117
120
|
|
|
118
121
|
get pathname() {
|
|
@@ -123,6 +126,14 @@ export class HTTPEndpoint extends PortEndpoint {
|
|
|
123
126
|
return this.url;
|
|
124
127
|
}
|
|
125
128
|
|
|
129
|
+
get protocol() {
|
|
130
|
+
return "tcp";
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
get tls() {
|
|
134
|
+
return this.url.toString().startsWith("https:");
|
|
135
|
+
}
|
|
136
|
+
|
|
126
137
|
toString() {
|
|
127
138
|
return `${this.type}:${this.url}`;
|
|
128
139
|
}
|
package/src/services/dhcp.mjs
CHANGED
|
@@ -24,8 +24,8 @@ const DHCPServiceTypeDefinition = {
|
|
|
24
24
|
|
|
25
25
|
const controlAgentEndpoint = {
|
|
26
26
|
type: "kea-control-agent",
|
|
27
|
-
port:
|
|
28
|
-
|
|
27
|
+
port: 53002,
|
|
28
|
+
pathname: "/",
|
|
29
29
|
method: "get",
|
|
30
30
|
protocol: "tcp",
|
|
31
31
|
tls: false
|
|
@@ -183,6 +183,21 @@ export class DHCPService extends Service {
|
|
|
183
183
|
"renew-timer": 900,
|
|
184
184
|
"rebind-timer": 1800,
|
|
185
185
|
"valid-lifetime": 3600,
|
|
186
|
+
"preferred-lifetime": 3000,
|
|
187
|
+
|
|
188
|
+
"option-data": [
|
|
189
|
+
{
|
|
190
|
+
name: "dns-servers",
|
|
191
|
+
data: dnsServerEndpoints
|
|
192
|
+
.filter(endpoint => endpoint.family === `IPv${family}`)
|
|
193
|
+
.map(endpoint => endpoint.address)
|
|
194
|
+
.join(",")
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: "domain-search",
|
|
198
|
+
data: [...this.domains].join(",")
|
|
199
|
+
}
|
|
200
|
+
],
|
|
186
201
|
"hooks-libraries": [
|
|
187
202
|
{
|
|
188
203
|
library: "/usr/lib/kea/hooks/libdhcp_lease_cmds.so"
|
|
@@ -308,26 +323,15 @@ export class DHCPService extends Service {
|
|
|
308
323
|
const dhcp4 = {
|
|
309
324
|
Dhcp4: {
|
|
310
325
|
...commonConfig("4"),
|
|
311
|
-
"option-data": [
|
|
312
|
-
{
|
|
313
|
-
name: "domain-name-servers",
|
|
314
|
-
data: dnsServerEndpoints
|
|
315
|
-
.filter(endpoint => endpoint.family === "IPv4")
|
|
316
|
-
.map(endpoint => endpoint.address)
|
|
317
|
-
.join(",")
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
name: "domain-search",
|
|
321
|
-
data: [...this.domains].join(",")
|
|
322
|
-
}
|
|
323
|
-
],
|
|
324
326
|
subnet4: subnets
|
|
325
327
|
.filter(s => s.family === "IPv4")
|
|
326
328
|
.map((subnet, index) => {
|
|
327
329
|
return {
|
|
328
330
|
id: index + 1,
|
|
329
331
|
subnet: subnet.longAddress,
|
|
330
|
-
pools:
|
|
332
|
+
pools: subnet.dhcpPools.map(range => {
|
|
333
|
+
return { pool: range.join(" - ") };
|
|
334
|
+
}),
|
|
331
335
|
"option-data": [
|
|
332
336
|
{
|
|
333
337
|
name: "routers",
|
|
@@ -342,23 +346,15 @@ export class DHCPService extends Service {
|
|
|
342
346
|
const dhcp6 = {
|
|
343
347
|
Dhcp6: {
|
|
344
348
|
...commonConfig("6"),
|
|
345
|
-
"preferred-lifetime": 3000,
|
|
346
|
-
"option-data": [
|
|
347
|
-
{
|
|
348
|
-
name: "dns-servers",
|
|
349
|
-
data: dnsServerEndpoints
|
|
350
|
-
.filter(endpoint => endpoint.family === "IPv6")
|
|
351
|
-
.map(endpoint => endpoint.address)
|
|
352
|
-
.join(",")
|
|
353
|
-
}
|
|
354
|
-
],
|
|
355
349
|
subnet6: subnets
|
|
356
350
|
.filter(s => s.family === "IPv6")
|
|
357
351
|
.map((subnet, index) => {
|
|
358
352
|
return {
|
|
359
353
|
id: index + 1,
|
|
360
354
|
subnet: subnet.longAddress,
|
|
361
|
-
pools:
|
|
355
|
+
pools: subnet.dhcpPools.map(range => {
|
|
356
|
+
return { pool: range.join(" - ") };
|
|
357
|
+
}),
|
|
362
358
|
|
|
363
359
|
/*"pd-pools": [
|
|
364
360
|
{
|
package/src/subnet.mjs
CHANGED
|
@@ -64,10 +64,11 @@ 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
|
|
68
|
-
{
|
|
67
|
+
get dhcpPools() {
|
|
69
68
|
/* TODO where to take values from ? */
|
|
70
|
-
return
|
|
69
|
+
return [
|
|
70
|
+
rangeIP(this.prefix, this.prefixLength, 51, 6).map(a => decodeIP(a))
|
|
71
|
+
];
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
get address() {
|
package/types/endpoint.d.mts
CHANGED
|
@@ -14,13 +14,16 @@ export class DomainNameEndpoint extends PortEndpoint {
|
|
|
14
14
|
get networkInterface(): {};
|
|
15
15
|
get address(): any;
|
|
16
16
|
}
|
|
17
|
-
export class HTTPEndpoint extends
|
|
17
|
+
export class HTTPEndpoint extends BaseEndpoint {
|
|
18
18
|
constructor(service: any, address: any, data: any);
|
|
19
19
|
url: URL;
|
|
20
|
+
family: any;
|
|
20
21
|
hostname: any;
|
|
21
|
-
get port(): string | 80;
|
|
22
|
+
get port(): string | 80 | 443;
|
|
22
23
|
get pathname(): string;
|
|
23
24
|
get address(): URL;
|
|
25
|
+
get protocol(): string;
|
|
26
|
+
get tls(): boolean;
|
|
24
27
|
}
|
|
25
28
|
export class UnixEndpoint extends BaseEndpoint {
|
|
26
29
|
constructor(service: any, path: any, data: any);
|
package/types/subnet.d.mts
CHANGED
|
@@ -33,7 +33,7 @@ export class Subnet extends Base {
|
|
|
33
33
|
matchesAddress(address: any): any;
|
|
34
34
|
get isLinkLocal(): any;
|
|
35
35
|
get addressRange(): any;
|
|
36
|
-
get
|
|
36
|
+
get dhcpPools(): any[];
|
|
37
37
|
get address(): string;
|
|
38
38
|
get longAddress(): string;
|
|
39
39
|
_traverse(...args: any[]): boolean;
|