pmcf 6.48.3 → 6.49.1
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/interfaces/interface.mjs +66 -0
- package/src/{network-interfaces → interfaces}/loopback.mjs +2 -2
- package/src/interfaces/modbus.mjs +15 -0
- package/src/{network-interfaces → interfaces}/network-interface.mjs +3 -2
- package/src/{network-interfaces/skeleton.mjs → interfaces/skeleton-network-interface.mjs} +4 -53
- package/src/{network-interfaces → interfaces}/wireguard.mjs +1 -1
- package/src/module.mjs +7 -6
- package/src/network-address.mjs +8 -9
- /package/src/{network-interfaces → interfaces}/ethernet.mjs +0 -0
- /package/src/{network-interfaces → interfaces}/tun.mjs +0 -0
- /package/src/{network-interfaces → interfaces}/wlan.mjs +0 -0
package/package.json
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { AggregatedMap } from "aggregated-map";
|
|
2
|
+
import { asArray } from "pacc";
|
|
3
|
+
import { host } from "../host.mjs";
|
|
4
|
+
import { addType } from "../type.mjs";
|
|
5
|
+
import { ServiceOwner } from "../service-owner.mjs";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export class Interface extends ServiceOwner {
|
|
11
|
+
static get typeName() {
|
|
12
|
+
return "interface";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static commonNamePattern = new RegExp(`^${this.name}\d+$`);
|
|
16
|
+
|
|
17
|
+
static isCommonName(name) {
|
|
18
|
+
return this.commonNamePattern.test(name);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static {
|
|
22
|
+
addType(this);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get typeName() {
|
|
26
|
+
const type = this.constructor;
|
|
27
|
+
return type.specializationOf?.name || type.name;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
get kind() {
|
|
31
|
+
return this.constructor.name;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get host() {
|
|
35
|
+
if (this.owner instanceof host) {
|
|
36
|
+
return this.owner;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get hosts() {
|
|
41
|
+
return asArray(this.host);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
get domainName() {
|
|
45
|
+
return this.host?.domainName;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
get domainNames() {
|
|
49
|
+
return new Set();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
get services() {
|
|
53
|
+
return this.owner
|
|
54
|
+
? new AggregatedMap([super.services, this.owner._services])
|
|
55
|
+
: super.services;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
matches(other) {
|
|
59
|
+
if (this.isTemplate) {
|
|
60
|
+
const name = this.name.replaceAll("*", "");
|
|
61
|
+
return name.length === 0 || other.name.indexOf(name) >= 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { addType } from "pacc";
|
|
2
1
|
import { SUBNET_LOCALHOST_IPV4, SUBNET_LOCALHOST_IPV6 } from "pmcf";
|
|
3
|
-
import {
|
|
2
|
+
import { addType } from "../type.mjs";
|
|
3
|
+
import { SkeletonNetworkInterface } from "./skeleton-network-interface.mjs";
|
|
4
4
|
import { NetworkInterface } from "./network-interface.mjs";
|
|
5
5
|
|
|
6
6
|
const _localAddresses = new Map([
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { number_attribute_writable } from "pacc";
|
|
2
|
+
import { addType } from "../type.mjs";
|
|
3
|
+
import { Interface } from "./interface.mjs";
|
|
4
|
+
|
|
5
|
+
export class modbus extends Interface {
|
|
6
|
+
static attributes = {
|
|
7
|
+
address: { number_attribute_writable, name: "address" }
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
static commonNamePattern = /^modbus\d*$/;
|
|
11
|
+
|
|
12
|
+
static {
|
|
13
|
+
addType(this);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
default_collection_attribute_writable
|
|
5
5
|
} from "pacc";
|
|
6
6
|
import { network_attribute } from "../common-attributes.mjs";
|
|
7
|
-
import { host, cidrAddresses
|
|
7
|
+
import { host, cidrAddresses } from "pmcf";
|
|
8
|
+
import { addType } from "../type.mjs";
|
|
8
9
|
import {
|
|
9
10
|
networkAttributes,
|
|
10
11
|
networkAddressAttributes,
|
|
@@ -12,7 +13,7 @@ import {
|
|
|
12
13
|
cluster_attribute
|
|
13
14
|
} from "../common-attributes.mjs";
|
|
14
15
|
import { writeLines, sectionLines } from "../utils.mjs";
|
|
15
|
-
import { SkeletonNetworkInterface } from "./skeleton.mjs";
|
|
16
|
+
import { SkeletonNetworkInterface } from "./skeleton-network-interface.mjs";
|
|
16
17
|
import { yesno } from "../utils.mjs";
|
|
17
18
|
|
|
18
19
|
export class NetworkInterface extends SkeletonNetworkInterface {
|
|
@@ -1,72 +1,23 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import { AggregatedMap } from "aggregated-map";
|
|
3
|
-
import { addType, asArray } from "pacc";
|
|
4
2
|
import { writeLines, sectionLines } from "../utils.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { addType } from "../type.mjs";
|
|
4
|
+
import { NetworkAddress, cidrAddresses } from "pmcf";
|
|
5
|
+
import { Interface } from "./interface.mjs";
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
*
|
|
10
9
|
*/
|
|
11
|
-
export class SkeletonNetworkInterface extends
|
|
10
|
+
export class SkeletonNetworkInterface extends Interface {
|
|
12
11
|
static get typeName() {
|
|
13
12
|
return "network_interface";
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
static commonNamePattern = new RegExp(`^${this.name}\d+$`);
|
|
17
|
-
|
|
18
|
-
static isCommonName(name) {
|
|
19
|
-
return this.commonNamePattern.test(name);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
15
|
static {
|
|
23
16
|
addType(this);
|
|
24
17
|
}
|
|
25
18
|
|
|
26
19
|
_network;
|
|
27
20
|
|
|
28
|
-
get typeName() {
|
|
29
|
-
const type = this.constructor;
|
|
30
|
-
return type.specializationOf?.name || type.name;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
get kind() {
|
|
34
|
-
return this.constructor.name;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
get host() {
|
|
38
|
-
if (this.owner instanceof host) {
|
|
39
|
-
return this.owner;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
get services() {
|
|
44
|
-
return this.owner
|
|
45
|
-
? new AggregatedMap([super.services, this.owner._services])
|
|
46
|
-
: super.services;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
get hosts() {
|
|
50
|
-
return asArray(this.host);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
get domainName() {
|
|
54
|
-
return this.host?.domainName;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
get domainNames() {
|
|
58
|
-
return new Set();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
matches(other) {
|
|
62
|
-
if (this.isTemplate) {
|
|
63
|
-
const name = this.name.replaceAll("*", "");
|
|
64
|
-
return name.length === 0 || other.name.indexOf(name) >= 0;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
21
|
get network() {
|
|
71
22
|
return this.attribute("_network") ?? this.host?.network;
|
|
72
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { addType } from "pacc";
|
|
2
|
-
import { SkeletonNetworkInterface } from "./skeleton.mjs";
|
|
2
|
+
import { SkeletonNetworkInterface } from "./skeleton-network-interface.mjs";
|
|
3
3
|
import { NetworkInterface } from "./network-interface.mjs";
|
|
4
4
|
|
|
5
5
|
export class wireguard extends SkeletonNetworkInterface {
|
package/src/module.mjs
CHANGED
|
@@ -13,12 +13,13 @@ export * from "./network-address.mjs";
|
|
|
13
13
|
export * from "./common-attributes.mjs";
|
|
14
14
|
export * from "./content.mjs";
|
|
15
15
|
export * from "./host.mjs";
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./
|
|
18
|
-
export * from "./
|
|
19
|
-
export * from "./
|
|
20
|
-
export * from "./
|
|
21
|
-
export * from "./
|
|
16
|
+
export * from "./interfaces/network-interface.mjs";
|
|
17
|
+
export * from "./interfaces/loopback.mjs";
|
|
18
|
+
export * from "./interfaces/ethernet.mjs";
|
|
19
|
+
export * from "./interfaces/wlan.mjs";
|
|
20
|
+
export * from "./interfaces/wireguard.mjs";
|
|
21
|
+
export * from "./interfaces/tun.mjs";
|
|
22
|
+
export * from "./interfaces/modbus.mjs";
|
|
22
23
|
export * from "./service-types.mjs";
|
|
23
24
|
export * from "./core-service.mjs";
|
|
24
25
|
export * from "./service.mjs";
|
package/src/network-address.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
default_attribute,
|
|
3
|
-
string_attribute,
|
|
4
|
-
type_attribute,
|
|
5
|
-
getAttribute,
|
|
6
|
-
asArray
|
|
7
|
-
} from "pacc";
|
|
1
|
+
import { default_attribute, type_attribute, getAttribute, asArray } from "pacc";
|
|
8
2
|
import { familyIP, formatCIDR, decodeIP, addressType } from "ip-utilties";
|
|
9
3
|
import { Subnet } from "./subnet.mjs";
|
|
10
4
|
import { Owner, addType } from "pmcf";
|
|
11
|
-
import { NetworkInterface } from "./
|
|
12
|
-
import {
|
|
5
|
+
import { NetworkInterface } from "./interfaces/network-interface.mjs";
|
|
6
|
+
import {
|
|
7
|
+
family_attribute,
|
|
8
|
+
subnet_attribute,
|
|
9
|
+
address_attribute,
|
|
10
|
+
cidr_address_attribute
|
|
11
|
+
} from "./common-attributes.mjs";
|
|
13
12
|
/**
|
|
14
13
|
*
|
|
15
14
|
*/
|
|
File without changes
|
|
File without changes
|
|
File without changes
|