pmcf 2.29.2 → 2.30.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/README.md +0 -1
- package/package.json +1 -1
- package/src/base.mjs +1 -1
- package/src/host-utils.mjs +1 -113
- package/src/host.mjs +13 -9
- package/src/module.mjs +5 -1
- package/src/network-address.mjs +1 -5
- package/src/network-interfaces/ethernet.mjs +37 -0
- package/src/network-interfaces/loopback.mjs +44 -0
- package/src/network-interfaces/network-interface.mjs +245 -0
- package/src/network-interfaces/skeleton.mjs +114 -0
- package/src/network-interfaces/wireguard.mjs +30 -0
- package/src/network-interfaces/wlan.mjs +77 -0
- package/src/service.mjs +1 -1
- package/src/subnet.mjs +1 -0
- package/types/cluster.d.mts +1 -0
- package/types/extra-source-service.d.mts +1 -1
- package/types/host-utils.d.mts +0 -1
- package/types/host.d.mts +1 -0
- package/types/module.d.mts +5 -1
- package/types/network-address.d.mts +1 -5
- package/types/network-interfaces/ethernet.d.mts +338 -0
- package/types/network-interfaces/loopback.d.mts +319 -0
- package/types/network-interfaces/network-interface.d.mts +339 -0
- package/types/network-interfaces/skeleton.d.mts +25 -0
- package/types/network-interfaces/wireguard.d.mts +316 -0
- package/types/network-interfaces/wlan.d.mts +486 -0
- package/types/service.d.mts +2 -2
- package/types/services/dhcp.d.mts +2 -2
- package/types/services/dns.d.mts +2 -2
- package/types/services/ntp.d.mts +2 -2
- package/types/subnet.d.mts +1 -0
- package/src/network-interface.mjs +0 -366
- package/types/network-interface.d.mts +0 -1357
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { writeFile, mkdir } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { addType } from "../types.mjs";
|
|
4
|
+
import { addHook } from "../hooks.mjs";
|
|
5
|
+
import { NetworkInterfaceTypeDefinition } from "./network-interface.mjs";
|
|
6
|
+
import {
|
|
7
|
+
EthernetNetworkInterface,
|
|
8
|
+
EthernetNetworkInterfaceTypeDefinition
|
|
9
|
+
} from "./ethernet.mjs";
|
|
10
|
+
|
|
11
|
+
const WLANNetworkInterfaceTypeDefinition = {
|
|
12
|
+
name: "wlan",
|
|
13
|
+
specializationOf: NetworkInterfaceTypeDefinition,
|
|
14
|
+
owners: EthernetNetworkInterfaceTypeDefinition.owners,
|
|
15
|
+
extends: EthernetNetworkInterfaceTypeDefinition,
|
|
16
|
+
priority: 0.1,
|
|
17
|
+
properties: {}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export class WLANNetworkInterface extends EthernetNetworkInterface {
|
|
21
|
+
_ssid;
|
|
22
|
+
_psk;
|
|
23
|
+
|
|
24
|
+
static {
|
|
25
|
+
addType(this);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static get typeDefinition() {
|
|
29
|
+
return WLANNetworkInterfaceTypeDefinition;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get kind() {
|
|
33
|
+
return WLANNetworkInterfaceTypeDefinition.name;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
set ssid(value) {
|
|
37
|
+
this._ssid = value;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get ssid() {
|
|
41
|
+
return this.extendedProperty("_ssid") ?? this.network?.ssid;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
set psk(value) {
|
|
45
|
+
this._psk = value;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
get psk() {
|
|
49
|
+
return this.extendedProperty("_psk") ?? this.network?.psk;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async systemdDefinitions(packageData) {
|
|
53
|
+
await super.systemdDefinitions(packageData);
|
|
54
|
+
|
|
55
|
+
const d = join(packageData.dir, "etc/wpa_supplicant");
|
|
56
|
+
await mkdir(d, { recursive: true });
|
|
57
|
+
writeFile(
|
|
58
|
+
join(d, `wpa_supplicant-${this.name}.conf`),
|
|
59
|
+
`country=${this.location.country}
|
|
60
|
+
ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
|
|
61
|
+
update_config=1
|
|
62
|
+
p2p_disabled=1
|
|
63
|
+
network={
|
|
64
|
+
ssid="${this.ssid}"
|
|
65
|
+
psk=${this.psk}
|
|
66
|
+
scan_ssid=1
|
|
67
|
+
}`,
|
|
68
|
+
"utf8"
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
addHook(
|
|
72
|
+
packageData.properties.hooks,
|
|
73
|
+
"post_install",
|
|
74
|
+
`systemctl enable wpa_supplicant@${this.name}.service`
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|
package/src/service.mjs
CHANGED
|
@@ -93,7 +93,7 @@ export const ServiceTypeDefinition = {
|
|
|
93
93
|
priority: 0.4,
|
|
94
94
|
extends: Base.typeDefinition,
|
|
95
95
|
specializations: {},
|
|
96
|
-
factoryFor(value) {
|
|
96
|
+
factoryFor(owner,value) {
|
|
97
97
|
const type = value.type ?? value.name;
|
|
98
98
|
const t = ServiceTypeDefinition.specializations[type];
|
|
99
99
|
|
package/src/subnet.mjs
CHANGED
|
@@ -91,6 +91,7 @@ export class Subnet extends Base {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
const _owner = { addObject() {} };
|
|
94
|
+
export const SUBNET_GLOBAL_IPV4 = new Subnet(_owner, "0.0.0.0/0");
|
|
94
95
|
export const SUBNET_LOCALHOST_IPV4 = new Subnet(_owner, "127.0.0.1/8");
|
|
95
96
|
export const SUBNET_LOCALHOST_IPV6 = new Subnet(_owner, "::1/128");
|
|
96
97
|
|
package/types/cluster.d.mts
CHANGED
package/types/host-utils.d.mts
CHANGED
package/types/host.d.mts
CHANGED
package/types/module.d.mts
CHANGED
|
@@ -8,7 +8,11 @@ export * from "./subnet.mjs";
|
|
|
8
8
|
export * from "./network.mjs";
|
|
9
9
|
export * from "./network-address.mjs";
|
|
10
10
|
export * from "./network-support.mjs";
|
|
11
|
-
export * from "./network-interface.mjs";
|
|
11
|
+
export * from "./network-interfaces/network-interface.mjs";
|
|
12
|
+
export * from "./network-interfaces/loopback.mjs";
|
|
13
|
+
export * from "./network-interfaces/ethernet.mjs";
|
|
14
|
+
export * from "./network-interfaces/wlan.mjs";
|
|
15
|
+
export * from "./network-interfaces/wireguard.mjs";
|
|
12
16
|
export * from "./host.mjs";
|
|
13
17
|
export * from "./service.mjs";
|
|
14
18
|
export * from "./endpoint.mjs";
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @property {string|Uint8Array|Uint16Array} address
|
|
4
|
-
* @property {string} family
|
|
5
|
-
* @property {Subnet} subnet
|
|
6
|
-
* @property {Set<string>} domainNames
|
|
2
|
+
*
|
|
7
3
|
*/
|
|
8
4
|
export class NetworkAddress {
|
|
9
5
|
constructor(networkInterface: any, address: any, subnet: any);
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
export namespace EthernetNetworkInterfaceTypeDefinition {
|
|
2
|
+
export let name: string;
|
|
3
|
+
export { NetworkInterfaceTypeDefinition as specializationOf };
|
|
4
|
+
export let owners: string[];
|
|
5
|
+
export { NetworkInterfaceTypeDefinition as extends };
|
|
6
|
+
export let priority: number;
|
|
7
|
+
export namespace properties {
|
|
8
|
+
namespace arpbridge {
|
|
9
|
+
let type: string;
|
|
10
|
+
let collection: boolean;
|
|
11
|
+
let writeable: boolean;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export class EthernetNetworkInterface extends NetworkInterface {
|
|
16
|
+
static get typeDefinition(): {
|
|
17
|
+
name: string;
|
|
18
|
+
specializationOf: {
|
|
19
|
+
name: string;
|
|
20
|
+
priority: number;
|
|
21
|
+
owners: string[];
|
|
22
|
+
extends: {
|
|
23
|
+
name: string;
|
|
24
|
+
owners: any[];
|
|
25
|
+
properties: {
|
|
26
|
+
owner: {
|
|
27
|
+
type: string;
|
|
28
|
+
collection: boolean;
|
|
29
|
+
writeable: boolean;
|
|
30
|
+
};
|
|
31
|
+
type: {
|
|
32
|
+
type: string;
|
|
33
|
+
collection: boolean;
|
|
34
|
+
writeable: boolean;
|
|
35
|
+
};
|
|
36
|
+
name: {
|
|
37
|
+
type: string;
|
|
38
|
+
collection: boolean;
|
|
39
|
+
identifier: boolean;
|
|
40
|
+
writeable: boolean;
|
|
41
|
+
};
|
|
42
|
+
description: {
|
|
43
|
+
type: string;
|
|
44
|
+
collection: boolean;
|
|
45
|
+
writeable: boolean;
|
|
46
|
+
};
|
|
47
|
+
priority: {
|
|
48
|
+
type: string;
|
|
49
|
+
collection: boolean;
|
|
50
|
+
writeable: boolean;
|
|
51
|
+
};
|
|
52
|
+
directory: {
|
|
53
|
+
type: string;
|
|
54
|
+
collection: boolean;
|
|
55
|
+
writeable: boolean;
|
|
56
|
+
};
|
|
57
|
+
packaging: {
|
|
58
|
+
type: string;
|
|
59
|
+
collection: boolean;
|
|
60
|
+
writeable: boolean;
|
|
61
|
+
};
|
|
62
|
+
tags: {
|
|
63
|
+
type: string;
|
|
64
|
+
collection: boolean;
|
|
65
|
+
writeable: boolean;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
specializations: {};
|
|
70
|
+
factoryFor(owner: any, value: any): any;
|
|
71
|
+
properties: {
|
|
72
|
+
hostName: {
|
|
73
|
+
type: string;
|
|
74
|
+
collection: boolean;
|
|
75
|
+
writeable: boolean;
|
|
76
|
+
};
|
|
77
|
+
ipAddresses: {
|
|
78
|
+
type: string;
|
|
79
|
+
collection: boolean;
|
|
80
|
+
writeable: boolean;
|
|
81
|
+
};
|
|
82
|
+
hwaddr: {
|
|
83
|
+
type: string;
|
|
84
|
+
collection: boolean;
|
|
85
|
+
writeable: boolean;
|
|
86
|
+
};
|
|
87
|
+
network: {
|
|
88
|
+
type: string;
|
|
89
|
+
collection: boolean;
|
|
90
|
+
writeable: boolean;
|
|
91
|
+
};
|
|
92
|
+
destination: {
|
|
93
|
+
type: string;
|
|
94
|
+
collection: boolean;
|
|
95
|
+
writeable: boolean;
|
|
96
|
+
};
|
|
97
|
+
cidrAddresses: {
|
|
98
|
+
type: string;
|
|
99
|
+
collection: boolean;
|
|
100
|
+
writeable: boolean;
|
|
101
|
+
};
|
|
102
|
+
cidrAddress: {
|
|
103
|
+
type: string;
|
|
104
|
+
collection: boolean;
|
|
105
|
+
writeable: boolean;
|
|
106
|
+
};
|
|
107
|
+
addresses: {
|
|
108
|
+
type: string;
|
|
109
|
+
collection: boolean;
|
|
110
|
+
writeable: boolean;
|
|
111
|
+
};
|
|
112
|
+
address: {
|
|
113
|
+
type: string;
|
|
114
|
+
collection: boolean;
|
|
115
|
+
writeable: boolean;
|
|
116
|
+
};
|
|
117
|
+
scope: {
|
|
118
|
+
type: string;
|
|
119
|
+
collection: boolean;
|
|
120
|
+
writeable: boolean;
|
|
121
|
+
values: string[];
|
|
122
|
+
default: string;
|
|
123
|
+
};
|
|
124
|
+
class: {
|
|
125
|
+
type: string;
|
|
126
|
+
collection: boolean;
|
|
127
|
+
writeable: boolean;
|
|
128
|
+
values: string[];
|
|
129
|
+
};
|
|
130
|
+
kind: {
|
|
131
|
+
type: string;
|
|
132
|
+
collection: boolean;
|
|
133
|
+
writeable: boolean;
|
|
134
|
+
values: string[];
|
|
135
|
+
};
|
|
136
|
+
ssid: {
|
|
137
|
+
type: string;
|
|
138
|
+
collection: boolean;
|
|
139
|
+
writeable: boolean;
|
|
140
|
+
};
|
|
141
|
+
psk: {
|
|
142
|
+
type: string;
|
|
143
|
+
collection: boolean;
|
|
144
|
+
writeable: boolean;
|
|
145
|
+
};
|
|
146
|
+
metric: {
|
|
147
|
+
type: string;
|
|
148
|
+
collection: boolean;
|
|
149
|
+
writeable: boolean;
|
|
150
|
+
default: number;
|
|
151
|
+
};
|
|
152
|
+
MTU: {
|
|
153
|
+
type: string;
|
|
154
|
+
collection: boolean;
|
|
155
|
+
writeable: boolean;
|
|
156
|
+
default: number;
|
|
157
|
+
};
|
|
158
|
+
gateway: {
|
|
159
|
+
type: string;
|
|
160
|
+
collection: boolean;
|
|
161
|
+
writeable: boolean;
|
|
162
|
+
};
|
|
163
|
+
multicastDNS: {
|
|
164
|
+
type: string;
|
|
165
|
+
collection: boolean;
|
|
166
|
+
writeable: boolean;
|
|
167
|
+
default: boolean;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
owners: string[];
|
|
172
|
+
extends: {
|
|
173
|
+
name: string;
|
|
174
|
+
priority: number;
|
|
175
|
+
owners: string[];
|
|
176
|
+
extends: {
|
|
177
|
+
name: string;
|
|
178
|
+
owners: any[];
|
|
179
|
+
properties: {
|
|
180
|
+
owner: {
|
|
181
|
+
type: string;
|
|
182
|
+
collection: boolean;
|
|
183
|
+
writeable: boolean;
|
|
184
|
+
};
|
|
185
|
+
type: {
|
|
186
|
+
type: string;
|
|
187
|
+
collection: boolean;
|
|
188
|
+
writeable: boolean;
|
|
189
|
+
};
|
|
190
|
+
name: {
|
|
191
|
+
type: string;
|
|
192
|
+
collection: boolean;
|
|
193
|
+
identifier: boolean;
|
|
194
|
+
writeable: boolean;
|
|
195
|
+
};
|
|
196
|
+
description: {
|
|
197
|
+
type: string;
|
|
198
|
+
collection: boolean;
|
|
199
|
+
writeable: boolean;
|
|
200
|
+
};
|
|
201
|
+
priority: {
|
|
202
|
+
type: string;
|
|
203
|
+
collection: boolean;
|
|
204
|
+
writeable: boolean;
|
|
205
|
+
};
|
|
206
|
+
directory: {
|
|
207
|
+
type: string;
|
|
208
|
+
collection: boolean;
|
|
209
|
+
writeable: boolean;
|
|
210
|
+
};
|
|
211
|
+
packaging: {
|
|
212
|
+
type: string;
|
|
213
|
+
collection: boolean;
|
|
214
|
+
writeable: boolean;
|
|
215
|
+
};
|
|
216
|
+
tags: {
|
|
217
|
+
type: string;
|
|
218
|
+
collection: boolean;
|
|
219
|
+
writeable: boolean;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
specializations: {};
|
|
224
|
+
factoryFor(owner: any, value: any): any;
|
|
225
|
+
properties: {
|
|
226
|
+
hostName: {
|
|
227
|
+
type: string;
|
|
228
|
+
collection: boolean;
|
|
229
|
+
writeable: boolean;
|
|
230
|
+
};
|
|
231
|
+
ipAddresses: {
|
|
232
|
+
type: string;
|
|
233
|
+
collection: boolean;
|
|
234
|
+
writeable: boolean;
|
|
235
|
+
};
|
|
236
|
+
hwaddr: {
|
|
237
|
+
type: string;
|
|
238
|
+
collection: boolean;
|
|
239
|
+
writeable: boolean;
|
|
240
|
+
};
|
|
241
|
+
network: {
|
|
242
|
+
type: string;
|
|
243
|
+
collection: boolean;
|
|
244
|
+
writeable: boolean;
|
|
245
|
+
};
|
|
246
|
+
destination: {
|
|
247
|
+
type: string;
|
|
248
|
+
collection: boolean;
|
|
249
|
+
writeable: boolean;
|
|
250
|
+
};
|
|
251
|
+
cidrAddresses: {
|
|
252
|
+
type: string;
|
|
253
|
+
collection: boolean;
|
|
254
|
+
writeable: boolean;
|
|
255
|
+
};
|
|
256
|
+
cidrAddress: {
|
|
257
|
+
type: string;
|
|
258
|
+
collection: boolean;
|
|
259
|
+
writeable: boolean;
|
|
260
|
+
};
|
|
261
|
+
addresses: {
|
|
262
|
+
type: string;
|
|
263
|
+
collection: boolean;
|
|
264
|
+
writeable: boolean;
|
|
265
|
+
};
|
|
266
|
+
address: {
|
|
267
|
+
type: string;
|
|
268
|
+
collection: boolean;
|
|
269
|
+
writeable: boolean;
|
|
270
|
+
};
|
|
271
|
+
scope: {
|
|
272
|
+
type: string;
|
|
273
|
+
collection: boolean;
|
|
274
|
+
writeable: boolean;
|
|
275
|
+
values: string[];
|
|
276
|
+
default: string;
|
|
277
|
+
};
|
|
278
|
+
class: {
|
|
279
|
+
type: string;
|
|
280
|
+
collection: boolean;
|
|
281
|
+
writeable: boolean;
|
|
282
|
+
values: string[];
|
|
283
|
+
};
|
|
284
|
+
kind: {
|
|
285
|
+
type: string;
|
|
286
|
+
collection: boolean;
|
|
287
|
+
writeable: boolean;
|
|
288
|
+
values: string[];
|
|
289
|
+
};
|
|
290
|
+
ssid: {
|
|
291
|
+
type: string;
|
|
292
|
+
collection: boolean;
|
|
293
|
+
writeable: boolean;
|
|
294
|
+
};
|
|
295
|
+
psk: {
|
|
296
|
+
type: string;
|
|
297
|
+
collection: boolean;
|
|
298
|
+
writeable: boolean;
|
|
299
|
+
};
|
|
300
|
+
metric: {
|
|
301
|
+
type: string;
|
|
302
|
+
collection: boolean;
|
|
303
|
+
writeable: boolean;
|
|
304
|
+
default: number;
|
|
305
|
+
};
|
|
306
|
+
MTU: {
|
|
307
|
+
type: string;
|
|
308
|
+
collection: boolean;
|
|
309
|
+
writeable: boolean;
|
|
310
|
+
default: number;
|
|
311
|
+
};
|
|
312
|
+
gateway: {
|
|
313
|
+
type: string;
|
|
314
|
+
collection: boolean;
|
|
315
|
+
writeable: boolean;
|
|
316
|
+
};
|
|
317
|
+
multicastDNS: {
|
|
318
|
+
type: string;
|
|
319
|
+
collection: boolean;
|
|
320
|
+
writeable: boolean;
|
|
321
|
+
default: boolean;
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
priority: number;
|
|
326
|
+
properties: {
|
|
327
|
+
arpbridge: {
|
|
328
|
+
type: string;
|
|
329
|
+
collection: boolean;
|
|
330
|
+
writeable: boolean;
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
arpbridge: any;
|
|
335
|
+
get kind(): string;
|
|
336
|
+
}
|
|
337
|
+
import { NetworkInterfaceTypeDefinition } from "./network-interface.mjs";
|
|
338
|
+
import { NetworkInterface } from "./network-interface.mjs";
|