pmcf 1.79.10 → 1.80.0
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-utils.mjs +1 -6
- package/src/dns.mjs +11 -16
- package/src/host.mjs +2 -7
- package/src/owner.mjs +18 -0
- package/src/service.mjs +2 -1
- 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-utils.mjs
CHANGED
|
@@ -23,7 +23,7 @@ export function dnsFormatParameters(parameters) {
|
|
|
23
23
|
value !== undefined && [...asIterator(value)].length > 0
|
|
24
24
|
? `${name}="${[...asIterator(value)].join(",")}"`
|
|
25
25
|
: name
|
|
26
|
-
)
|
|
26
|
+
).sort((a,b)=>a[0].localeCompare(b[0]))
|
|
27
27
|
.join(" ");
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -35,8 +35,3 @@ export function dnsMergeParameters(a, b) {
|
|
|
35
35
|
])
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
|
-
/*
|
|
39
|
-
console.log(
|
|
40
|
-
dnsFormatParameters(dnsMergeParameters({ alpn: "h2" }, { alpn: "h3" }))
|
|
41
|
-
);
|
|
42
|
-
*/
|
package/src/dns.mjs
CHANGED
|
@@ -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,13 @@ async function generateZoneDefs(dns, targetDir) {
|
|
|
194
197
|
|
|
195
198
|
let maxKeyLength;
|
|
196
199
|
|
|
197
|
-
for (const mail of dns.owner.findServices({ type: "smtp" })) {
|
|
200
|
+
for (const mail of dns.owner.findServices({ type: "smtp", priority: "<10" })) {
|
|
198
201
|
records.add(
|
|
199
202
|
DNSRecord("@", "MX", mail.priority, dnsFullName(mail.domainName))
|
|
200
203
|
);
|
|
201
204
|
}
|
|
202
205
|
|
|
203
|
-
console.log(`${nameService}`, nameService.ipAddressOrDomainName);
|
|
206
|
+
console.log(`${nameService} ${domain}`, nameService.ipAddressOrDomainName);
|
|
204
207
|
//console.log(dns.owner.fullName, domain, nameService.domainName, rname);
|
|
205
208
|
const reverseZones = new Map();
|
|
206
209
|
|
|
@@ -218,26 +221,18 @@ async function generateZoneDefs(dns, targetDir) {
|
|
|
218
221
|
dnsFullName(nameService.ipAddressOrDomainName)
|
|
219
222
|
);
|
|
220
223
|
|
|
221
|
-
const ALPNRecord = DNSRecord(
|
|
222
|
-
"@",
|
|
223
|
-
"HTTPS",
|
|
224
|
-
1,
|
|
225
|
-
".",
|
|
226
|
-
dnsFormatParameters({ alpn: "h3" })
|
|
227
|
-
);
|
|
228
|
-
|
|
229
224
|
const zone = {
|
|
230
225
|
id: domain,
|
|
231
226
|
type: "plain",
|
|
232
|
-
file: `${
|
|
233
|
-
records: new Set([SOARecord, NSRecord,
|
|
227
|
+
file: `${ownerName}/${domain}.zone`,
|
|
228
|
+
records: new Set([SOARecord, NSRecord, ...records])
|
|
234
229
|
};
|
|
235
230
|
zones.push(zone);
|
|
236
231
|
|
|
237
232
|
const catalogZone = {
|
|
238
233
|
id: `catalog.${domain}`,
|
|
239
234
|
type: "catalog",
|
|
240
|
-
file: `${
|
|
235
|
+
file: `${ownerName}/catalog.${domain}.zone`,
|
|
241
236
|
records: new Set([
|
|
242
237
|
SOARecord,
|
|
243
238
|
NSRecord,
|
|
@@ -249,7 +244,7 @@ async function generateZoneDefs(dns, targetDir) {
|
|
|
249
244
|
plain: { name: `${domain}.zone.conf`, content: [] }
|
|
250
245
|
};
|
|
251
246
|
|
|
252
|
-
if (dns.hasCatalog) {
|
|
247
|
+
if (isLocalDomain && dns.hasCatalog) {
|
|
253
248
|
zones.push(catalogZone);
|
|
254
249
|
configs.catalog = { name: `catalog.${domain}.zone.conf`, content: [] };
|
|
255
250
|
}
|
|
@@ -287,7 +282,7 @@ async function generateZoneDefs(dns, targetDir) {
|
|
|
287
282
|
reverseZone = {
|
|
288
283
|
id: reverseArpa,
|
|
289
284
|
type: "plain",
|
|
290
|
-
file: `${
|
|
285
|
+
file: `${ownerName}/${reverseArpa}.zone`,
|
|
291
286
|
records: new Set([SOARecord, NSRecord])
|
|
292
287
|
};
|
|
293
288
|
zones.push(reverseZone);
|
|
@@ -306,7 +301,7 @@ async function generateZoneDefs(dns, targetDir) {
|
|
|
306
301
|
}
|
|
307
302
|
}
|
|
308
303
|
|
|
309
|
-
if (!hosts.has(host)) {
|
|
304
|
+
if (isLocalDomain && !hosts.has(host)) {
|
|
310
305
|
hosts.add(host);
|
|
311
306
|
for (const service of host.findServices()) {
|
|
312
307
|
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/src/service.mjs
CHANGED
|
@@ -22,6 +22,7 @@ const ServiceTypes = {
|
|
|
22
22
|
},
|
|
23
23
|
http3: {
|
|
24
24
|
protocol: "tcp",
|
|
25
|
+
type: "https",
|
|
25
26
|
port: 443,
|
|
26
27
|
tls: true,
|
|
27
28
|
dnsRecord: {
|
|
@@ -193,7 +194,7 @@ export class Service extends Base {
|
|
|
193
194
|
get srvPrefix() {
|
|
194
195
|
const st = ServiceTypes[this.type];
|
|
195
196
|
if (st?.protocol) {
|
|
196
|
-
return `_${this.type}._${st.protocol}`;
|
|
197
|
+
return `_${st.type || this.type}._${st.protocol}`;
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
|
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;
|