pmcf 4.25.15 → 4.25.17
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/network-interfaces/ethernet.mjs +11 -16
- package/src/network-interfaces/loopback.mjs +4 -4
- package/src/network-interfaces/network-interface.mjs +17 -19
- package/src/network-interfaces/tun.mjs +3 -4
- package/src/network-interfaces/wireguard.mjs +4 -4
- package/src/network-interfaces/wlan.mjs +5 -8
package/package.json
CHANGED
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import { default_attribute_writable, addType } from "pacc";
|
|
2
|
-
import {
|
|
3
|
-
NetworkInterface,
|
|
4
|
-
NetworkInterfaceTypeDefinition
|
|
5
|
-
} from "./network-interface.mjs";
|
|
2
|
+
import { NetworkInterface } from "./network-interface.mjs";
|
|
6
3
|
|
|
7
|
-
export
|
|
8
|
-
name
|
|
9
|
-
extends
|
|
10
|
-
specializationOf
|
|
11
|
-
owners
|
|
12
|
-
key
|
|
13
|
-
attributes
|
|
4
|
+
export class EthernetNetworkInterface extends NetworkInterface {
|
|
5
|
+
static name = "ethernet";
|
|
6
|
+
static extends = NetworkInterface;
|
|
7
|
+
static specializationOf = NetworkInterface;
|
|
8
|
+
static owners = NetworkInterface.owners;
|
|
9
|
+
static key = "name";
|
|
10
|
+
static attributes = {
|
|
14
11
|
arpbridge: {
|
|
15
12
|
...default_attribute_writable,
|
|
16
13
|
type: "network_interface",
|
|
17
14
|
collection: true
|
|
18
15
|
}
|
|
19
|
-
}
|
|
20
|
-
};
|
|
16
|
+
};
|
|
21
17
|
|
|
22
|
-
|
|
23
|
-
static typeDefinition = EthernetNetworkInterfaceTypeDefinition;
|
|
18
|
+
static typeDefinition = this;
|
|
24
19
|
|
|
25
20
|
static {
|
|
26
21
|
addType(this);
|
|
@@ -33,6 +28,6 @@ export class EthernetNetworkInterface extends NetworkInterface {
|
|
|
33
28
|
arpbridge;
|
|
34
29
|
|
|
35
30
|
get kind() {
|
|
36
|
-
return
|
|
31
|
+
return this.constructor.name;
|
|
37
32
|
}
|
|
38
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { addType } from "pacc";
|
|
2
2
|
import { SUBNET_LOCALHOST_IPV4, SUBNET_LOCALHOST_IPV6 } from "pmcf";
|
|
3
3
|
import { SkeletonNetworkInterface } from "./skeleton.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { NetworkInterface } from "./network-interface.mjs";
|
|
5
5
|
|
|
6
6
|
const _localAddresses = new Map([
|
|
7
7
|
["127.0.0.1", SUBNET_LOCALHOST_IPV4],
|
|
@@ -12,9 +12,9 @@ const _localDomains = new Set(["localhost"]);
|
|
|
12
12
|
|
|
13
13
|
export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
|
|
14
14
|
static name = "loopback";
|
|
15
|
-
static extends =
|
|
16
|
-
static specializationOf =
|
|
17
|
-
static owners =
|
|
15
|
+
static extends = NetworkInterface;
|
|
16
|
+
static specializationOf = NetworkInterface;
|
|
17
|
+
static owners = NetworkInterface.owners;
|
|
18
18
|
static key = "name";
|
|
19
19
|
|
|
20
20
|
static typeDefinition = this;
|
|
@@ -16,17 +16,17 @@ import { SkeletonNetworkInterface } from "./skeleton.mjs";
|
|
|
16
16
|
import { Network } from "../network.mjs";
|
|
17
17
|
import { yesno } from "../utils.mjs";
|
|
18
18
|
|
|
19
|
-
export
|
|
20
|
-
name
|
|
21
|
-
owners
|
|
22
|
-
extends
|
|
23
|
-
specializations
|
|
24
|
-
factoryFor(owner, value) {
|
|
25
|
-
let t =
|
|
19
|
+
export class NetworkInterface extends SkeletonNetworkInterface {
|
|
20
|
+
static name = "network_interface";
|
|
21
|
+
static owners = ["host"];
|
|
22
|
+
static extends = Base;
|
|
23
|
+
static specializations = {};
|
|
24
|
+
static factoryFor(owner, value) {
|
|
25
|
+
let t = this.specializations[value.kind];
|
|
26
26
|
|
|
27
27
|
//console.log("factoryFor", owner, value);
|
|
28
28
|
if (!t) {
|
|
29
|
-
for (t of Object.values(
|
|
29
|
+
for (t of Object.values(this.specializations)) {
|
|
30
30
|
if (t.clazz.isCommonName && t.clazz.isCommonName(value.name)) {
|
|
31
31
|
break;
|
|
32
32
|
}
|
|
@@ -39,10 +39,10 @@ export const NetworkInterfaceTypeDefinition = {
|
|
|
39
39
|
return t.clazz;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
return
|
|
43
|
-
}
|
|
44
|
-
key
|
|
45
|
-
attributes
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
static key = "name";
|
|
45
|
+
static attributes = {
|
|
46
46
|
...networkAttributes,
|
|
47
47
|
...networkAddressAttributes,
|
|
48
48
|
|
|
@@ -56,14 +56,12 @@ export const NetworkInterfaceTypeDefinition = {
|
|
|
56
56
|
hwaddr: string_attribute_writable,
|
|
57
57
|
network: {
|
|
58
58
|
...default_attribute_writable,
|
|
59
|
-
type: Network
|
|
59
|
+
type: Network
|
|
60
60
|
},
|
|
61
61
|
destination: string_attribute_writable
|
|
62
|
-
}
|
|
63
|
-
};
|
|
62
|
+
};
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
static typeDefinition = NetworkInterfaceTypeDefinition;
|
|
64
|
+
static typeDefinition = this;
|
|
67
65
|
|
|
68
66
|
static {
|
|
69
67
|
addType(this);
|
|
@@ -226,8 +224,8 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
226
224
|
const routeSectionExtra = this.destination
|
|
227
225
|
? { Destination: this.destination }
|
|
228
226
|
: this.gateway
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
? { Gateway: this.gatewayAddress }
|
|
228
|
+
: {};
|
|
231
229
|
|
|
232
230
|
const networkSectionExtra = this.arpbridge
|
|
233
231
|
? {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { addType } from "pacc";
|
|
2
2
|
import { NetworkInterface } from "./network-interface.mjs";
|
|
3
|
-
import { NetworkInterfaceTypeDefinition } from "./network-interface.mjs";
|
|
4
3
|
|
|
5
4
|
export class TUNNetworkInterface extends NetworkInterface {
|
|
6
5
|
static name = "tun";
|
|
7
|
-
static extends =
|
|
8
|
-
static specializationOf =
|
|
9
|
-
static owners =
|
|
6
|
+
static extends = NetworkInterface;
|
|
7
|
+
static specializationOf = NetworkInterface;
|
|
8
|
+
static owners = NetworkInterface.owners;
|
|
10
9
|
static key = "name";
|
|
11
10
|
|
|
12
11
|
static typeDefinition = this;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { addType } from "pacc";
|
|
2
2
|
import { SkeletonNetworkInterface } from "./skeleton.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { NetworkInterface } from "./network-interface.mjs";
|
|
4
4
|
|
|
5
5
|
export class WireguardNetworkInterface extends SkeletonNetworkInterface {
|
|
6
6
|
static name = "wireguard";
|
|
7
|
-
static extends =
|
|
8
|
-
static specializationOf =
|
|
9
|
-
static owners =
|
|
7
|
+
static extends = NetworkInterface;
|
|
8
|
+
static specializationOf = NetworkInterface;
|
|
9
|
+
static owners = NetworkInterface.owners;
|
|
10
10
|
static key = "name";
|
|
11
11
|
|
|
12
12
|
static typeDefinition = this;
|
|
@@ -6,17 +6,14 @@ import {
|
|
|
6
6
|
addType
|
|
7
7
|
} from "pacc";
|
|
8
8
|
import { writeLines, sectionLines } from "../utils.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
EthernetNetworkInterface,
|
|
12
|
-
EthernetNetworkInterfaceTypeDefinition
|
|
13
|
-
} from "./ethernet.mjs";
|
|
9
|
+
import { NetworkInterface } from "./network-interface.mjs";
|
|
10
|
+
import { EthernetNetworkInterface } from "./ethernet.mjs";
|
|
14
11
|
|
|
15
12
|
export class WLANNetworkInterface extends EthernetNetworkInterface {
|
|
16
13
|
static name = "wlan";
|
|
17
|
-
static extends =
|
|
18
|
-
static specializationOf =
|
|
19
|
-
static owners =
|
|
14
|
+
static extends = EthernetNetworkInterface;
|
|
15
|
+
static specializationOf = NetworkInterface;
|
|
16
|
+
static owners = EthernetNetworkInterface.owners;
|
|
20
17
|
static key = "name";
|
|
21
18
|
static attributes = {
|
|
22
19
|
ssid: string_attribute_writable,
|