pmcf 1.39.0 → 1.40.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/bin/pmcf-named-defs +12 -2
- package/package.json +1 -1
- package/src/model.mjs +11 -0
- package/src/owner.mjs +36 -5
- package/types/owner.d.mts +3 -1
package/bin/pmcf-named-defs
CHANGED
|
@@ -58,7 +58,17 @@ async function generateNamedDefs(owner, targetDir) {
|
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
const subnets = [
|
|
62
|
+
...new Set([...owner.networks()].map(n => [...n.subnets()]).flat())
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
console.log(
|
|
66
|
+
owner.fullName,
|
|
67
|
+
domain,
|
|
68
|
+
nameserver?.hostName,
|
|
69
|
+
rname,
|
|
70
|
+
subnets.map(s => `${s.owner.name}/${s.name}`)
|
|
71
|
+
);
|
|
62
72
|
|
|
63
73
|
const SOARecord = createRecord(
|
|
64
74
|
"@",
|
|
@@ -87,7 +97,7 @@ async function generateNamedDefs(owner, targetDir) {
|
|
|
87
97
|
};
|
|
88
98
|
zones.push(zone);
|
|
89
99
|
|
|
90
|
-
for (const subnet of
|
|
100
|
+
for (const subnet of subnets) {
|
|
91
101
|
if (!subnet.isLinkLocal && subnet.prefix) {
|
|
92
102
|
const reverseArpa = reverseArpaAddress(subnet.prefix);
|
|
93
103
|
const reverseZone = {
|
package/package.json
CHANGED
package/src/model.mjs
CHANGED
|
@@ -32,6 +32,17 @@ export class Location extends Owner {
|
|
|
32
32
|
get network() {
|
|
33
33
|
return [...this.typeList("network")][0] || super.network;
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
*subnets() {
|
|
38
|
+
// yield* super.subnets();
|
|
39
|
+
|
|
40
|
+
for(const network of this.networks()) {
|
|
41
|
+
// console.log(network.toString());
|
|
42
|
+
yield* network.typeList("subnet");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
*/
|
|
35
46
|
}
|
|
36
47
|
|
|
37
48
|
export class Root extends Location {
|
package/src/owner.mjs
CHANGED
|
@@ -284,8 +284,8 @@ export class Network extends Owner {
|
|
|
284
284
|
kind;
|
|
285
285
|
scope;
|
|
286
286
|
metric;
|
|
287
|
-
bridge;
|
|
288
287
|
gateway;
|
|
288
|
+
#bridge;
|
|
289
289
|
|
|
290
290
|
static get typeName() {
|
|
291
291
|
return "network";
|
|
@@ -299,9 +299,8 @@ export class Network extends Owner {
|
|
|
299
299
|
delete data.subnets;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
let bridge;
|
|
303
302
|
if (data.bridge) {
|
|
304
|
-
bridge = data.bridge;
|
|
303
|
+
this.bridge = owner.addBridge(this, data.bridge);
|
|
305
304
|
delete data.bridge;
|
|
306
305
|
}
|
|
307
306
|
|
|
@@ -310,8 +309,6 @@ export class Network extends Owner {
|
|
|
310
309
|
if (typeof this.gateway === "string") {
|
|
311
310
|
this.finalize(() => (this.gateway = this.owner.hostNamed(this.gateway)));
|
|
312
311
|
}
|
|
313
|
-
|
|
314
|
-
this.bridge = owner.addBridge(this, bridge);
|
|
315
312
|
}
|
|
316
313
|
|
|
317
314
|
get network() {
|
|
@@ -332,6 +329,40 @@ export class Network extends Owner {
|
|
|
332
329
|
}
|
|
333
330
|
}
|
|
334
331
|
|
|
332
|
+
get bridge() {
|
|
333
|
+
return this.#bridge;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
set bridge(bridge) {
|
|
337
|
+
for (const network of bridge) {
|
|
338
|
+
if (network instanceof Network && network !== this) {
|
|
339
|
+
for (const subnet of this.subnets()) {
|
|
340
|
+
for (const otherSubnet of network.subnets()) {
|
|
341
|
+
if (
|
|
342
|
+
subnet !== otherSubnet &&
|
|
343
|
+
subnet.address === otherSubnet.address
|
|
344
|
+
) {
|
|
345
|
+
/*console.log(
|
|
346
|
+
"SHARE SUBNETS",
|
|
347
|
+
subnet.owner.toString(),
|
|
348
|
+
otherSubnet.owner.toString()
|
|
349
|
+
);*/
|
|
350
|
+
|
|
351
|
+
otherSubnet.owner.addObject(subnet);
|
|
352
|
+
for (const n of otherSubnet.networks) {
|
|
353
|
+
subnet.networks.add(n);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
//console.log(subnet.toString(),[...subnet.networks].map(n=>n.toString()));
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
this.#bridge = bridge;
|
|
364
|
+
}
|
|
365
|
+
|
|
335
366
|
get propertyNames() {
|
|
336
367
|
return [
|
|
337
368
|
...super.propertyNames,
|
package/types/owner.d.mts
CHANGED
|
@@ -36,10 +36,12 @@ export class Network extends Owner {
|
|
|
36
36
|
kind: any;
|
|
37
37
|
scope: any;
|
|
38
38
|
metric: any;
|
|
39
|
-
bridge: any;
|
|
40
39
|
gateway: any;
|
|
40
|
+
set bridge(bridge: any);
|
|
41
|
+
get bridge(): any;
|
|
41
42
|
get network(): this;
|
|
42
43
|
addSubnets(value: any): void;
|
|
44
|
+
#private;
|
|
43
45
|
}
|
|
44
46
|
export class Subnet extends Base {
|
|
45
47
|
networks: Set<any>;
|