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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "4.25.15",
3
+ "version": "4.25.17",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -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 const EthernetNetworkInterfaceTypeDefinition = {
8
- name: "ethernet",
9
- extends: NetworkInterfaceTypeDefinition,
10
- specializationOf: NetworkInterfaceTypeDefinition,
11
- owners: NetworkInterfaceTypeDefinition.owners,
12
- key: "name",
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
- export class EthernetNetworkInterface extends NetworkInterface {
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 EthernetNetworkInterfaceTypeDefinition.name;
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 { NetworkInterfaceTypeDefinition } from "./network-interface.mjs";
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 = NetworkInterfaceTypeDefinition;
16
- static specializationOf = NetworkInterfaceTypeDefinition;
17
- static owners = NetworkInterfaceTypeDefinition.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 const NetworkInterfaceTypeDefinition = {
20
- name: "network_interface",
21
- owners: ["host"],
22
- extends: Base.typeDefinition,
23
- specializations: {},
24
- factoryFor(owner, value) {
25
- let t = NetworkInterfaceTypeDefinition.specializations[value.kind];
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(NetworkInterfaceTypeDefinition.specializations)) {
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 NetworkInterface;
43
- },
44
- key: "name",
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.typeDefinition
59
+ type: Network
60
60
  },
61
61
  destination: string_attribute_writable
62
- }
63
- };
62
+ };
64
63
 
65
- export class NetworkInterface extends SkeletonNetworkInterface {
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
- ? { Gateway: this.gatewayAddress }
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 = NetworkInterfaceTypeDefinition;
8
- static specializationOf = NetworkInterfaceTypeDefinition;
9
- static owners = NetworkInterfaceTypeDefinition.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 { NetworkInterfaceTypeDefinition } from "./network-interface.mjs";
3
+ import { NetworkInterface } from "./network-interface.mjs";
4
4
 
5
5
  export class WireguardNetworkInterface extends SkeletonNetworkInterface {
6
6
  static name = "wireguard";
7
- static extends = NetworkInterfaceTypeDefinition;
8
- static specializationOf = NetworkInterfaceTypeDefinition;
9
- static owners = NetworkInterfaceTypeDefinition.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 { NetworkInterfaceTypeDefinition } from "./network-interface.mjs";
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 = EthernetNetworkInterfaceTypeDefinition;
18
- static specializationOf = NetworkInterfaceTypeDefinition;
19
- static owners = EthernetNetworkInterfaceTypeDefinition.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,