pmcf 2.38.0 → 2.39.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.38.0",
3
+ "version": "2.39.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/cluster.mjs CHANGED
@@ -2,6 +2,7 @@ import { join } from "node:path";
2
2
  import { FileContentProvider } from "npm-pkgbuild";
3
3
  import { Owner } from "./owner.mjs";
4
4
  import { Host } from "./host.mjs";
5
+ import { serviceEndpoints } from "pmcf";
5
6
  import { addType } from "./types.mjs";
6
7
  import { writeLines } from "./utils.mjs";
7
8
 
@@ -139,20 +140,25 @@ export class Cluster extends Host {
139
140
  cfg.push("}");
140
141
  cfg.push("");
141
142
 
142
- for (const service of cluster.findServices({ type: "http" })) {
143
- cfg.push(`virtual_server ${cluster.address} ${service.port} {`);
143
+ for (const endpoint of serviceEndpoints(cluster, {
144
+ services: { type: "http" },
145
+ endpoints: e => e.networkInterface.kind !== "loopback"
146
+ })) {
147
+ cfg.push(`virtual_server ${cluster.address} ${endpoint.port} {`);
144
148
  cfg.push(` delay_loop ${cluster.checkInterval}`);
145
149
  cfg.push(" lb_algo wlc");
146
150
  cfg.push(" persistence_timeout 600");
147
- cfg.push(` protocol ${service.protocol.toUpperCase()}`);
151
+ cfg.push(` protocol ${endpoint.protocol.toUpperCase()}`);
148
152
 
149
153
  for (const member of this.members) {
150
- const memberService = member.findService({ type: service.type }) || member.host.findService({ type: service.type }); // TODO
154
+ const memberService =
155
+ member.findService({ type: endpoint.type }) ||
156
+ member.host.findService({ type: endpoint.type }); // TODO
151
157
 
152
158
  cfg.push(` real_server ${member.address} ${memberService.port} {`);
153
159
  cfg.push(` weight ${memberService.weight}`);
154
160
 
155
- switch (service.type) {
161
+ switch (endpoint.type) {
156
162
  case "dns":
157
163
  cfg.push(` DNS_CHECK {`);
158
164
  cfg.push(" type A");
@@ -165,7 +171,7 @@ export class Cluster extends Host {
165
171
  break;
166
172
 
167
173
  default:
168
- switch (service.protocol) {
174
+ switch (endpoint.protocol) {
169
175
  case "tcp":
170
176
  cfg.push(` TCP_CHECK {`);
171
177
  cfg.push(" connect_timeout 10");
package/src/endpoint.mjs CHANGED
@@ -1,12 +1,37 @@
1
- export class Endpoint {
2
- constructor(service, networkAddress, data) {
1
+ class _Endpoint {
2
+ #port;
3
+ #type;
4
+ constructor(service, data) {
3
5
  this.service = service;
4
- this.networkAddress = networkAddress;
6
+ if (data.port) {
7
+ this.#port = data.port;
8
+ delete data.port;
9
+ }
10
+
11
+ if (data.type) {
12
+ this.#type = data.type;
13
+ delete data.type;
14
+ }
5
15
  Object.assign(this, data);
6
16
  }
7
17
 
18
+ get type() {
19
+ return this.#type ?? this.service.type;
20
+ }
21
+
22
+ get port() {
23
+ return this.#port ?? this.service._port;
24
+ }
25
+
8
26
  toString() {
9
- return `${this.address}[${this.port}]`;
27
+ return `${this.type}/${this.address}[${this.port}]`;
28
+ }
29
+ }
30
+
31
+ export class Endpoint extends _Endpoint {
32
+ constructor(service, networkAddress, data) {
33
+ super(service, data);
34
+ this.networkAddress = networkAddress;
10
35
  }
11
36
 
12
37
  get socketAddress() {
@@ -34,11 +59,10 @@ export class Endpoint {
34
59
  }
35
60
  }
36
61
 
37
- export class DomainNameEndpoint {
62
+ export class DomainNameEndpoint extends _Endpoint {
38
63
  constructor(service, domainName, data) {
39
- this.service = service;
64
+ super(service, data);
40
65
  this.domainName = domainName;
41
- Object.assign(this, data);
42
66
  }
43
67
 
44
68
  get networkInterface() {
@@ -48,17 +72,15 @@ export class DomainNameEndpoint {
48
72
  get address() {
49
73
  return this.domainName;
50
74
  }
51
-
52
- toString() {
53
- return `${this.address}[${this.port}]`;
54
- }
55
75
  }
56
76
 
57
- export class HTTPEndpoint {
77
+ export class HTTPEndpoint extends _Endpoint {
58
78
  constructor(service, url, data) {
59
- this.service = service;
79
+ super(service, data);
60
80
  this.url = url;
61
- Object.assign(this, data);
62
81
  }
63
82
 
64
- }
83
+ get address() {
84
+ return this.url;
85
+ }
86
+ }
package/src/owner.mjs CHANGED
@@ -175,10 +175,6 @@ export class Owner extends Base {
175
175
  yield* this.owner.subnets();
176
176
  }
177
177
  yield* this.typeList("subnet");
178
-
179
- /* for (const network of this.networks()) {
180
- yield* network.subnets();
181
- }*/
182
178
  }
183
179
 
184
180
  addSubnet(address) {
package/src/service.mjs CHANGED
@@ -24,7 +24,6 @@ const ServiceTypes = {
24
24
  },
25
25
  http3: {
26
26
  extends: ["https"],
27
- type: "https",
28
27
  dnsRecord: {
29
28
  type: "HTTPS",
30
29
  parameters: { "no-default-alpn": undefined, alpn: "h3" }
@@ -48,7 +47,6 @@ const ServiceTypes = {
48
47
  "dhcpv6-server": { endpoints: [{ port: 547, tls: false }] },
49
48
  smb: { endpoints: [{ protocol: "tcp", port: 445, tls: false }] },
50
49
  timemachine: {
51
- type: "adisk",
52
50
  extends: ["smb"],
53
51
  endpoints: [{ protocol: "tcp", port: 445, tls: false }],
54
52
  dnsRecord: {
@@ -68,13 +66,19 @@ function serviceTypeEndpoints(type) {
68
66
  if (st) {
69
67
  if (st.extends) {
70
68
  return st.extends.reduce(
71
- (a, c) => [...a, ...(ServiceTypes[c]?.endpoints||[])],
69
+ (a, c) => [...a, ...(ServiceTypes[c]?.endpoints || [])],
72
70
  st.endpoints || []
73
71
  );
74
72
  }
75
73
 
76
74
  return st.endpoints;
77
75
  }
76
+
77
+ return [
78
+ {
79
+ tls: false
80
+ }
81
+ ];
78
82
  }
79
83
 
80
84
  export const endpointProperties = {
@@ -96,7 +100,7 @@ export const endpointProperties = {
96
100
 
97
101
  export const EndpointTypeDefinition = {
98
102
  name: "endpoint",
99
- owners: ["service", "network-interface"],
103
+ owners: ["service", "network_interface"],
100
104
  priority: 0.4,
101
105
  specializations: {},
102
106
  properties: endpointProperties
@@ -149,6 +153,10 @@ export class Service extends Base {
149
153
  this.read(data, ServiceTypeDefinition);
150
154
  }
151
155
 
156
+ toString() {
157
+ return `${this.type}`;
158
+ }
159
+
152
160
  set extends(value) {
153
161
  this._extends.push(value);
154
162
  }
@@ -184,32 +192,16 @@ export class Service extends Base {
184
192
  }
185
193
 
186
194
  endpoints(filter) {
187
- const local =
188
- this._port === undefined
189
- ? { type: this.type }
190
- : { type: this.type, port: this._port };
191
-
192
- const data = serviceTypeEndpoints(this.type) || [
193
- {
194
- tls: false
195
- }
196
- ];
195
+ const data = serviceTypeEndpoints(this.type);
197
196
 
197
+ const l = this._port === undefined ? {} : { port: this._port };
198
198
  let result = [...this.host.networkAddresses()]
199
- .map(na =>
200
- data.map(
201
- d =>
202
- new Endpoint(this, na, {
203
- ...d,
204
- ...local
205
- })
206
- )
207
- )
199
+ .map(na => data.map(d => new Endpoint(this, na, { ...d, ...l })))
208
200
  .flat();
209
201
 
210
202
  if (result.length === 0) {
211
203
  result = data.map(
212
- d => new DomainNameEndpoint(this, this.domainName, { ...d, ...local })
204
+ d => new DomainNameEndpoint(this, this.domainName, { ...d, ...l })
213
205
  );
214
206
  }
215
207
 
@@ -229,7 +221,7 @@ export class Service extends Base {
229
221
  }
230
222
 
231
223
  get port() {
232
- return this.endpoints()[0].port;
224
+ return this._port ?? this.endpoints()[0].port;
233
225
  }
234
226
 
235
227
  set weight(value) {
@@ -264,11 +256,7 @@ export class Service extends Base {
264
256
  )) {
265
257
  records.push(
266
258
  DNSRecord(
267
- dnsFullName(
268
- `_${ServiceTypes[this.type]?.type ?? this.type}._${
269
- ep.protocol
270
- }.${domainName}`
271
- ),
259
+ dnsFullName(`_${this.type}._${ep.protocol}.${domainName}`),
272
260
  "SRV",
273
261
  this.priority ?? 10,
274
262
  this.weight,
@@ -305,7 +293,12 @@ export class Service extends Base {
305
293
  );
306
294
  } else {
307
295
  records.push(
308
- DNSRecord("@", dnsRecord.type, this.priority ?? 10, dnsFullName(domainName))
296
+ DNSRecord(
297
+ "@",
298
+ dnsRecord.type,
299
+ this.priority ?? 10,
300
+ dnsFullName(domainName)
301
+ )
309
302
  );
310
303
  }
311
304
  }
@@ -317,9 +310,9 @@ export class Service extends Base {
317
310
  export const sortByPriority = (a, b) => a.priority - b.priority;
318
311
 
319
312
  /**
320
- *
321
- * @param {*} sources
322
- * @param {Object} [options]
313
+ *
314
+ * @param {*} sources
315
+ * @param {Object} [options]
323
316
  * @param {Function} [options.services] filter for services
324
317
  * @param {Function} [options.endpoints] filter for endpoints
325
318
  * @param {Function} [options.select] mapper from Endpoint into result
@@ -54,6 +54,12 @@ const DNSServiceTypeDefinition = {
54
54
  writeable: true,
55
55
  default: false
56
56
  },
57
+ hasLocationRecord: {
58
+ type: "boolean",
59
+ collection: false,
60
+ writeable: true,
61
+ default: true
62
+ },
57
63
  excludeInterfaceKinds: {
58
64
  type: "string",
59
65
  collection: true,
@@ -107,6 +113,7 @@ export class DNSService extends ExtraSourceService {
107
113
  hasSVRRecords = true;
108
114
  hasCatalog = true;
109
115
  hasLinkLocalAdresses = true;
116
+ hasLocationRecord = true;
110
117
  notify = true;
111
118
  _trusted = [];
112
119
  _protected = [];
@@ -274,249 +281,253 @@ export class DNSService extends ExtraSourceService {
274
281
  )
275
282
  ];
276
283
 
277
- await generateZoneDefs(this, location, packageData);
284
+ await this.generateZoneDefs(location, packageData);
278
285
 
279
286
  yield packageData;
280
287
  }
281
- }
282
288
 
283
- async function generateZoneDefs(dns, location, packageData) {
284
- const ttl = dns.recordTTL;
285
- const nameService = dns.findService({ type: "dns", priority: "<10" });
286
- const rname = dns.administratorEmail.replace(/@/, ".");
289
+ async generateZoneDefs(location, packageData) {
290
+ const ttl = this.recordTTL;
291
+ const nameService = this.findService({ type: "dns", priority: "<10" });
292
+ const rname = this.administratorEmail.replace(/@/, ".");
293
+
294
+ const SOARecord = DNSRecord(
295
+ "@",
296
+ "SOA",
297
+ dnsFullName(nameService.domainName),
298
+ dnsFullName(rname),
299
+ `(${[...this.soaUpdates].join(" ")})`
300
+ );
287
301
 
288
- const SOARecord = DNSRecord(
289
- "@",
290
- "SOA",
291
- dnsFullName(nameService.domainName),
292
- dnsFullName(rname),
293
- `(${[...dns.soaUpdates].join(" ")})`
294
- );
302
+ const NSRecord = DNSRecord(
303
+ "@",
304
+ "NS",
305
+ dnsFullName(nameService.ipAddressOrDomainName)
306
+ );
295
307
 
296
- const NSRecord = DNSRecord(
297
- "@",
298
- "NS",
299
- dnsFullName(nameService.ipAddressOrDomainName)
300
- );
308
+ console.log(`${nameService}`, nameService.ipAddressOrDomainName);
301
309
 
302
- console.log(`${nameService}`, nameService.ipAddressOrDomainName);
310
+ const configs = [];
303
311
 
304
- const configs = [];
312
+ for (const host of location.hosts()) {
313
+ for (const domain of host.foreignDomainNames) {
314
+ const zone = {
315
+ id: domain,
316
+ file: `FOREIGN/${domain}.zone`,
317
+ records: new Set([SOARecord, NSRecord])
318
+ };
305
319
 
306
- for (const host of location.hosts()) {
307
- for (const domain of host.foreignDomainNames) {
308
- const zone = {
309
- id: domain,
310
- file: `FOREIGN/${domain}.zone`,
311
- records: new Set([SOARecord, NSRecord])
312
- };
313
-
314
- const config = {
315
- name: `${domain}.zone.conf`,
316
- zones: [zone]
317
- };
318
- configs.push(config);
320
+ const config = {
321
+ name: `${domain}.zone.conf`,
322
+ zones: [zone]
323
+ };
324
+ configs.push(config);
319
325
 
320
- zone.records.add(DNSRecord("location", "TXT", host.location.name));
326
+ if (this.hasLocationRecord) {
327
+ zone.records.add(DNSRecord("location", "TXT", host.location.name));
328
+ }
321
329
 
322
- for (const na of host.networkAddresses(
323
- na => na.networkInterface.kind != "loopback"
324
- )) {
325
- zone.records.add(
326
- DNSRecord("@", dnsRecordTypeForAddressFamily(na.family), na.address)
327
- );
330
+ for (const na of host.networkAddresses(
331
+ na => na.networkInterface.kind != "loopback"
332
+ )) {
333
+ zone.records.add(
334
+ DNSRecord("@", dnsRecordTypeForAddressFamily(na.family), na.address)
335
+ );
336
+ }
328
337
  }
329
338
  }
330
- }
331
339
 
332
- const foreignZones = configs.map(c => c.zones).flat();
340
+ const foreignZones = configs.map(c => c.zones).flat();
341
+
342
+ if (foreignZones.length) {
343
+ addHook(
344
+ packageData.properties.hooks,
345
+ "post_upgrade",
346
+ `rm -f ${foreignZones.map(
347
+ zone => `/var/lib/named/${zone.file}.jnl`
348
+ )}\n` +
349
+ `/usr/bin/named-hostname-info ${foreignZones
350
+ .map(zone => zone.id)
351
+ .join(" ")}|/usr/bin/named-hostname-update`
352
+ );
353
+ }
333
354
 
334
- if (foreignZones.length) {
335
- addHook(
336
- packageData.properties.hooks,
337
- "post_upgrade",
338
- `rm -f ${foreignZones.map(zone => `/var/lib/named/${zone.file}.jnl`)}\n` +
339
- `/usr/bin/named-hostname-info ${foreignZones
340
- .map(zone => zone.id)
341
- .join(" ")}|/usr/bin/named-hostname-update`
355
+ console.log(
356
+ "LOCAL DOMAINS",
357
+ location.localDomains,
358
+ location.domain,
359
+ location.toString()
342
360
  );
343
- }
344
361
 
345
- console.log(
346
- "LOCAL DOMAINS",
347
- location.localDomains,
348
- location.domain,
349
- location.toString()
350
- );
362
+ for (const domain of location.localDomains) {
363
+ const locationName = location.name;
364
+ const reverseZones = new Map();
351
365
 
352
- for (const domain of location.localDomains) {
353
- const locationName = location.name;
354
- const reverseZones = new Map();
355
-
356
- const config = {
357
- name: `${domain}.zone.conf`,
358
- zones: []
359
- };
360
- configs.push(config);
361
-
362
- const locationRecord = DNSRecord("location", "TXT", locationName);
363
-
364
- const zone = {
365
- id: domain,
366
- file: `${locationName}/${domain}.zone`,
367
- records: new Set([SOARecord, NSRecord, locationRecord])
368
- };
369
- config.zones.push(zone);
370
-
371
- if (dns.hasCatalog) {
372
- const catalogConfig = {
373
- name: `catalog.${domain}.zone.conf`,
366
+ const config = {
367
+ name: `${domain}.zone.conf`,
374
368
  zones: []
375
369
  };
376
- configs.push(catalogConfig);
377
-
378
- zone.catalogZone = {
379
- id: `catalog.${domain}`,
380
- file: `${locationName}/catalog.${domain}.zone`,
381
- records: new Set([
382
- SOARecord,
383
- NSRecord,
384
- DNSRecord(dnsFullName(`version.catalog.${domain}`), "TXT", '"1"')
385
- ])
370
+ configs.push(config);
371
+
372
+ const locationRecord = DNSRecord("location", "TXT", locationName);
373
+
374
+ const zone = {
375
+ id: domain,
376
+ file: `${locationName}/${domain}.zone`,
377
+ records: new Set([SOARecord, NSRecord, locationRecord])
386
378
  };
387
- catalogConfig.zones.push(zone.catalogZone);
388
- }
379
+ config.zones.push(zone);
380
+
381
+ if (this.hasCatalog) {
382
+ const catalogConfig = {
383
+ name: `catalog.${domain}.zone.conf`,
384
+ zones: []
385
+ };
386
+ configs.push(catalogConfig);
387
+
388
+ zone.catalogZone = {
389
+ id: `catalog.${domain}`,
390
+ file: `${locationName}/catalog.${domain}.zone`,
391
+ records: new Set([
392
+ SOARecord,
393
+ NSRecord,
394
+ DNSRecord(dnsFullName(`version.catalog.${domain}`), "TXT", '"1"')
395
+ ])
396
+ };
397
+ catalogConfig.zones.push(zone.catalogZone);
398
+ }
399
+
400
+ const hosts = new Set();
401
+ const addresses = new Set();
389
402
 
390
- const hosts = new Set();
391
- const addresses = new Set();
392
-
393
- for await (const {
394
- address,
395
- subnet,
396
- networkInterface,
397
- domainNames,
398
- family
399
- } of location.networkAddresses()) {
400
- if (
401
- !dns.exclude.has(networkInterface.network) &&
402
- !dns.excludeInterfaceKinds.has(networkInterface.kind)
403
- ) {
404
- const host = networkInterface.host;
403
+ for await (const {
404
+ address,
405
+ subnet,
406
+ networkInterface,
407
+ domainNames,
408
+ family
409
+ } of location.networkAddresses()) {
405
410
  if (
406
- !addresses.has(address) &&
407
- (dns.hasLinkLocalAdresses || !isLinkLocal(address))
411
+ !this.exclude.has(networkInterface.network) &&
412
+ !this.excludeInterfaceKinds.has(networkInterface.kind)
408
413
  ) {
409
- addresses.add(address);
410
-
411
- for (const domainName of domainNames) {
412
- zone.records.add(
413
- DNSRecord(
414
- dnsFullName(domainName),
415
- dnsRecordTypeForAddressFamily(family),
416
- address
417
- )
418
- );
419
- }
420
- if (subnet && host.domain === domain) {
421
- let reverseZone = reverseZones.get(subnet.address);
422
-
423
- if (!reverseZone) {
424
- const id = reverseArpa(subnet.prefix);
425
- reverseZone = {
426
- id,
427
- type: "plain",
428
- file: `${locationName}/${id}.zone`,
429
- records: new Set([SOARecord, NSRecord])
430
- };
431
- config.zones.push(reverseZone);
432
- reverseZones.set(subnet.address, reverseZone);
433
- }
434
-
435
- for (const domainName of host.domainNames) {
436
- reverseZone.records.add(
414
+ const host = networkInterface.host;
415
+ if (
416
+ !addresses.has(address) &&
417
+ (this.hasLinkLocalAdresses || !isLinkLocal(address))
418
+ ) {
419
+ addresses.add(address);
420
+
421
+ for (const domainName of domainNames) {
422
+ zone.records.add(
437
423
  DNSRecord(
438
- dnsFullName(reverseArpa(address)),
439
- "PTR",
440
- dnsFullName(domainName)
424
+ dnsFullName(domainName),
425
+ dnsRecordTypeForAddressFamily(family),
426
+ address
441
427
  )
442
428
  );
443
429
  }
430
+ if (subnet && host.domain === domain) {
431
+ let reverseZone = reverseZones.get(subnet.address);
432
+
433
+ if (!reverseZone) {
434
+ const id = reverseArpa(subnet.prefix);
435
+ reverseZone = {
436
+ id,
437
+ type: "plain",
438
+ file: `${locationName}/${id}.zone`,
439
+ records: new Set([SOARecord, NSRecord])
440
+ };
441
+ config.zones.push(reverseZone);
442
+ reverseZones.set(subnet.address, reverseZone);
443
+ }
444
+
445
+ for (const domainName of host.domainNames) {
446
+ reverseZone.records.add(
447
+ DNSRecord(
448
+ dnsFullName(reverseArpa(address)),
449
+ "PTR",
450
+ dnsFullName(domainName)
451
+ )
452
+ );
453
+ }
454
+ }
444
455
  }
445
- }
446
456
 
447
- if (!hosts.has(host)) {
448
- hosts.add(host);
457
+ if (!hosts.has(host)) {
458
+ hosts.add(host);
449
459
 
450
- for (const foreignDomainName of host.foreignDomainNames) {
451
- zone.records.add(
452
- DNSRecord("outfacing", "PTR", dnsFullName(foreignDomainName))
453
- );
454
- }
460
+ for (const foreignDomainName of host.foreignDomainNames) {
461
+ zone.records.add(
462
+ DNSRecord("outfacing", "PTR", dnsFullName(foreignDomainName))
463
+ );
464
+ }
455
465
 
456
- for (const service of host.findServices()) {
457
- for (const record of service.dnsRecordsForDomainName(
458
- host.domainName,
459
- dns.hasSVRRecords
460
- )) {
461
- zone.records.add(record);
466
+ for (const service of host.findServices()) {
467
+ for (const record of service.dnsRecordsForDomainName(
468
+ host.domainName,
469
+ this.hasSVRRecords
470
+ )) {
471
+ zone.records.add(record);
472
+ }
462
473
  }
463
474
  }
464
475
  }
465
476
  }
466
477
  }
467
- }
468
478
 
469
- for (const config of configs) {
470
- console.log(`config: ${config.name}`);
471
-
472
- const content = [];
473
- for (const zone of config.zones) {
474
- console.log(` file: ${zone.file}`);
475
-
476
- if (zone.catalogZone) {
477
- const hash = createHmac("md5", zone.id).digest("hex");
478
- zone.catalogZone.records.add(
479
- DNSRecord(
480
- `${hash}.zones.catalog.${zone.id}.`,
481
- "PTR",
482
- dnsFullName(zone.id)
483
- )
484
- );
485
- }
479
+ for (const config of configs) {
480
+ console.log(`config: ${config.name}`);
481
+
482
+ const content = [];
483
+ for (const zone of config.zones) {
484
+ console.log(` file: ${zone.file}`);
485
+
486
+ if (zone.catalogZone) {
487
+ const hash = createHmac("md5", zone.id).digest("hex");
488
+ zone.catalogZone.records.add(
489
+ DNSRecord(
490
+ `${hash}.zones.catalog.${zone.id}.`,
491
+ "PTR",
492
+ dnsFullName(zone.id)
493
+ )
494
+ );
495
+ }
486
496
 
487
- content.push(`zone \"${zone.id}\" {`);
488
- content.push(` type master;`);
489
- content.push(` file \"${zone.file}\";`);
497
+ content.push(`zone \"${zone.id}\" {`);
498
+ content.push(` type master;`);
499
+ content.push(` file \"${zone.file}\";`);
490
500
 
491
- content.push(
492
- ` allow-update { ${
493
- dns.allowedUpdates.length ? dns.allowedUpdates.join(";") : "none"
494
- }; };`
495
- );
496
- content.push(` notify ${dns.notify ? "yes" : "no"};`);
497
- content.push(`};`);
498
- content.push("");
499
-
500
- let maxKeyLength = 0;
501
- for (const r of zone.records) {
502
- if (r.key.length > maxKeyLength) {
503
- maxKeyLength = r.key.length;
501
+ content.push(
502
+ ` allow-update { ${
503
+ this.allowedUpdates.length ? this.allowedUpdates.join(";") : "none"
504
+ }; };`
505
+ );
506
+ content.push(` notify ${this.notify ? "yes" : "no"};`);
507
+ content.push(`};`);
508
+ content.push("");
509
+
510
+ let maxKeyLength = 0;
511
+ for (const r of zone.records) {
512
+ if (r.key.length > maxKeyLength) {
513
+ maxKeyLength = r.key.length;
514
+ }
504
515
  }
516
+
517
+ await writeLines(
518
+ join(packageData.dir, "var/lib/named"),
519
+ zone.file,
520
+ [...zone.records]
521
+ .sort(sortZoneRecords)
522
+ .map(r => r.toString(maxKeyLength, ttl))
523
+ );
505
524
  }
506
525
 
507
526
  await writeLines(
508
- join(packageData.dir, "var/lib/named"),
509
- zone.file,
510
- [...zone.records]
511
- .sort(sortZoneRecords)
512
- .map(r => r.toString(maxKeyLength, ttl))
527
+ join(packageData.dir, "etc/named/zones"),
528
+ config.name,
529
+ content
513
530
  );
514
531
  }
515
-
516
- await writeLines(
517
- join(packageData.dir, "etc/named/zones"),
518
- config.name,
519
- content
520
- );
521
532
  }
522
533
  }
@@ -1,8 +1,6 @@
1
- export class Endpoint {
1
+ export class Endpoint extends _Endpoint {
2
2
  constructor(service: any, networkAddress: any, data: any);
3
- service: any;
4
3
  networkAddress: any;
5
- toString(): string;
6
4
  get socketAddress(): string;
7
5
  get hostName(): any;
8
6
  get domainName(): any;
@@ -10,16 +8,23 @@ export class Endpoint {
10
8
  get family(): any;
11
9
  get networkInterface(): any;
12
10
  }
13
- export class DomainNameEndpoint {
11
+ export class DomainNameEndpoint extends _Endpoint {
14
12
  constructor(service: any, domainName: any, data: any);
15
- service: any;
16
13
  domainName: any;
17
14
  get networkInterface(): {};
18
15
  get address(): any;
19
- toString(): string;
20
16
  }
21
- export class HTTPEndpoint {
17
+ export class HTTPEndpoint extends _Endpoint {
22
18
  constructor(service: any, url: any, data: any);
23
- service: any;
24
19
  url: any;
20
+ get address(): any;
21
+ }
22
+ declare class _Endpoint {
23
+ constructor(service: any, data: any);
24
+ service: any;
25
+ get type(): any;
26
+ get port(): any;
27
+ toString(): string;
28
+ #private;
25
29
  }
30
+ export {};
@@ -287,6 +287,12 @@ export class DNSService extends ExtraSourceService {
287
287
  writeable: boolean;
288
288
  default: boolean;
289
289
  };
290
+ hasLocationRecord: {
291
+ type: string;
292
+ collection: boolean;
293
+ writeable: boolean;
294
+ default: boolean;
295
+ };
290
296
  excludeInterfaceKinds: {
291
297
  type: string;
292
298
  collection: boolean;
@@ -345,6 +351,7 @@ export class DNSService extends ExtraSourceService {
345
351
  hasSVRRecords: boolean;
346
352
  hasCatalog: boolean;
347
353
  hasLinkLocalAdresses: boolean;
354
+ hasLocationRecord: boolean;
348
355
  notify: boolean;
349
356
  _trusted: any[];
350
357
  _protected: any[];
@@ -377,6 +384,7 @@ export class DNSService extends ExtraSourceService {
377
384
  access: string;
378
385
  };
379
386
  }, void, unknown>;
387
+ generateZoneDefs(location: any, packageData: any): Promise<void>;
380
388
  }
381
389
  import { ExtraSourceService } from "pmcf";
382
390
  import { FileContentProvider } from "npm-pkgbuild";