pmcf 1.65.1 → 1.65.3
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/dns.mjs +3 -3
- package/src/utils.mjs +14 -9
- package/types/utils.d.mts +4 -0
package/package.json
CHANGED
package/src/dns.mjs
CHANGED
|
@@ -175,7 +175,7 @@ async function generateNamedDefs(dns, targetDir) {
|
|
|
175
175
|
const zone = {
|
|
176
176
|
id: domain,
|
|
177
177
|
type: "plain",
|
|
178
|
-
file: `${domain}.zone`,
|
|
178
|
+
file: `${dns.owner.name}/${domain}.zone`,
|
|
179
179
|
records: new Set([SOARecord, NSRecord, ...records])
|
|
180
180
|
};
|
|
181
181
|
zones.push(zone);
|
|
@@ -183,7 +183,7 @@ async function generateNamedDefs(dns, targetDir) {
|
|
|
183
183
|
const catalogZone = {
|
|
184
184
|
id: `catalog.${domain}`,
|
|
185
185
|
type: "catalog",
|
|
186
|
-
file:
|
|
186
|
+
file: `${dns.owner.name}/catalog.${domain}.zone`,
|
|
187
187
|
records: new Set([
|
|
188
188
|
SOARecord,
|
|
189
189
|
NSRecord,
|
|
@@ -229,7 +229,7 @@ async function generateNamedDefs(dns, targetDir) {
|
|
|
229
229
|
reverseZone = {
|
|
230
230
|
id: reverseArpa,
|
|
231
231
|
type: "plain",
|
|
232
|
-
file: `${reverseArpa}.zone`,
|
|
232
|
+
file: `${dns.owner.name}/${reverseArpa}.zone`,
|
|
233
233
|
records: new Set([SOARecord, NSRecord])
|
|
234
234
|
};
|
|
235
235
|
zones.push(reverseZone);
|
package/src/utils.mjs
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { writeFile, mkdir } from "node:fs/promises";
|
|
2
|
-
import { join } from "node:path";
|
|
2
|
+
import { join, dirname, basename } from "node:path";
|
|
3
3
|
|
|
4
4
|
export async function writeLines(dir, name, lines) {
|
|
5
|
+
const full = join(dir, name);
|
|
6
|
+
dir = dirname(full);
|
|
7
|
+
name = basename(full);
|
|
8
|
+
|
|
5
9
|
await mkdir(dir, { recursive: true });
|
|
6
10
|
if (typeof lines === "string") lines = [lines];
|
|
7
11
|
return writeFile(
|
|
@@ -33,11 +37,12 @@ export function asArray(value) {
|
|
|
33
37
|
return Array.isArray(value) ? value : value === undefined ? [] : [value];
|
|
34
38
|
}
|
|
35
39
|
|
|
36
|
-
export function asIterator(value)
|
|
37
|
-
{
|
|
38
|
-
|
|
40
|
+
export function asIterator(value) {
|
|
41
|
+
if (value === undefined) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
39
44
|
|
|
40
|
-
if(typeof value[Symbol.iterator] ===
|
|
45
|
+
if (typeof value[Symbol.iterator] === "function") {
|
|
41
46
|
return value;
|
|
42
47
|
}
|
|
43
48
|
|
|
@@ -180,7 +185,7 @@ export function hasWellKnownSubnet(address) {
|
|
|
180
185
|
return n === IPV4_LOCALHOST || n === IPV6_LOCALHOST || isLinkLocal(address);
|
|
181
186
|
}
|
|
182
187
|
|
|
183
|
-
const IPV4_LOCALHOST = _encode(ipv4, "127.0.0.1");
|
|
184
|
-
const IPV6_LOCALHOST = _encode(ipv6, "::1");
|
|
185
|
-
const IPV6_LINK_LOCAL_BROADCAST = _encode(ipv6,"ff02::1");
|
|
186
|
-
const IPV6_ROUTER_BROADCAST = _encode(ipv6,"ff02::2");
|
|
188
|
+
export const IPV4_LOCALHOST = _encode(ipv4, "127.0.0.1");
|
|
189
|
+
export const IPV6_LOCALHOST = _encode(ipv6, "::1");
|
|
190
|
+
export const IPV6_LINK_LOCAL_BROADCAST = _encode(ipv6, "ff02::1");
|
|
191
|
+
export const IPV6_ROUTER_BROADCAST = _encode(ipv6, "ff02::2");
|
package/types/utils.d.mts
CHANGED
|
@@ -25,3 +25,7 @@ export function normalizeCIDR(address: any): {
|
|
|
25
25
|
cidr: string;
|
|
26
26
|
};
|
|
27
27
|
export function hasWellKnownSubnet(address: any): any;
|
|
28
|
+
export const IPV4_LOCALHOST: bigint;
|
|
29
|
+
export const IPV6_LOCALHOST: bigint;
|
|
30
|
+
export const IPV6_LINK_LOCAL_BROADCAST: bigint;
|
|
31
|
+
export const IPV6_ROUTER_BROADCAST: bigint;
|