pmcf 2.4.1 → 2.5.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/package.json +1 -1
- package/src/host.mjs +18 -0
- package/src/owner.mjs +7 -15
- package/src/services/dhcp.mjs +10 -2
- package/types/host.d.mts +1 -0
- package/types/owner.d.mts +1 -1
package/package.json
CHANGED
package/src/host.mjs
CHANGED
|
@@ -385,6 +385,24 @@ export class Host extends Base {
|
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
+
get network() {
|
|
389
|
+
for (const ni of this.networkInterfaces.values()) {
|
|
390
|
+
if (ni._kind !== "loopback" && ni._network) {
|
|
391
|
+
return ni._network;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
return super.network;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
get networks() {
|
|
399
|
+
return new Set(
|
|
400
|
+
[...this.networkInterfaces.values()]
|
|
401
|
+
.filter(ni => ni._network)
|
|
402
|
+
.map(ni => ni._network)
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
|
|
388
406
|
get networkInterfaces() {
|
|
389
407
|
return this._networkInterfaces;
|
|
390
408
|
}
|
package/src/owner.mjs
CHANGED
|
@@ -137,28 +137,20 @@ export class Owner extends Base {
|
|
|
137
137
|
return this.typeNamed("host", name) || this.typeNamed("cluster", name);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
hosts() {
|
|
141
|
+
let hosts = new Set();
|
|
142
142
|
|
|
143
143
|
for (const type of ["host", "cluster"]) {
|
|
144
|
-
|
|
145
|
-
if (!hosts.has(host)) {
|
|
146
|
-
hosts.add(host);
|
|
147
|
-
yield host;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
144
|
+
hosts = hosts.union(new Set(Array.from(this.typeList(type))));
|
|
150
145
|
}
|
|
151
146
|
|
|
152
147
|
for (const type of types.host.owners) {
|
|
153
148
|
for (const object of this.typeList(type)) {
|
|
154
|
-
|
|
155
|
-
if (!hosts.has(host)) {
|
|
156
|
-
hosts.add(host);
|
|
157
|
-
yield host;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
149
|
+
hosts = hosts.union(object.hosts());
|
|
160
150
|
}
|
|
161
151
|
}
|
|
152
|
+
|
|
153
|
+
return hosts;
|
|
162
154
|
}
|
|
163
155
|
|
|
164
156
|
networkNamed(name) {
|
|
@@ -179,7 +171,7 @@ export class Owner extends Base {
|
|
|
179
171
|
}
|
|
180
172
|
yield* this.typeList("subnet");
|
|
181
173
|
|
|
182
|
-
|
|
174
|
+
/* for (const network of this.networks()) {
|
|
183
175
|
yield* network.subnets();
|
|
184
176
|
}*/
|
|
185
177
|
}
|
package/src/services/dhcp.mjs
CHANGED
|
@@ -39,6 +39,9 @@ export class DHCPService extends Service {
|
|
|
39
39
|
const network = this.network;
|
|
40
40
|
const host = this.server;
|
|
41
41
|
const name = host.name;
|
|
42
|
+
|
|
43
|
+
console.log("kea", host.name, network.name);
|
|
44
|
+
|
|
42
45
|
const packageData = {
|
|
43
46
|
dir,
|
|
44
47
|
sources: [new FileContentProvider(dir + "/")[Symbol.asyncIterator]()],
|
|
@@ -54,7 +57,9 @@ export class DHCPService extends Service {
|
|
|
54
57
|
|
|
55
58
|
const commonConfig = {
|
|
56
59
|
"interfaces-config": {
|
|
57
|
-
interfaces: [...host.networkInterfaces.values()]
|
|
60
|
+
interfaces: [...host.networkInterfaces.values()]
|
|
61
|
+
.filter(ni => ni.kind !== "loopback")
|
|
62
|
+
.map(ni => ni.name)
|
|
58
63
|
},
|
|
59
64
|
"lease-database": {
|
|
60
65
|
type: "memfile",
|
|
@@ -157,6 +162,9 @@ export class DHCPService extends Service {
|
|
|
157
162
|
const dhcp4 = {
|
|
158
163
|
Dhcp4: {
|
|
159
164
|
...commonConfig,
|
|
165
|
+
"multi-threading": {
|
|
166
|
+
"enable-multi-threading": false
|
|
167
|
+
},
|
|
160
168
|
"control-socket": {
|
|
161
169
|
"socket-type": "unix",
|
|
162
170
|
"socket-name": "/run/kea/4-ctrl-socket"
|
|
@@ -164,7 +172,7 @@ export class DHCPService extends Service {
|
|
|
164
172
|
"option-data": [
|
|
165
173
|
{
|
|
166
174
|
name: "domain-name-servers",
|
|
167
|
-
data: serviceAddresses(
|
|
175
|
+
data: serviceAddresses(network, {
|
|
168
176
|
type: "dns",
|
|
169
177
|
priority: "<10"
|
|
170
178
|
}).join(",")
|
package/types/host.d.mts
CHANGED
|
@@ -227,6 +227,7 @@ export class Host extends Base {
|
|
|
227
227
|
domainNamesIn(domain: any): Generator<any, void, unknown>;
|
|
228
228
|
get host(): this;
|
|
229
229
|
named(name: any): any;
|
|
230
|
+
get networks(): Set<any>;
|
|
230
231
|
set networkInterfaces(networkInterface: Map<any, any>);
|
|
231
232
|
get networkInterfaces(): Map<any, any>;
|
|
232
233
|
networkAddresses(): Generator<{
|
package/types/owner.d.mts
CHANGED
|
@@ -142,7 +142,7 @@ export class Owner extends Base {
|
|
|
142
142
|
locationNamed(name: any): any;
|
|
143
143
|
locations(): any;
|
|
144
144
|
hostNamed(name: any): any;
|
|
145
|
-
hosts():
|
|
145
|
+
hosts(): Set<any>;
|
|
146
146
|
networkNamed(name: any): any;
|
|
147
147
|
networks(): any;
|
|
148
148
|
subnetNamed(name: any): any;
|