pmcf 2.6.6 → 2.6.8
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 +31 -6
- package/src/service.mjs +13 -14
- package/types/host.d.mts +3 -1
- package/types/service.d.mts +2 -2
package/package.json
CHANGED
package/src/host.mjs
CHANGED
|
@@ -107,6 +107,9 @@ export class Host extends Base {
|
|
|
107
107
|
if (data.extends) {
|
|
108
108
|
this.finalize(() => {
|
|
109
109
|
for (const host of this.extends) {
|
|
110
|
+
if(host === this) {
|
|
111
|
+
this.error("Cant extend myself");
|
|
112
|
+
}
|
|
110
113
|
host.execFinalize();
|
|
111
114
|
this._applyExtends(host);
|
|
112
115
|
}
|
|
@@ -123,6 +126,7 @@ export class Host extends Base {
|
|
|
123
126
|
if (ni.isTemplate) {
|
|
124
127
|
} else {
|
|
125
128
|
let present = this._networkInterfaces.get(name);
|
|
129
|
+
|
|
126
130
|
if (!present) {
|
|
127
131
|
present = ni.forOwner(this);
|
|
128
132
|
this._networkInterfaces.set(name, present);
|
|
@@ -517,9 +521,9 @@ export class NetworkInterface extends Base {
|
|
|
517
521
|
_network;
|
|
518
522
|
_kind;
|
|
519
523
|
_hostName;
|
|
524
|
+
_hwaddr;
|
|
520
525
|
extends = [];
|
|
521
526
|
arpbridge;
|
|
522
|
-
hwaddr;
|
|
523
527
|
|
|
524
528
|
constructor(owner, data) {
|
|
525
529
|
super(owner, data);
|
|
@@ -634,7 +638,11 @@ export class NetworkInterface extends Base {
|
|
|
634
638
|
}
|
|
635
639
|
|
|
636
640
|
get network() {
|
|
637
|
-
return
|
|
641
|
+
return (
|
|
642
|
+
this._network ??
|
|
643
|
+
this.extends.find(i => i.network)?.network ??
|
|
644
|
+
this.host.network
|
|
645
|
+
);
|
|
638
646
|
}
|
|
639
647
|
|
|
640
648
|
set network(network) {
|
|
@@ -646,7 +654,20 @@ export class NetworkInterface extends Base {
|
|
|
646
654
|
}
|
|
647
655
|
|
|
648
656
|
get scope() {
|
|
649
|
-
return
|
|
657
|
+
return (
|
|
658
|
+
this._scope ??
|
|
659
|
+
this.extends.find(i => i.scope)?.scope ??
|
|
660
|
+
this.network?.scope ??
|
|
661
|
+
"global"
|
|
662
|
+
);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
set hwaddr(value) {
|
|
666
|
+
this._hwaddr = value;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
get hwaddr() {
|
|
670
|
+
return this._hwaddr ?? this.extends.find(i => i._hwaddr)?._hwaddr;
|
|
650
671
|
}
|
|
651
672
|
|
|
652
673
|
set metric(value) {
|
|
@@ -662,7 +683,9 @@ export class NetworkInterface extends Base {
|
|
|
662
683
|
}
|
|
663
684
|
|
|
664
685
|
get ssid() {
|
|
665
|
-
return
|
|
686
|
+
return (
|
|
687
|
+
this._ssid ?? this.extends.find(i => i.ssid)?.ssid ?? this.network?.ssid
|
|
688
|
+
);
|
|
666
689
|
}
|
|
667
690
|
|
|
668
691
|
set psk(value) {
|
|
@@ -670,7 +693,7 @@ export class NetworkInterface extends Base {
|
|
|
670
693
|
}
|
|
671
694
|
|
|
672
695
|
get psk() {
|
|
673
|
-
return this._psk ?? this.network?.psk;
|
|
696
|
+
return this._psk ?? this.extends.find(i => i.psk)?.psk ?? this.network?.psk;
|
|
674
697
|
}
|
|
675
698
|
|
|
676
699
|
set kind(value) {
|
|
@@ -678,6 +701,8 @@ export class NetworkInterface extends Base {
|
|
|
678
701
|
}
|
|
679
702
|
|
|
680
703
|
get kind() {
|
|
681
|
-
return
|
|
704
|
+
return (
|
|
705
|
+
this._kind ?? this.extends.find(i => i.kind)?.kind ?? this.network?.kind
|
|
706
|
+
);
|
|
682
707
|
}
|
|
683
708
|
}
|
package/src/service.mjs
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
dnsFormatParameters,
|
|
9
9
|
dnsMergeParameters
|
|
10
10
|
} from "./dns-utils.mjs";
|
|
11
|
-
import { DHCPService, DNSService, NTPService } from "./module.mjs";
|
|
12
11
|
|
|
13
12
|
const ServiceTypes = {
|
|
14
13
|
ntp: { endpoints: [{ protocol: "udp", port: 123, tls: false }] },
|
|
@@ -47,7 +46,7 @@ const ServiceTypes = {
|
|
|
47
46
|
smb: { endpoints: [{ protocol: "tcp", port: 445, tls: false }] },
|
|
48
47
|
timemachine: {
|
|
49
48
|
type: "adisk",
|
|
50
|
-
endpoints: [{ protocol: "tcp", tls: false }],
|
|
49
|
+
endpoints: [{ protocol: "tcp", port: 445, tls: false }],
|
|
51
50
|
dnsRecord: {
|
|
52
51
|
type: "TXT",
|
|
53
52
|
parameters: {
|
|
@@ -149,13 +148,13 @@ export class Service extends Base {
|
|
|
149
148
|
}
|
|
150
149
|
|
|
151
150
|
get endpoints() {
|
|
152
|
-
if (this.
|
|
151
|
+
if (!ServiceTypes[this.type]) {
|
|
153
152
|
return [
|
|
154
|
-
{
|
|
153
|
+
{ address: this.rawAddress, port: this._port, tls: false }
|
|
155
154
|
];
|
|
156
155
|
}
|
|
157
156
|
|
|
158
|
-
return ServiceTypes[this.type]
|
|
157
|
+
return ServiceTypes[this.type].endpoints;
|
|
159
158
|
}
|
|
160
159
|
|
|
161
160
|
set port(value) {
|
|
@@ -163,7 +162,15 @@ export class Service extends Base {
|
|
|
163
162
|
}
|
|
164
163
|
|
|
165
164
|
get port() {
|
|
166
|
-
return this.
|
|
165
|
+
return this.endpoints[0].port;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
get protocol() {
|
|
169
|
+
return this.endpoints[0].protocol;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
get tls() {
|
|
173
|
+
return this.endpoints[0].tls;
|
|
167
174
|
}
|
|
168
175
|
|
|
169
176
|
set weight(value) {
|
|
@@ -182,14 +189,6 @@ export class Service extends Base {
|
|
|
182
189
|
return this._type ?? this.name;
|
|
183
190
|
}
|
|
184
191
|
|
|
185
|
-
get protocol() {
|
|
186
|
-
return ServiceTypes[this.type]?.endpoints[0].protocol;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
get tls() {
|
|
190
|
-
return ServiceTypes[this.type]?.tls ?? false;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
192
|
get systemdServices() {
|
|
194
193
|
return this._systemd;
|
|
195
194
|
}
|
package/types/host.d.mts
CHANGED
|
@@ -412,9 +412,9 @@ export class NetworkInterface extends Base {
|
|
|
412
412
|
_network: any;
|
|
413
413
|
_kind: any;
|
|
414
414
|
_hostName: any;
|
|
415
|
+
_hwaddr: any;
|
|
415
416
|
extends: any[];
|
|
416
417
|
arpbridge: any;
|
|
417
|
-
hwaddr: any;
|
|
418
418
|
matches(other: any): boolean;
|
|
419
419
|
addSubnet(address: any): any;
|
|
420
420
|
set ipAddresses(value: Map<any, any>);
|
|
@@ -436,6 +436,8 @@ export class NetworkInterface extends Base {
|
|
|
436
436
|
get network(): any;
|
|
437
437
|
set scope(value: any);
|
|
438
438
|
get scope(): any;
|
|
439
|
+
set hwaddr(value: any);
|
|
440
|
+
get hwaddr(): any;
|
|
439
441
|
set metric(value: any);
|
|
440
442
|
get metric(): any;
|
|
441
443
|
set ssid(value: any);
|
package/types/service.d.mts
CHANGED
|
@@ -261,12 +261,12 @@ export class Service extends Base {
|
|
|
261
261
|
get endpoints(): any;
|
|
262
262
|
set port(value: any);
|
|
263
263
|
get port(): any;
|
|
264
|
+
get protocol(): any;
|
|
265
|
+
get tls(): any;
|
|
264
266
|
set weight(value: any);
|
|
265
267
|
get weight(): any;
|
|
266
268
|
set type(value: any);
|
|
267
269
|
get type(): any;
|
|
268
|
-
get protocol(): any;
|
|
269
|
-
get tls(): any;
|
|
270
270
|
get systemdServices(): any;
|
|
271
271
|
dnsRecordsForDomainName(domainName: any, hasSVRRecords: any): {
|
|
272
272
|
key: any;
|