pmcf 2.35.1 → 2.35.2
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/host.mjs +2 -2
- package/src/network-address.mjs +14 -0
- package/src/network-interfaces/network-interface.mjs +1 -2
- package/src/network-interfaces/skeleton.mjs +1 -2
- package/src/network-support.mjs +0 -8
- package/src/services/dns.mjs +14 -22
- package/types/network-address.d.mts +2 -0
- package/types/network-support.d.mts +0 -2
package/package.json
CHANGED
package/src/host.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { FileContentProvider } from "npm-pkgbuild";
|
|
4
|
-
import { ServiceOwner, Base } from "pmcf";
|
|
5
|
-
import { networkAddressProperties
|
|
4
|
+
import { ServiceOwner, Base, addresses } from "pmcf";
|
|
5
|
+
import { networkAddressProperties } from "./network-support.mjs";
|
|
6
6
|
import {
|
|
7
7
|
domainFromDominName,
|
|
8
8
|
domainName,
|
package/src/network-address.mjs
CHANGED
|
@@ -31,3 +31,17 @@ export class NetworkAddress {
|
|
|
31
31
|
return `${this.networkInterface.fullName} ${decodeIP(this.address)}`;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
export function addresses(networkAddresses) {
|
|
36
|
+
return [
|
|
37
|
+
...new Set(
|
|
38
|
+
[...networkAddresses].map(object =>
|
|
39
|
+
/*object?.name ||*/ decodeIP(object.address)
|
|
40
|
+
)
|
|
41
|
+
)
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function cidrAddresses(networkAddresses) {
|
|
46
|
+
return [...networkAddresses].map(na => na.cidrAddress);
|
|
47
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { hasWellKnownSubnet, normalizeIP } from "ip-utilties";
|
|
3
|
-
import { Base } from "pmcf";
|
|
3
|
+
import { Base, cidrAddresses } from "pmcf";
|
|
4
4
|
import {
|
|
5
5
|
networkProperties,
|
|
6
6
|
networkAddressProperties
|
|
7
7
|
} from "../network-support.mjs";
|
|
8
8
|
import { asArray, writeLines, sectionLines } from "../utils.mjs";
|
|
9
9
|
import { addType } from "../types.mjs";
|
|
10
|
-
import { cidrAddresses } from "../network-support.mjs";
|
|
11
10
|
import { SkeletonNetworkInterface } from "./skeleton.mjs";
|
|
12
11
|
|
|
13
12
|
export const NetworkInterfaceTypeDefinition = {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { writeLines, sectionLines } from "../utils.mjs";
|
|
3
|
-
import { NetworkAddress, Host } from "pmcf";
|
|
3
|
+
import { NetworkAddress, Host, cidrAddresses } from "pmcf";
|
|
4
4
|
import { ServiceOwner } from "../service-owner.mjs";
|
|
5
|
-
import { cidrAddresses } from "../network-support.mjs";
|
|
6
5
|
|
|
7
6
|
export class SkeletonNetworkInterface extends ServiceOwner {
|
|
8
7
|
_extends = [];
|
package/src/network-support.mjs
CHANGED
|
@@ -38,11 +38,3 @@ export const networkAddressProperties = {
|
|
|
38
38
|
addresses: { type: "string", collection: true, writeable: false },
|
|
39
39
|
address: { type: "string", collection: false, writeable: false }
|
|
40
40
|
};
|
|
41
|
-
|
|
42
|
-
export function addresses(networkAddresses) {
|
|
43
|
-
return [...networkAddresses].map(na => na.address);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function cidrAddresses(networkAddresses) {
|
|
47
|
-
return [...networkAddresses].map(na => na.cidrAddress);
|
|
48
|
-
}
|
package/src/services/dns.mjs
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { createHmac } from "node:crypto";
|
|
3
3
|
import { FileContentProvider } from "npm-pkgbuild";
|
|
4
|
-
import { isLinkLocal, reverseArpa
|
|
5
|
-
import { writeLines } from "../utils.mjs";
|
|
4
|
+
import { isLinkLocal, reverseArpa } from "ip-utilties";
|
|
5
|
+
import { writeLines, asArray } from "../utils.mjs";
|
|
6
6
|
import {
|
|
7
7
|
DNSRecord,
|
|
8
8
|
dnsFullName,
|
|
9
9
|
dnsRecordTypeForAddressFamily,
|
|
10
10
|
sortZoneRecords
|
|
11
11
|
} from "../dns-utils.mjs";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
ExtraSourceService,
|
|
14
|
+
Endpoint,
|
|
15
|
+
serviceEndpoints,
|
|
16
|
+
addresses
|
|
17
|
+
} from "pmcf";
|
|
13
18
|
import { addType } from "../types.mjs";
|
|
14
19
|
import { ServiceTypeDefinition } from "../service.mjs";
|
|
15
20
|
import { ExtraSourceServiceTypeDefinition } from "../extra-source-service.mjs";
|
|
16
|
-
import { addresses } from "../network-support.mjs";
|
|
17
21
|
import { addHook } from "../hooks.mjs";
|
|
18
22
|
|
|
19
23
|
const address_types = ["network", "host", "network_interface"];
|
|
@@ -87,23 +91,8 @@ const statisticsEndpoint = {
|
|
|
87
91
|
tls: false
|
|
88
92
|
};
|
|
89
93
|
|
|
90
|
-
function addressList(objects) {
|
|
91
|
-
return Array.from(objects).map(object => {
|
|
92
|
-
switch (typeof object) {
|
|
93
|
-
case "string":
|
|
94
|
-
return object;
|
|
95
|
-
case "object":
|
|
96
|
-
if (object.name) {
|
|
97
|
-
return object.name;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return decodeIP(object);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
94
|
function addressesStatement(prefix, objects, generateEmpty = false) {
|
|
106
|
-
const body =
|
|
95
|
+
const body = asArray(objects).map(name => ` ${name};`);
|
|
107
96
|
|
|
108
97
|
if (body.length || generateEmpty) {
|
|
109
98
|
return [`${prefix} {`, body, "};"];
|
|
@@ -235,8 +224,11 @@ export class DNSService extends ExtraSourceService {
|
|
|
235
224
|
|
|
236
225
|
const acls = [
|
|
237
226
|
addressesStatement("acl trusted", addresses(this.trusted)),
|
|
238
|
-
addressesStatement("acl
|
|
239
|
-
addressesStatement("acl
|
|
227
|
+
addressesStatement("acl open", addresses(this.open), true),
|
|
228
|
+
addressesStatement("acl protected", [
|
|
229
|
+
...addresses(this.protected),
|
|
230
|
+
"!open"
|
|
231
|
+
])
|
|
240
232
|
].flat();
|
|
241
233
|
|
|
242
234
|
if (acls.length) {
|