pmcf 4.25.10 → 4.25.12
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/cluster.mjs +10 -14
- package/src/host.mjs +9 -11
- package/src/network-interfaces/loopback.mjs +8 -10
- package/src/network-interfaces/tun.mjs +8 -10
- package/src/network-interfaces/wireguard.mjs +9 -11
- package/src/network-interfaces/wlan.mjs +10 -12
- package/src/network.mjs +9 -11
- package/src/owner.mjs +11 -13
package/package.json
CHANGED
package/src/cluster.mjs
CHANGED
|
@@ -12,13 +12,13 @@ import { Host } from "./host.mjs";
|
|
|
12
12
|
import { serviceEndpoints } from "pmcf";
|
|
13
13
|
import { writeLines } from "./utils.mjs";
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
name
|
|
17
|
-
priority
|
|
18
|
-
owners
|
|
19
|
-
extends
|
|
20
|
-
key
|
|
21
|
-
attributes
|
|
15
|
+
export class Cluster extends Host {
|
|
16
|
+
static name = "cluster";
|
|
17
|
+
static priority = 1.5;
|
|
18
|
+
static owners = [Owner.typeDefinition, "network", "location", "root"];
|
|
19
|
+
static extends = Host.typeDefinition;
|
|
20
|
+
static key = "name";
|
|
21
|
+
static attributes = {
|
|
22
22
|
routerId: { ...number_attribute_writable, default: 100 },
|
|
23
23
|
masters: {
|
|
24
24
|
...default_attribute_writable,
|
|
@@ -36,11 +36,9 @@ const ClusterTypeDefinition = {
|
|
|
36
36
|
collection: true
|
|
37
37
|
},
|
|
38
38
|
checkInterval: { ...duration_attribute_writable, default: 60 }
|
|
39
|
-
}
|
|
40
|
-
};
|
|
39
|
+
};
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
static typeDefinition = ClusterTypeDefinition;
|
|
41
|
+
static typeDefinition = this;
|
|
44
42
|
|
|
45
43
|
static {
|
|
46
44
|
addType(this);
|
|
@@ -177,9 +175,7 @@ export class Cluster extends Host {
|
|
|
177
175
|
|
|
178
176
|
for (const member of this.members) {
|
|
179
177
|
const memberService = Array.from(
|
|
180
|
-
member.expression(
|
|
181
|
-
`services[types[${endpoint.type}]][0]`
|
|
182
|
-
)
|
|
178
|
+
member.expression(`services[types[${endpoint.type}]][0]`)
|
|
183
179
|
);
|
|
184
180
|
|
|
185
181
|
console.log(member.fullName, endpoint.type, memberService);
|
package/src/host.mjs
CHANGED
|
@@ -24,13 +24,13 @@ import { loadHooks } from "./hooks.mjs";
|
|
|
24
24
|
import { generateKnownHosts } from "./host-utils.mjs";
|
|
25
25
|
import { NetworkInterfaceTypeDefinition } from "./network-interfaces/network-interface.mjs";
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
name
|
|
29
|
-
priority
|
|
30
|
-
owners
|
|
31
|
-
extends
|
|
32
|
-
key
|
|
33
|
-
attributes
|
|
27
|
+
export class Host extends ServiceOwner {
|
|
28
|
+
static name = "host";
|
|
29
|
+
static priority = 1.9;
|
|
30
|
+
static owners = ["owner", "network", "root"];
|
|
31
|
+
static extends = Base.typeDefinition;
|
|
32
|
+
static key = "name";
|
|
33
|
+
static attributes = {
|
|
34
34
|
...networkAddressAttributes,
|
|
35
35
|
networkInterfaces: {
|
|
36
36
|
...default_attribute_writable,
|
|
@@ -85,11 +85,9 @@ const HostTypeDefinition = {
|
|
|
85
85
|
extends: { ...default_attribute_writable, type: "host", collection: true },
|
|
86
86
|
model: string_attribute,
|
|
87
87
|
isModel: boolean_attribute_false
|
|
88
|
-
}
|
|
89
|
-
};
|
|
88
|
+
};
|
|
90
89
|
|
|
91
|
-
|
|
92
|
-
static typeDefinition = HostTypeDefinition;
|
|
90
|
+
static typeDefinition = this;
|
|
93
91
|
|
|
94
92
|
static {
|
|
95
93
|
addType(this);
|
|
@@ -3,14 +3,6 @@ import { SUBNET_LOCALHOST_IPV4, SUBNET_LOCALHOST_IPV6 } from "pmcf";
|
|
|
3
3
|
import { SkeletonNetworkInterface } from "./skeleton.mjs";
|
|
4
4
|
import { NetworkInterfaceTypeDefinition } from "./network-interface.mjs";
|
|
5
5
|
|
|
6
|
-
const LoopbackNetworkInterfaceTypeDefinition = {
|
|
7
|
-
name: "loopback",
|
|
8
|
-
extends: NetworkInterfaceTypeDefinition,
|
|
9
|
-
specializationOf: NetworkInterfaceTypeDefinition,
|
|
10
|
-
owners: NetworkInterfaceTypeDefinition.owners,
|
|
11
|
-
key: "name"
|
|
12
|
-
};
|
|
13
|
-
|
|
14
6
|
const _localAddresses = new Map([
|
|
15
7
|
["127.0.0.1", SUBNET_LOCALHOST_IPV4],
|
|
16
8
|
["::1", SUBNET_LOCALHOST_IPV6]
|
|
@@ -19,7 +11,13 @@ const _localAddresses = new Map([
|
|
|
19
11
|
const _localDomains = new Set(["localhost"]);
|
|
20
12
|
|
|
21
13
|
export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
|
|
22
|
-
static
|
|
14
|
+
static name = "loopback";
|
|
15
|
+
static extends = NetworkInterfaceTypeDefinition;
|
|
16
|
+
static specializationOf = NetworkInterfaceTypeDefinition;
|
|
17
|
+
static owners = NetworkInterfaceTypeDefinition.owners;
|
|
18
|
+
static key = "name";
|
|
19
|
+
|
|
20
|
+
static typeDefinition = this;
|
|
23
21
|
|
|
24
22
|
static {
|
|
25
23
|
addType(this);
|
|
@@ -30,7 +28,7 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
|
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
get kind() {
|
|
33
|
-
return
|
|
31
|
+
return "loopback";
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
set scope(v) {}
|
|
@@ -2,23 +2,21 @@ import { addType } from "pacc";
|
|
|
2
2
|
import { NetworkInterface } from "./network-interface.mjs";
|
|
3
3
|
import { NetworkInterfaceTypeDefinition } from "./network-interface.mjs";
|
|
4
4
|
|
|
5
|
-
const TUNdNetworkInterfaceTypeDefinition = {
|
|
6
|
-
name: "tun",
|
|
7
|
-
extends: NetworkInterfaceTypeDefinition,
|
|
8
|
-
specializationOf: NetworkInterfaceTypeDefinition,
|
|
9
|
-
owners: NetworkInterfaceTypeDefinition.owners,
|
|
10
|
-
key: "name"
|
|
11
|
-
};
|
|
12
|
-
|
|
13
5
|
export class TUNNetworkInterface extends NetworkInterface {
|
|
14
|
-
static
|
|
6
|
+
static name = "tun";
|
|
7
|
+
static extends = NetworkInterfaceTypeDefinition;
|
|
8
|
+
static specializationOf = NetworkInterfaceTypeDefinition;
|
|
9
|
+
static owners = NetworkInterfaceTypeDefinition.owners;
|
|
10
|
+
static key = "name";
|
|
11
|
+
|
|
12
|
+
static typeDefinition = this;
|
|
15
13
|
|
|
16
14
|
static {
|
|
17
15
|
addType(this);
|
|
18
16
|
}
|
|
19
17
|
|
|
20
18
|
get kind() {
|
|
21
|
-
return
|
|
19
|
+
return "tun";
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
async systemdDefinitions(dir, packageData) {}
|
|
@@ -2,23 +2,21 @@ import { addType } from "pacc";
|
|
|
2
2
|
import { SkeletonNetworkInterface } from "./skeleton.mjs";
|
|
3
3
|
import { NetworkInterfaceTypeDefinition } from "./network-interface.mjs";
|
|
4
4
|
|
|
5
|
-
const WireguardNetworkInterfaceTypeDefinition = {
|
|
6
|
-
name: "wireguard",
|
|
7
|
-
extends: NetworkInterfaceTypeDefinition,
|
|
8
|
-
specializationOf: NetworkInterfaceTypeDefinition,
|
|
9
|
-
owners: NetworkInterfaceTypeDefinition.owners,
|
|
10
|
-
key: "name"
|
|
11
|
-
};
|
|
12
|
-
|
|
13
5
|
export class WireguardNetworkInterface extends SkeletonNetworkInterface {
|
|
14
|
-
static
|
|
6
|
+
static name = "wireguard";
|
|
7
|
+
static extends = NetworkInterfaceTypeDefinition;
|
|
8
|
+
static specializationOf = NetworkInterfaceTypeDefinition;
|
|
9
|
+
static owners = NetworkInterfaceTypeDefinition.owners;
|
|
10
|
+
static key = "name";
|
|
11
|
+
|
|
12
|
+
static typeDefinition = this;
|
|
15
13
|
|
|
16
14
|
static {
|
|
17
15
|
addType(this);
|
|
18
16
|
}
|
|
19
|
-
|
|
17
|
+
|
|
20
18
|
get kind() {
|
|
21
|
-
return
|
|
19
|
+
return "wireguard";
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
get ipAddresses() {
|
|
@@ -12,21 +12,19 @@ import {
|
|
|
12
12
|
EthernetNetworkInterfaceTypeDefinition
|
|
13
13
|
} from "./ethernet.mjs";
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
name
|
|
17
|
-
extends
|
|
18
|
-
specializationOf
|
|
19
|
-
owners
|
|
20
|
-
key
|
|
21
|
-
attributes
|
|
15
|
+
export class WLANNetworkInterface extends EthernetNetworkInterface {
|
|
16
|
+
static name = "wlan";
|
|
17
|
+
static extends = EthernetNetworkInterfaceTypeDefinition;
|
|
18
|
+
static specializationOf = NetworkInterfaceTypeDefinition;
|
|
19
|
+
static owners = EthernetNetworkInterfaceTypeDefinition.owners;
|
|
20
|
+
static key = "name";
|
|
21
|
+
static attributes = {
|
|
22
22
|
ssid: string_attribute_writable,
|
|
23
23
|
psk: secret_attribute_writable,
|
|
24
24
|
secretName: string_attribute_writable
|
|
25
|
-
}
|
|
26
|
-
};
|
|
25
|
+
};
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
static typeDefinition = WLANNetworkInterfaceTypeDefinition;
|
|
27
|
+
static typeDefinition = this;
|
|
30
28
|
|
|
31
29
|
static {
|
|
32
30
|
addType(this);
|
|
@@ -41,7 +39,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
|
|
|
41
39
|
_secretName;
|
|
42
40
|
|
|
43
41
|
get kind() {
|
|
44
|
-
return
|
|
42
|
+
return "wlan";
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
set secretName(value) {
|
package/src/network.mjs
CHANGED
|
@@ -3,13 +3,13 @@ import { Owner } from "./owner.mjs";
|
|
|
3
3
|
import { Subnet } from "./subnet.mjs";
|
|
4
4
|
import { networkAttributes } from "./network-support.mjs";
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
name
|
|
8
|
-
priority
|
|
9
|
-
owners
|
|
10
|
-
extends
|
|
11
|
-
key
|
|
12
|
-
attributes
|
|
6
|
+
export class Network extends Owner {
|
|
7
|
+
static name = "network";
|
|
8
|
+
static priority = 2;
|
|
9
|
+
static owners = ["location", "owner", "root"];
|
|
10
|
+
static extends = Owner.typeDefinition;
|
|
11
|
+
static key = "name";
|
|
12
|
+
static attributes = {
|
|
13
13
|
...networkAttributes,
|
|
14
14
|
bridge: {
|
|
15
15
|
...default_attribute_writable,
|
|
@@ -17,11 +17,9 @@ export const NetworkTypeDefinition = {
|
|
|
17
17
|
collection: true
|
|
18
18
|
},
|
|
19
19
|
gateway: { ...default_attribute_writable, type: "host" }
|
|
20
|
-
}
|
|
21
|
-
};
|
|
20
|
+
};
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
static typeDefinition = NetworkTypeDefinition;
|
|
22
|
+
static typeDefinition = this;
|
|
25
23
|
|
|
26
24
|
static {
|
|
27
25
|
addType(this);
|
package/src/owner.mjs
CHANGED
|
@@ -13,13 +13,15 @@ import { Base } from "./base.mjs";
|
|
|
13
13
|
import { Subnet, SUBNET_GLOBAL_IPV4, SUBNET_GLOBAL_IPV6 } from "./subnet.mjs";
|
|
14
14
|
import { networks_attribute } from "./network-support.mjs";
|
|
15
15
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const EMPTY = new Map();
|
|
17
|
+
|
|
18
|
+
export class Owner extends Base {
|
|
19
|
+
static name = "owner";
|
|
20
|
+
static priority = 2;
|
|
21
|
+
static owners = ["location", "owner", "root"];
|
|
22
|
+
static extends = Base.typeDefinition;
|
|
23
|
+
static key = "name";
|
|
24
|
+
static attributes = {
|
|
23
25
|
networks: networks_attribute,
|
|
24
26
|
hosts: { ...default_attribute_writable, type: "host", collection: true },
|
|
25
27
|
clusters: {
|
|
@@ -40,13 +42,9 @@ const OwnerTypeDefinition = {
|
|
|
40
42
|
locales: { ...string_set_attribute_writable, description: "unix locale" },
|
|
41
43
|
administratorEmail: { ...email_attribute, writable: true },
|
|
42
44
|
template: { ...boolean_attribute_writable, private: true }
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
+
};
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export class Owner extends Base {
|
|
49
|
-
static typeDefinition = OwnerTypeDefinition;
|
|
47
|
+
static typeDefinition = this;
|
|
50
48
|
|
|
51
49
|
static {
|
|
52
50
|
addType(this);
|