pmcf 1.79.11 → 1.80.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/base.mjs +4 -0
- package/src/dns.mjs +20 -20
- package/src/host.mjs +2 -7
- package/src/owner.mjs +18 -0
- package/types/base.d.mts +1 -0
- package/types/cluster.d.mts +5 -0
- package/types/location.d.mts +10 -0
- package/types/network.d.mts +5 -0
- package/types/owner.d.mts +6 -0
- package/types/root.d.mts +10 -0
package/package.json
CHANGED
package/src/base.mjs
CHANGED
package/src/dns.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
normalizeIPAddress,
|
|
8
8
|
isLinkLocal
|
|
9
9
|
} from "./utils.mjs";
|
|
10
|
-
import { DNSRecord, dnsFullName
|
|
10
|
+
import { DNSRecord, dnsFullName } from "./dns-utils.mjs";
|
|
11
11
|
import { Base } from "./base.mjs";
|
|
12
12
|
import { addType } from "./types.mjs";
|
|
13
13
|
import { serviceAddresses } from "./service.mjs";
|
|
@@ -186,6 +186,9 @@ async function generateZoneDefs(dns, targetDir) {
|
|
|
186
186
|
const updates = [Math.ceil(Date.now() / 1000), ...dns.soaUpdates].join(" ");
|
|
187
187
|
|
|
188
188
|
for (const domain of dns.domains) {
|
|
189
|
+
const isLocalDomain = dns.localDomains.has(domain);
|
|
190
|
+
|
|
191
|
+
const ownerName = isLocalDomain ? dns.owner.name : "FOREIGN";
|
|
189
192
|
const zones = [];
|
|
190
193
|
const records = new Set();
|
|
191
194
|
|
|
@@ -194,13 +197,18 @@ async function generateZoneDefs(dns, targetDir) {
|
|
|
194
197
|
|
|
195
198
|
let maxKeyLength;
|
|
196
199
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
200
|
+
if (isLocalDomain) {
|
|
201
|
+
for (const mail of dns.owner.findServices({
|
|
202
|
+
type: "smtp",
|
|
203
|
+
priority: "<10"
|
|
204
|
+
})) {
|
|
205
|
+
records.add(
|
|
206
|
+
DNSRecord("@", "MX", mail.priority, dnsFullName(mail.domainName))
|
|
207
|
+
);
|
|
208
|
+
}
|
|
201
209
|
}
|
|
202
210
|
|
|
203
|
-
console.log(`${nameService}`, nameService.ipAddressOrDomainName);
|
|
211
|
+
console.log(`${nameService} ${domain}`, nameService.ipAddressOrDomainName);
|
|
204
212
|
//console.log(dns.owner.fullName, domain, nameService.domainName, rname);
|
|
205
213
|
const reverseZones = new Map();
|
|
206
214
|
|
|
@@ -218,26 +226,18 @@ async function generateZoneDefs(dns, targetDir) {
|
|
|
218
226
|
dnsFullName(nameService.ipAddressOrDomainName)
|
|
219
227
|
);
|
|
220
228
|
|
|
221
|
-
const ALPNRecord = DNSRecord(
|
|
222
|
-
"@",
|
|
223
|
-
"HTTPS",
|
|
224
|
-
1,
|
|
225
|
-
".",
|
|
226
|
-
dnsFormatParameters({ alpn: "h3" })
|
|
227
|
-
);
|
|
228
|
-
|
|
229
229
|
const zone = {
|
|
230
230
|
id: domain,
|
|
231
231
|
type: "plain",
|
|
232
|
-
file: `${
|
|
233
|
-
records: new Set([SOARecord, NSRecord,
|
|
232
|
+
file: `${ownerName}/${domain}.zone`,
|
|
233
|
+
records: new Set([SOARecord, NSRecord, ...records])
|
|
234
234
|
};
|
|
235
235
|
zones.push(zone);
|
|
236
236
|
|
|
237
237
|
const catalogZone = {
|
|
238
238
|
id: `catalog.${domain}`,
|
|
239
239
|
type: "catalog",
|
|
240
|
-
file: `${
|
|
240
|
+
file: `${ownerName}/catalog.${domain}.zone`,
|
|
241
241
|
records: new Set([
|
|
242
242
|
SOARecord,
|
|
243
243
|
NSRecord,
|
|
@@ -249,7 +249,7 @@ async function generateZoneDefs(dns, targetDir) {
|
|
|
249
249
|
plain: { name: `${domain}.zone.conf`, content: [] }
|
|
250
250
|
};
|
|
251
251
|
|
|
252
|
-
if (dns.hasCatalog) {
|
|
252
|
+
if (isLocalDomain && dns.hasCatalog) {
|
|
253
253
|
zones.push(catalogZone);
|
|
254
254
|
configs.catalog = { name: `catalog.${domain}.zone.conf`, content: [] };
|
|
255
255
|
}
|
|
@@ -287,7 +287,7 @@ async function generateZoneDefs(dns, targetDir) {
|
|
|
287
287
|
reverseZone = {
|
|
288
288
|
id: reverseArpa,
|
|
289
289
|
type: "plain",
|
|
290
|
-
file: `${
|
|
290
|
+
file: `${ownerName}/${reverseArpa}.zone`,
|
|
291
291
|
records: new Set([SOARecord, NSRecord])
|
|
292
292
|
};
|
|
293
293
|
zones.push(reverseZone);
|
|
@@ -306,7 +306,7 @@ async function generateZoneDefs(dns, targetDir) {
|
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
-
if (!hosts.has(host)) {
|
|
309
|
+
if (isLocalDomain && !hosts.has(host)) {
|
|
310
310
|
hosts.add(host);
|
|
311
311
|
for (const service of host.findServices()) {
|
|
312
312
|
for (const record of service.dnsRecordsForDomainName(
|
package/src/host.mjs
CHANGED
|
@@ -254,14 +254,9 @@ export class Host extends Base {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
get domains() {
|
|
257
|
-
|
|
257
|
+
return new Set(
|
|
258
258
|
[...this.aliases].map(n => domainFromDominName(n, this.domain))
|
|
259
|
-
);
|
|
260
|
-
|
|
261
|
-
if(this.domain) {
|
|
262
|
-
domains.add(this.domain);
|
|
263
|
-
}
|
|
264
|
-
return domains;
|
|
259
|
+
).union(this.localDomains);
|
|
265
260
|
}
|
|
266
261
|
|
|
267
262
|
get domainNames() {
|
package/src/owner.mjs
CHANGED
|
@@ -28,6 +28,7 @@ const OwnerTypeDefinition = {
|
|
|
28
28
|
|
|
29
29
|
country: { type: "string", collection: false, writeable: true },
|
|
30
30
|
domain: { type: "string", collection: false, writeable: true },
|
|
31
|
+
domains: { type: "string", collection: true, writeable: true },
|
|
31
32
|
timezone: { type: "string", collection: false, writeable: true },
|
|
32
33
|
locales: { type: "string", collection: true, writeable: true },
|
|
33
34
|
administratorEmail: { type: "string", collection: false, writeable: true }
|
|
@@ -381,6 +382,7 @@ export class Owner extends Base {
|
|
|
381
382
|
return this.#domain || this.owner?.domain;
|
|
382
383
|
}
|
|
383
384
|
|
|
385
|
+
|
|
384
386
|
get domains() {
|
|
385
387
|
let domains = new Set();
|
|
386
388
|
|
|
@@ -390,4 +392,20 @@ export class Owner extends Base {
|
|
|
390
392
|
|
|
391
393
|
return domains;
|
|
392
394
|
}
|
|
395
|
+
|
|
396
|
+
get localDomains() {
|
|
397
|
+
return this.domain ? new Set([this.domain]) : new Set();
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/*
|
|
401
|
+
get localDomains() {
|
|
402
|
+
let domains = new Set();
|
|
403
|
+
|
|
404
|
+
for (const object of this.hosts()) {
|
|
405
|
+
domains = domains.union(object.localDomains);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
return domains;
|
|
409
|
+
}
|
|
410
|
+
*/
|
|
393
411
|
}
|
package/types/base.d.mts
CHANGED
package/types/cluster.d.mts
CHANGED
package/types/location.d.mts
CHANGED
|
@@ -183,6 +183,11 @@ export class Location extends Owner {
|
|
|
183
183
|
collection: boolean;
|
|
184
184
|
writeable: boolean;
|
|
185
185
|
};
|
|
186
|
+
domains: {
|
|
187
|
+
type: string;
|
|
188
|
+
collection: boolean;
|
|
189
|
+
writeable: boolean;
|
|
190
|
+
};
|
|
186
191
|
timezone: {
|
|
187
192
|
type: string;
|
|
188
193
|
collection: boolean;
|
|
@@ -383,6 +388,11 @@ export class Location extends Owner {
|
|
|
383
388
|
collection: boolean;
|
|
384
389
|
writeable: boolean;
|
|
385
390
|
};
|
|
391
|
+
domains: {
|
|
392
|
+
type: string;
|
|
393
|
+
collection: boolean;
|
|
394
|
+
writeable: boolean;
|
|
395
|
+
};
|
|
386
396
|
timezone: {
|
|
387
397
|
type: string;
|
|
388
398
|
collection: boolean;
|
package/types/network.d.mts
CHANGED
package/types/owner.d.mts
CHANGED
|
@@ -181,6 +181,11 @@ export class Owner extends Base {
|
|
|
181
181
|
collection: boolean;
|
|
182
182
|
writeable: boolean;
|
|
183
183
|
};
|
|
184
|
+
domains: {
|
|
185
|
+
type: string;
|
|
186
|
+
collection: boolean;
|
|
187
|
+
writeable: boolean;
|
|
188
|
+
};
|
|
184
189
|
timezone: {
|
|
185
190
|
type: string;
|
|
186
191
|
collection: boolean;
|
|
@@ -231,6 +236,7 @@ export class Owner extends Base {
|
|
|
231
236
|
set domain(value: any);
|
|
232
237
|
get domain(): any;
|
|
233
238
|
get domains(): Set<any>;
|
|
239
|
+
get localDomains(): Set<any>;
|
|
234
240
|
#private;
|
|
235
241
|
}
|
|
236
242
|
import { Base } from "./base.mjs";
|
package/types/root.d.mts
CHANGED
|
@@ -187,6 +187,11 @@ export class Root extends Location {
|
|
|
187
187
|
collection: boolean;
|
|
188
188
|
writeable: boolean;
|
|
189
189
|
};
|
|
190
|
+
domains: {
|
|
191
|
+
type: string;
|
|
192
|
+
collection: boolean;
|
|
193
|
+
writeable: boolean;
|
|
194
|
+
};
|
|
190
195
|
timezone: {
|
|
191
196
|
type: string;
|
|
192
197
|
collection: boolean;
|
|
@@ -387,6 +392,11 @@ export class Root extends Location {
|
|
|
387
392
|
collection: boolean;
|
|
388
393
|
writeable: boolean;
|
|
389
394
|
};
|
|
395
|
+
domains: {
|
|
396
|
+
type: string;
|
|
397
|
+
collection: boolean;
|
|
398
|
+
writeable: boolean;
|
|
399
|
+
};
|
|
390
400
|
timezone: {
|
|
391
401
|
type: string;
|
|
392
402
|
collection: boolean;
|