pmcf 2.19.4 → 2.19.6
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 +3 -3
- package/src/host.mjs +4 -11
- package/src/network-interface.mjs +33 -8
- package/src/owner.mjs +2 -2
- package/types/host.d.mts +1 -6
- package/types/network-interface.d.mts +22 -1
- package/types/owner.d.mts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target es2024 --lib esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"ip-utilties": "^1.0
|
|
41
|
+
"ip-utilties": "^1.1.0",
|
|
42
42
|
"npm-pkgbuild": "^18.0.1",
|
|
43
|
-
"pacc": "^3.
|
|
43
|
+
"pacc": "^3.4.0",
|
|
44
44
|
"pkg-dir": "^8.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
package/src/host.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
generateMachineInfo,
|
|
14
14
|
generateKnownHosts
|
|
15
15
|
} from "./host-utils.mjs";
|
|
16
|
-
import {NetworkInterfaceTypeDefinition} from "./network-interface.mjs";
|
|
16
|
+
import { NetworkInterfaceTypeDefinition } from "./network-interface.mjs";
|
|
17
17
|
|
|
18
18
|
const HostTypeDefinition = {
|
|
19
19
|
name: "host",
|
|
@@ -421,16 +421,9 @@ export class Host extends Base {
|
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
*networkAddresses() {
|
|
424
|
+
*networkAddresses(filter) {
|
|
425
425
|
for (const networkInterface of this.networkInterfaces.values()) {
|
|
426
|
-
|
|
427
|
-
yield {
|
|
428
|
-
networkInterface,
|
|
429
|
-
domainNames: networkInterface.domainNames,
|
|
430
|
-
address,
|
|
431
|
-
subnet
|
|
432
|
-
};
|
|
433
|
-
}
|
|
426
|
+
yield* networkInterface.networkAddresses(filter);
|
|
434
427
|
}
|
|
435
428
|
}
|
|
436
429
|
|
|
@@ -448,7 +441,7 @@ export class Host extends Base {
|
|
|
448
441
|
|
|
449
442
|
get cidrAddresses() {
|
|
450
443
|
return [...this.networkAddresses()].map(({ address, subnet }) =>
|
|
451
|
-
formatCIDR(address, subnet)
|
|
444
|
+
formatCIDR(address, subnet.prefixLength)
|
|
452
445
|
);
|
|
453
446
|
}
|
|
454
447
|
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
normalizeIP
|
|
7
7
|
} from "ip-utilties";
|
|
8
8
|
import { Base } from "./base.mjs";
|
|
9
|
+
import { Subnet } from "./subnet.mjs";
|
|
9
10
|
import {
|
|
10
11
|
networkProperties,
|
|
11
12
|
networkAddressProperties
|
|
@@ -13,6 +14,14 @@ import {
|
|
|
13
14
|
import { asArray } from "./utils.mjs";
|
|
14
15
|
import { addType } from "./types.mjs";
|
|
15
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {object} NetworkAddress
|
|
19
|
+
* @property {NetworkInterface} networkInterface
|
|
20
|
+
* @property {string|Uint8Array|Uint16Array} address
|
|
21
|
+
* @property {Subnet} subnet
|
|
22
|
+
* @property {Set<string>} domainNames
|
|
23
|
+
*/
|
|
24
|
+
|
|
16
25
|
class SkeletonNetworkInterface extends Base {
|
|
17
26
|
_extends = [];
|
|
18
27
|
_network;
|
|
@@ -43,7 +52,7 @@ class SkeletonNetworkInterface extends Base {
|
|
|
43
52
|
|
|
44
53
|
matches(other) {
|
|
45
54
|
if (this.isTemplate) {
|
|
46
|
-
const name = this.name.
|
|
55
|
+
const name = this.name.replaceAll("*", "");
|
|
47
56
|
return name.length === 0 || other.name.indexOf(name) >= 0;
|
|
48
57
|
}
|
|
49
58
|
|
|
@@ -58,6 +67,26 @@ class SkeletonNetworkInterface extends Base {
|
|
|
58
67
|
this._network = network;
|
|
59
68
|
}
|
|
60
69
|
|
|
70
|
+
get ipAddresses() {
|
|
71
|
+
return new Map();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @param {object} filter
|
|
77
|
+
* @return {Iterable<NetworkAddress>}
|
|
78
|
+
*/
|
|
79
|
+
*networkAddresses(filter) {
|
|
80
|
+
for (const [address, subnet] of this.ipAddresses) {
|
|
81
|
+
yield {
|
|
82
|
+
networkInterface: this,
|
|
83
|
+
domainNames: this.domainNames,
|
|
84
|
+
address,
|
|
85
|
+
subnet
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
61
90
|
get rawAddress() {
|
|
62
91
|
return this.rawAddresses[0];
|
|
63
92
|
}
|
|
@@ -74,10 +103,6 @@ class SkeletonNetworkInterface extends Base {
|
|
|
74
103
|
return this.cidrAddresses[0];
|
|
75
104
|
}
|
|
76
105
|
|
|
77
|
-
get ipAddresses() {
|
|
78
|
-
return new Map();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
106
|
get rawAddresses() {
|
|
82
107
|
return [...this.ipAddresses].map(([address]) => address);
|
|
83
108
|
}
|
|
@@ -96,7 +121,7 @@ class SkeletonNetworkInterface extends Base {
|
|
|
96
121
|
|
|
97
122
|
get cidrAddresses() {
|
|
98
123
|
return [...this.ipAddresses].map(([address, subnet]) =>
|
|
99
|
-
formatCIDR(address, subnet)
|
|
124
|
+
formatCIDR(address, subnet.prefixLength)
|
|
100
125
|
);
|
|
101
126
|
}
|
|
102
127
|
}
|
|
@@ -292,8 +317,8 @@ const LoopbackNetworkInterfaceTypeDefinition = {
|
|
|
292
317
|
};
|
|
293
318
|
|
|
294
319
|
const _localAddresses = new Map([
|
|
295
|
-
["127.0.0.1", { prefix: "127.0.0", prefixLength: 8 }], // TODO
|
|
296
|
-
["::1", { prefix: "", prefixLength: 128 }]
|
|
320
|
+
["127.0.0.1", { address: "127.0.0/8", prefix: "127.0.0", prefixLength: 8 }], // TODO
|
|
321
|
+
["::1", { address: "::1/128", prefix: "::1", prefixLength: 128 }]
|
|
297
322
|
]);
|
|
298
323
|
|
|
299
324
|
export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
|
package/src/owner.mjs
CHANGED
|
@@ -298,9 +298,9 @@ export class Owner extends Base {
|
|
|
298
298
|
return all;
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
*networkAddresses() {
|
|
301
|
+
*networkAddresses(filter) {
|
|
302
302
|
for (const host of this.hosts()) {
|
|
303
|
-
yield* host.networkAddresses();
|
|
303
|
+
yield* host.networkAddresses(filter);
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
|
package/types/host.d.mts
CHANGED
|
@@ -232,12 +232,7 @@ export class Host extends Base {
|
|
|
232
232
|
findNetworkInterface(filter: any): any;
|
|
233
233
|
set networkInterfaces(networkInterface: Map<any, any>);
|
|
234
234
|
get networkInterfaces(): Map<any, any>;
|
|
235
|
-
networkAddresses(): Generator<
|
|
236
|
-
networkInterface: any;
|
|
237
|
-
domainNames: any;
|
|
238
|
-
address: any;
|
|
239
|
-
subnet: any;
|
|
240
|
-
}, void, unknown>;
|
|
235
|
+
networkAddresses(filter: any): Generator<any, void, any>;
|
|
241
236
|
get rawAddress(): any;
|
|
242
237
|
get rawAddresses(): any[];
|
|
243
238
|
get cidrAddress(): any;
|
|
@@ -680,10 +680,24 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
|
|
|
680
680
|
get scope(): string;
|
|
681
681
|
get hostName(): string;
|
|
682
682
|
get ipAddresses(): Map<string, {
|
|
683
|
+
address: string;
|
|
683
684
|
prefix: string;
|
|
684
685
|
prefixLength: number;
|
|
685
686
|
}>;
|
|
686
687
|
}
|
|
688
|
+
export type NetworkAddress = {
|
|
689
|
+
networkInterface: NetworkInterface;
|
|
690
|
+
address: string | Uint8Array | Uint16Array;
|
|
691
|
+
subnet: Subnet;
|
|
692
|
+
domainNames: Set<string>;
|
|
693
|
+
};
|
|
694
|
+
/**
|
|
695
|
+
* @typedef {object} NetworkAddress
|
|
696
|
+
* @property {NetworkInterface} networkInterface
|
|
697
|
+
* @property {string|Uint8Array|Uint16Array} address
|
|
698
|
+
* @property {Subnet} subnet
|
|
699
|
+
* @property {Set<string>} domainNames
|
|
700
|
+
*/
|
|
687
701
|
declare class SkeletonNetworkInterface extends Base {
|
|
688
702
|
_extends: any[];
|
|
689
703
|
_network: any;
|
|
@@ -694,15 +708,22 @@ declare class SkeletonNetworkInterface extends Base {
|
|
|
694
708
|
matches(other: any): boolean;
|
|
695
709
|
set network(network: any);
|
|
696
710
|
get network(): any;
|
|
711
|
+
get ipAddresses(): Map<any, any>;
|
|
712
|
+
/**
|
|
713
|
+
*
|
|
714
|
+
* @param {object} filter
|
|
715
|
+
* @return {Iterable<NetworkAddress>}
|
|
716
|
+
*/
|
|
717
|
+
networkAddresses(filter: object): Iterable<NetworkAddress>;
|
|
697
718
|
get rawAddress(): any;
|
|
698
719
|
get rawIPv4Address(): any;
|
|
699
720
|
get rawIPv6Address(): any;
|
|
700
721
|
get cidrAddress(): any;
|
|
701
|
-
get ipAddresses(): Map<any, any>;
|
|
702
722
|
get rawAddresses(): any[];
|
|
703
723
|
get rawIPv4Addresses(): any[];
|
|
704
724
|
get rawIPv6Addresses(): any[];
|
|
705
725
|
get cidrAddresses(): any[];
|
|
706
726
|
}
|
|
727
|
+
import { Subnet } from "./subnet.mjs";
|
|
707
728
|
import { Base } from "./base.mjs";
|
|
708
729
|
export {};
|
package/types/owner.d.mts
CHANGED
|
@@ -155,7 +155,7 @@ export class Owner extends Base {
|
|
|
155
155
|
addBridge(network: any, destinationNetworks: any): any;
|
|
156
156
|
_resolveBridges(): void;
|
|
157
157
|
get derivedPackaging(): Set<any>;
|
|
158
|
-
networkAddresses(): Generator<any, void, any>;
|
|
158
|
+
networkAddresses(filter: any): Generator<any, void, any>;
|
|
159
159
|
_country: any;
|
|
160
160
|
set country(value: any);
|
|
161
161
|
get country(): any;
|