pmcf 2.21.2 → 2.22.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/README.md +1 -0
- package/package.json +1 -1
- package/src/cluster.mjs +12 -8
- package/src/host.mjs +5 -6
- package/src/network-interface.mjs +29 -15
- package/src/network-support.mjs +7 -7
- package/src/service.mjs +28 -33
- package/src/services/dhcp.mjs +22 -22
- package/src/services/dns.mjs +15 -12
- package/src/services/ntp.mjs +1 -1
- package/types/cluster.d.mts +2 -2
- package/types/extra-source-service.d.mts +2 -2
- package/types/host.d.mts +4 -4
- package/types/network-interface.d.mts +27 -26
- package/types/network-support.d.mts +3 -2
- package/types/service.d.mts +10 -11
- package/types/services/dhcp.d.mts +4 -4
- package/types/services/dns.d.mts +4 -4
- package/types/services/ntp.d.mts +4 -4
package/README.md
CHANGED
|
@@ -33,6 +33,7 @@ Type: [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
|
|
|
33
33
|
|
|
34
34
|
* `networkInterface` **NetworkInterface** 
|
|
35
35
|
* `address` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [Uint16Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array))** 
|
|
36
|
+
* `family` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
36
37
|
* `subnet` **Subnet** 
|
|
37
38
|
* `domainNames` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** 
|
|
38
39
|
|
package/package.json
CHANGED
package/src/cluster.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { Owner } from "./owner.mjs";
|
|
|
4
4
|
import { Host } from "./host.mjs";
|
|
5
5
|
import { addType } from "./types.mjs";
|
|
6
6
|
import { writeLines } from "./utils.mjs";
|
|
7
|
+
import { cidrAddresses } from "./network-support.mjs";
|
|
7
8
|
|
|
8
9
|
const ClusterTypeDefinition = {
|
|
9
10
|
name: "cluster",
|
|
@@ -87,7 +88,7 @@ export class Cluster extends Host {
|
|
|
87
88
|
" notification_email {",
|
|
88
89
|
" " + this.administratorEmail,
|
|
89
90
|
" }",
|
|
90
|
-
` smtp_server ${this.smtp.
|
|
91
|
+
` smtp_server ${this.smtp.address}`,
|
|
91
92
|
` notification_email_from keepalived@${host.domainName}`,
|
|
92
93
|
" enable_script_security",
|
|
93
94
|
" script_user root",
|
|
@@ -102,10 +103,15 @@ export class Cluster extends Host {
|
|
|
102
103
|
cfg.push(`vrrp_instance ${cluster.name} {`);
|
|
103
104
|
cfg.push(` state ${cluster.masters.has(ni) ? "MASTER" : "BACKUP"}`);
|
|
104
105
|
cfg.push(` interface ${ni.name}`);
|
|
106
|
+
|
|
105
107
|
cfg.push(" virtual_ipaddress {");
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
)
|
|
108
|
+
for (const na of cluster.networkAddresses(
|
|
109
|
+
na => na.networkInterface.kind !== "loopback"
|
|
110
|
+
)) {
|
|
111
|
+
cfg.push(
|
|
112
|
+
` ${na.cidrAddress} dev ${ni.name} label ${cluster.name}`
|
|
113
|
+
);
|
|
114
|
+
}
|
|
109
115
|
cfg.push(" }");
|
|
110
116
|
cfg.push(` virtual_router_id ${cluster.routerId}`);
|
|
111
117
|
cfg.push(
|
|
@@ -132,7 +138,7 @@ export class Cluster extends Host {
|
|
|
132
138
|
cfg.push("");
|
|
133
139
|
|
|
134
140
|
for (const service of cluster.findServices({ type: "http" })) {
|
|
135
|
-
cfg.push(`virtual_server ${cluster.
|
|
141
|
+
cfg.push(`virtual_server ${cluster.address} ${service.port} {`);
|
|
136
142
|
cfg.push(` delay_loop ${cluster.checkInterval}`);
|
|
137
143
|
cfg.push(" lb_algo wlc");
|
|
138
144
|
cfg.push(" persistence_timeout 600");
|
|
@@ -141,9 +147,7 @@ export class Cluster extends Host {
|
|
|
141
147
|
for (const member of this.members) {
|
|
142
148
|
const memberService = member.findService({ type: service.type });
|
|
143
149
|
|
|
144
|
-
cfg.push(
|
|
145
|
-
` real_server ${member.rawAddress} ${memberService.port} {`
|
|
146
|
-
);
|
|
150
|
+
cfg.push(` real_server ${member.address} ${memberService.port} {`);
|
|
147
151
|
cfg.push(` weight ${memberService.weight}`);
|
|
148
152
|
|
|
149
153
|
switch (service.type) {
|
package/src/host.mjs
CHANGED
|
@@ -1,9 +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 { formatCIDR } from "ip-utilties";
|
|
5
4
|
import { Base } from "./base.mjs";
|
|
6
|
-
import { networkAddressProperties } from "./network-support.mjs";
|
|
5
|
+
import { networkAddressProperties, addresses } from "./network-support.mjs";
|
|
7
6
|
import { domainFromDominName, domainName } from "./utils.mjs";
|
|
8
7
|
import { objectFilter } from "./filter.mjs";
|
|
9
8
|
import { addType, types } from "./types.mjs";
|
|
@@ -427,12 +426,12 @@ export class Host extends Base {
|
|
|
427
426
|
}
|
|
428
427
|
}
|
|
429
428
|
|
|
430
|
-
get
|
|
431
|
-
return this.
|
|
429
|
+
get address() {
|
|
430
|
+
return this.addresses[0];
|
|
432
431
|
}
|
|
433
432
|
|
|
434
|
-
get
|
|
435
|
-
return
|
|
433
|
+
get addresses() {
|
|
434
|
+
return addresses(this.networkAddresses());
|
|
436
435
|
}
|
|
437
436
|
|
|
438
437
|
async publicKey(type = "ed25519") {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
isIPv4,
|
|
3
|
-
isIPv6,
|
|
4
|
-
formatCIDR,
|
|
5
2
|
hasWellKnownSubnet,
|
|
6
3
|
normalizeIP,
|
|
7
|
-
familyIP
|
|
4
|
+
familyIP,
|
|
5
|
+
formatCIDR
|
|
8
6
|
} from "ip-utilties";
|
|
9
7
|
import { Base } from "./base.mjs";
|
|
10
8
|
import { Subnet } from "./subnet.mjs";
|
|
@@ -16,13 +14,35 @@ import { asArray } from "./utils.mjs";
|
|
|
16
14
|
import { addType } from "./types.mjs";
|
|
17
15
|
|
|
18
16
|
/**
|
|
19
|
-
* @typedef {object} NetworkAddress
|
|
20
17
|
* @property {NetworkInterface} networkInterface
|
|
21
18
|
* @property {string|Uint8Array|Uint16Array} address
|
|
22
19
|
* @property {string} family
|
|
23
20
|
* @property {Subnet} subnet
|
|
24
21
|
* @property {Set<string>} domainNames
|
|
25
22
|
*/
|
|
23
|
+
export class NetworkAddress {
|
|
24
|
+
/** @type {Subnet} */ subnet;
|
|
25
|
+
/** @type {NetworkInterface} */ networkInterface;
|
|
26
|
+
/** @type {string|Uint8Array|Uint16Array} */ address;
|
|
27
|
+
|
|
28
|
+
constructor(networkInterface, address, subnet) {
|
|
29
|
+
this.networkInterface = networkInterface;
|
|
30
|
+
this.address = address;
|
|
31
|
+
this.subnet = subnet;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get domainNames() {
|
|
35
|
+
this.networkInterface.domainNames;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get family() {
|
|
39
|
+
return familyIP(this.address);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
get cidrAddress() {
|
|
43
|
+
return formatCIDR(this.address, this.subnet.prefixLength);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
26
46
|
|
|
27
47
|
class SkeletonNetworkInterface extends Base {
|
|
28
48
|
_extends = [];
|
|
@@ -80,13 +100,7 @@ class SkeletonNetworkInterface extends Base {
|
|
|
80
100
|
*/
|
|
81
101
|
*networkAddresses(filter = n => true) {
|
|
82
102
|
for (const [address, subnet] of this.ipAddresses) {
|
|
83
|
-
const networkAddress =
|
|
84
|
-
networkInterface: this,
|
|
85
|
-
domainNames: this.domainNames,
|
|
86
|
-
address,
|
|
87
|
-
family: familyIP(address),
|
|
88
|
-
subnet
|
|
89
|
-
};
|
|
103
|
+
const networkAddress = new NetworkAddress(this, address, subnet);
|
|
90
104
|
|
|
91
105
|
if (filter(networkAddress)) {
|
|
92
106
|
yield networkAddress;
|
|
@@ -100,11 +114,11 @@ class SkeletonNetworkInterface extends Base {
|
|
|
100
114
|
}
|
|
101
115
|
}
|
|
102
116
|
|
|
103
|
-
get
|
|
104
|
-
return this.
|
|
117
|
+
get address() {
|
|
118
|
+
return this.addresses[0];
|
|
105
119
|
}
|
|
106
120
|
|
|
107
|
-
get
|
|
121
|
+
get addresses() {
|
|
108
122
|
return [...this.ipAddresses].map(([address]) => address);
|
|
109
123
|
}
|
|
110
124
|
}
|
package/src/network-support.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { formatCIDR } from "ip-utilties";
|
|
2
|
-
|
|
3
1
|
export const networkProperties = {
|
|
4
2
|
scope: {
|
|
5
3
|
type: "string",
|
|
@@ -37,12 +35,14 @@ export const networkAddressProperties = {
|
|
|
37
35
|
hostName: { type: "string", collection: false, writeable: true },
|
|
38
36
|
cidrAddresses: { type: "string", collection: true, writeable: false },
|
|
39
37
|
cidrAddress: { type: "string", collection: false, writeable: false },
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
addresses: { type: "string", collection: true, writeable: false },
|
|
39
|
+
address: { type: "string", collection: false, writeable: false }
|
|
42
40
|
};
|
|
43
41
|
|
|
42
|
+
export function addresses(networkAddresses) {
|
|
43
|
+
return [...networkAddresses].map(na => na.address);
|
|
44
|
+
}
|
|
45
|
+
|
|
44
46
|
export function cidrAddresses(networkAddresses) {
|
|
45
|
-
return [...networkAddresses].map(na =>
|
|
46
|
-
formatCIDR(na.address, na.subnet.prefixLength)
|
|
47
|
-
);
|
|
47
|
+
return [...networkAddresses].map(na => na.cidrAddress);
|
|
48
48
|
}
|
package/src/service.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { isLocalhost } from "ip-utilties";
|
|
1
|
+
import { isLocalhost, familyIP } from "ip-utilties";
|
|
2
2
|
import { Base } from "./base.mjs";
|
|
3
3
|
import { addType } from "./types.mjs";
|
|
4
|
-
import { objectFilter } from "./filter.mjs";
|
|
5
4
|
import { asArray } from "./utils.mjs";
|
|
6
5
|
import { networkAddressProperties } from "./network-support.mjs";
|
|
7
6
|
import {
|
|
@@ -158,15 +157,15 @@ export class Service extends Base {
|
|
|
158
157
|
}
|
|
159
158
|
|
|
160
159
|
get ipAddressOrDomainName() {
|
|
161
|
-
return this.
|
|
160
|
+
return this.address ?? this.domainName;
|
|
162
161
|
}
|
|
163
162
|
|
|
164
|
-
get
|
|
165
|
-
return this._ipAddresses ?? this.owner.
|
|
163
|
+
get addresses() {
|
|
164
|
+
return this._ipAddresses ?? this.owner.addresses;
|
|
166
165
|
}
|
|
167
166
|
|
|
168
|
-
get
|
|
169
|
-
return this._ipAddresses?.[0] ?? this.server.
|
|
167
|
+
get address() {
|
|
168
|
+
return this._ipAddresses?.[0] ?? this.server.address;
|
|
170
169
|
}
|
|
171
170
|
|
|
172
171
|
set ipAddresses(value) {
|
|
@@ -177,7 +176,7 @@ export class Service extends Base {
|
|
|
177
176
|
return this.server.networks;
|
|
178
177
|
}
|
|
179
178
|
|
|
180
|
-
|
|
179
|
+
endpoints(filter) {
|
|
181
180
|
const local =
|
|
182
181
|
this._port === undefined
|
|
183
182
|
? { type: this.type }
|
|
@@ -189,22 +188,20 @@ export class Service extends Base {
|
|
|
189
188
|
}
|
|
190
189
|
];
|
|
191
190
|
|
|
192
|
-
|
|
191
|
+
const result = [...this.server.networkAddresses()]
|
|
193
192
|
.map(sa =>
|
|
194
193
|
data.map(
|
|
195
194
|
d =>
|
|
196
195
|
new Endpoint(this, sa.networkInterface, {
|
|
197
196
|
...d,
|
|
198
|
-
|
|
197
|
+
address: sa.address,
|
|
199
198
|
...local
|
|
200
199
|
})
|
|
201
200
|
)
|
|
202
201
|
)
|
|
203
202
|
.flat();
|
|
204
|
-
}
|
|
205
203
|
|
|
206
|
-
|
|
207
|
-
yield* objectFilter(EndpointTypeDefinition, this.endpoints, filter);
|
|
204
|
+
return filter ? result.filter(filter) : result;
|
|
208
205
|
}
|
|
209
206
|
|
|
210
207
|
set alias(value) {
|
|
@@ -220,15 +217,15 @@ export class Service extends Base {
|
|
|
220
217
|
}
|
|
221
218
|
|
|
222
219
|
get port() {
|
|
223
|
-
return this.endpoints[0].port;
|
|
220
|
+
return this.endpoints()[0].port;
|
|
224
221
|
}
|
|
225
222
|
|
|
226
223
|
get protocol() {
|
|
227
|
-
return this.endpoints[0].protocol;
|
|
224
|
+
return this.endpoints()[0].protocol;
|
|
228
225
|
}
|
|
229
226
|
|
|
230
227
|
get tls() {
|
|
231
|
-
return this.endpoints[0].tls;
|
|
228
|
+
return this.endpoints()[0].tls;
|
|
232
229
|
}
|
|
233
230
|
|
|
234
231
|
set weight(value) {
|
|
@@ -258,8 +255,8 @@ export class Service extends Base {
|
|
|
258
255
|
}
|
|
259
256
|
|
|
260
257
|
if (hasSVRRecords) {
|
|
261
|
-
for (const ep of this.endpoints
|
|
262
|
-
e => e.protocol && e.networkInterface.
|
|
258
|
+
for (const ep of this.endpoints(
|
|
259
|
+
e => e.protocol && e.networkInterface.kind !== "loopback"
|
|
263
260
|
)) {
|
|
264
261
|
records.push(
|
|
265
262
|
DNSRecord(
|
|
@@ -321,11 +318,10 @@ export class Endpoint {
|
|
|
321
318
|
}
|
|
322
319
|
|
|
323
320
|
toString() {
|
|
324
|
-
return `${this.
|
|
321
|
+
return `${this.address}[${this.port}]`;
|
|
325
322
|
}
|
|
326
323
|
|
|
327
|
-
get socketAddress()
|
|
328
|
-
{
|
|
324
|
+
get socketAddress() {
|
|
329
325
|
return `${this.address}:${this.port}`;
|
|
330
326
|
}
|
|
331
327
|
|
|
@@ -333,19 +329,18 @@ export class Endpoint {
|
|
|
333
329
|
return this.networkInterface.hostName;
|
|
334
330
|
}
|
|
335
331
|
|
|
336
|
-
#
|
|
332
|
+
#address;
|
|
337
333
|
|
|
338
|
-
get address()
|
|
339
|
-
|
|
340
|
-
return this.#rawAddress ?? this.networkInterface.rawAddress;
|
|
334
|
+
get address() {
|
|
335
|
+
return this.#address ?? this.networkInterface.address;
|
|
341
336
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
337
|
+
|
|
338
|
+
set address(value) {
|
|
339
|
+
this.#address = value;
|
|
345
340
|
}
|
|
346
341
|
|
|
347
|
-
|
|
348
|
-
this
|
|
342
|
+
get family() {
|
|
343
|
+
return familyIP(this.address);
|
|
349
344
|
}
|
|
350
345
|
}
|
|
351
346
|
|
|
@@ -354,7 +349,7 @@ export const sortByPriority = (a, b) => a.priority - b.priority;
|
|
|
354
349
|
export function serviceAddresses(
|
|
355
350
|
sources,
|
|
356
351
|
filter,
|
|
357
|
-
addressType = "
|
|
352
|
+
addressType = "addresses",
|
|
358
353
|
addressFilter = a => !isLocalhost(a)
|
|
359
354
|
) {
|
|
360
355
|
return asArray(sources)
|
|
@@ -366,11 +361,11 @@ export function serviceAddresses(
|
|
|
366
361
|
.filter(addressFilter);
|
|
367
362
|
}
|
|
368
363
|
|
|
369
|
-
export function serviceEndpoints(sources, filter) {
|
|
364
|
+
export function serviceEndpoints(sources, filter, endpointFilter) {
|
|
370
365
|
return asArray(sources)
|
|
371
366
|
.map(ft => Array.from(ft.findServices(filter)))
|
|
372
367
|
.flat()
|
|
373
368
|
.sort(sortByPriority)
|
|
374
|
-
.map(service => service.endpoints)
|
|
369
|
+
.map(service => service.endpoints(endpointFilter))
|
|
375
370
|
.flat();
|
|
376
371
|
}
|
package/src/services/dhcp.mjs
CHANGED
|
@@ -20,7 +20,7 @@ const DHCPServiceTypeDefinition = {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
const controlAgentEndpoint = {
|
|
23
|
-
|
|
23
|
+
// extends: ["http"],
|
|
24
24
|
type: "kea-control-agent",
|
|
25
25
|
port: 8000,
|
|
26
26
|
protocol: "tcp",
|
|
@@ -52,18 +52,18 @@ export class DHCPService extends Service {
|
|
|
52
52
|
return DHCPServiceTypeDefinition.name;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
endpoints(filter) {
|
|
56
56
|
const l0 = this.server.findNetworkInterface({ scope: "host" });
|
|
57
57
|
|
|
58
58
|
if (l0) {
|
|
59
59
|
return [
|
|
60
|
-
...super.endpoints,
|
|
60
|
+
...super.endpoints(filter),
|
|
61
61
|
new Endpoint(this, l0, controlAgentEndpoint),
|
|
62
62
|
new Endpoint(this, l0, ddnsEndpoint)
|
|
63
63
|
];
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
return super.endpoints;
|
|
66
|
+
return super.endpoints(filter);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
async *preparePackages(dir) {
|
|
@@ -147,9 +147,9 @@ export class DHCPService extends Service {
|
|
|
147
147
|
return {
|
|
148
148
|
name: domain,
|
|
149
149
|
"dns-servers": dnsServerEndpoints
|
|
150
|
-
.filter(endpoint => isIPv4(endpoint.
|
|
150
|
+
.filter(endpoint => isIPv4(endpoint.address))
|
|
151
151
|
.map(endpoint => {
|
|
152
|
-
return { "ip-address": endpoint.
|
|
152
|
+
return { "ip-address": endpoint.address };
|
|
153
153
|
})
|
|
154
154
|
};
|
|
155
155
|
});
|
|
@@ -209,23 +209,23 @@ export class DHCPService extends Service {
|
|
|
209
209
|
.map(([k, networkInterface]) => {
|
|
210
210
|
return {
|
|
211
211
|
"hw-address": k,
|
|
212
|
-
"ip-address": networkInterface.networkAddress(
|
|
212
|
+
"ip-address": networkInterface.networkAddress(
|
|
213
|
+
n => n.family === "IPv4"
|
|
214
|
+
).address,
|
|
213
215
|
hostname: networkInterface.hostName
|
|
214
216
|
};
|
|
215
217
|
})
|
|
216
218
|
.sort((a, b) => a.hostname.localeCompare(b.hostname));
|
|
217
219
|
|
|
218
220
|
const listenInterfaces = filter =>
|
|
219
|
-
this.endpoints
|
|
220
|
-
|
|
221
|
-
endpoint
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
endpoint => `${endpoint.networkInterface.name}/${endpoint.rawAddress}`
|
|
228
|
-
);
|
|
221
|
+
this.endpoints(
|
|
222
|
+
endpoint =>
|
|
223
|
+
endpoint.type === "dhcp" &&
|
|
224
|
+
filter(endpoint.address) &&
|
|
225
|
+
endpoint.networkInterface.kind !== "loopback"
|
|
226
|
+
).map(
|
|
227
|
+
endpoint => `${endpoint.networkInterface.name}/${endpoint.address}`
|
|
228
|
+
);
|
|
229
229
|
|
|
230
230
|
const dhcp4 = {
|
|
231
231
|
Dhcp4: {
|
|
@@ -244,8 +244,8 @@ export class DHCPService extends Service {
|
|
|
244
244
|
{
|
|
245
245
|
name: "domain-name-servers",
|
|
246
246
|
data: dnsServerEndpoints
|
|
247
|
-
.filter(endpoint => isIPv4(endpoint.
|
|
248
|
-
.map(endpoint => endpoint.
|
|
247
|
+
.filter(endpoint => isIPv4(endpoint.address))
|
|
248
|
+
.map(endpoint => endpoint.address)
|
|
249
249
|
.join(",")
|
|
250
250
|
},
|
|
251
251
|
{
|
|
@@ -263,7 +263,7 @@ export class DHCPService extends Service {
|
|
|
263
263
|
"option-data": [
|
|
264
264
|
{
|
|
265
265
|
name: "routers",
|
|
266
|
-
data: network.gateway.
|
|
266
|
+
data: network.gateway.address
|
|
267
267
|
}
|
|
268
268
|
],
|
|
269
269
|
reservations
|
|
@@ -288,8 +288,8 @@ export class DHCPService extends Service {
|
|
|
288
288
|
{
|
|
289
289
|
name: "dns-servers",
|
|
290
290
|
data: dnsServerEndpoints
|
|
291
|
-
.filter(endpoint => isIPv6(endpoint.
|
|
292
|
-
.map(endpoint => endpoint.
|
|
291
|
+
.filter(endpoint => isIPv6(endpoint.address))
|
|
292
|
+
.map(endpoint => endpoint.address)
|
|
293
293
|
.join(",")
|
|
294
294
|
}
|
|
295
295
|
],
|
package/src/services/dns.mjs
CHANGED
|
@@ -295,12 +295,12 @@ async function generateZoneDefs(dns, location, packageData) {
|
|
|
295
295
|
|
|
296
296
|
zone.records.add(DNSRecord("location", "TXT", host.location.name));
|
|
297
297
|
|
|
298
|
-
for (const
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
)
|
|
303
|
-
|
|
298
|
+
for (const na of host.networkAddresses(
|
|
299
|
+
na => na.networkInterface.kind != "loopback"
|
|
300
|
+
)) {
|
|
301
|
+
zone.records.add(
|
|
302
|
+
DNSRecord("@", na.family === "IPv6" ? "AAAA" : "A", na.address)
|
|
303
|
+
);
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
}
|
|
@@ -311,11 +311,11 @@ async function generateZoneDefs(dns, location, packageData) {
|
|
|
311
311
|
addHook(
|
|
312
312
|
packageData.properties.hooks,
|
|
313
313
|
"post_upgrade",
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
314
|
+
// `rm -f ${foreignZones.map(zone => `/var/lib/named/${zone.file}.jnl`)}\n` +
|
|
315
|
+
// "systemctl try-reload-or-restart named\n" +
|
|
316
|
+
`/usr/bin/named-hostname-info ${foreignZones
|
|
317
|
+
.map(zone => zone.id)
|
|
318
|
+
.join(" ")}|/usr/bin/named-hostname-update`
|
|
319
319
|
);
|
|
320
320
|
}
|
|
321
321
|
|
|
@@ -366,7 +366,10 @@ async function generateZoneDefs(dns, location, packageData) {
|
|
|
366
366
|
networkInterface,
|
|
367
367
|
domainNames
|
|
368
368
|
} of location.networkAddresses()) {
|
|
369
|
-
if (
|
|
369
|
+
if (
|
|
370
|
+
!dns.exclude.has(networkInterface.network) &&
|
|
371
|
+
!dns.excludeInterfaceKinds.has(networkInterface.kind)
|
|
372
|
+
) {
|
|
370
373
|
const host = networkInterface.host;
|
|
371
374
|
if (
|
|
372
375
|
!addresses.has(address) &&
|
package/src/services/ntp.mjs
CHANGED
package/types/cluster.d.mts
CHANGED
|
@@ -294,12 +294,12 @@ export class Cluster extends Host {
|
|
|
294
294
|
collection: boolean;
|
|
295
295
|
writeable: boolean;
|
|
296
296
|
};
|
|
297
|
-
|
|
297
|
+
addresses: {
|
|
298
298
|
type: string;
|
|
299
299
|
collection: boolean;
|
|
300
300
|
writeable: boolean;
|
|
301
301
|
};
|
|
302
|
-
|
|
302
|
+
address: {
|
|
303
303
|
type: string;
|
|
304
304
|
collection: boolean;
|
|
305
305
|
writeable: boolean;
|
|
@@ -127,12 +127,12 @@ export class ExtraSourceService extends Service {
|
|
|
127
127
|
collection: boolean;
|
|
128
128
|
writeable: boolean;
|
|
129
129
|
};
|
|
130
|
-
|
|
130
|
+
addresses: {
|
|
131
131
|
type: string;
|
|
132
132
|
collection: boolean;
|
|
133
133
|
writeable: boolean;
|
|
134
134
|
};
|
|
135
|
-
|
|
135
|
+
address: {
|
|
136
136
|
type: string;
|
|
137
137
|
collection: boolean;
|
|
138
138
|
writeable: boolean;
|
package/types/host.d.mts
CHANGED
|
@@ -159,12 +159,12 @@ export class Host extends Base {
|
|
|
159
159
|
collection: boolean;
|
|
160
160
|
writeable: boolean;
|
|
161
161
|
};
|
|
162
|
-
|
|
162
|
+
addresses: {
|
|
163
163
|
type: string;
|
|
164
164
|
collection: boolean;
|
|
165
165
|
writeable: boolean;
|
|
166
166
|
};
|
|
167
|
-
|
|
167
|
+
address: {
|
|
168
168
|
type: string;
|
|
169
169
|
collection: boolean;
|
|
170
170
|
writeable: boolean;
|
|
@@ -233,8 +233,8 @@ export class Host extends Base {
|
|
|
233
233
|
set networkInterfaces(networkInterface: Map<any, any>);
|
|
234
234
|
get networkInterfaces(): Map<any, any>;
|
|
235
235
|
networkAddresses(filter: any): Generator<any, void, any>;
|
|
236
|
-
get
|
|
237
|
-
get
|
|
236
|
+
get address(): any;
|
|
237
|
+
get addresses(): any[];
|
|
238
238
|
publicKey(type?: string): Promise<string>;
|
|
239
239
|
preparePackages(dir: any): AsyncGenerator<{
|
|
240
240
|
dir: any;
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @property {NetworkInterface} networkInterface
|
|
3
|
+
* @property {string|Uint8Array|Uint16Array} address
|
|
4
|
+
* @property {string} family
|
|
5
|
+
* @property {Subnet} subnet
|
|
6
|
+
* @property {Set<string>} domainNames
|
|
7
|
+
*/
|
|
8
|
+
export class NetworkAddress {
|
|
9
|
+
constructor(networkInterface: any, address: any, subnet: any);
|
|
10
|
+
/** @type {Subnet} */ subnet: Subnet;
|
|
11
|
+
/** @type {NetworkInterface} */ networkInterface: NetworkInterface;
|
|
12
|
+
/** @type {string|Uint8Array|Uint16Array} */ address: string | Uint8Array | Uint16Array;
|
|
13
|
+
get domainNames(): void;
|
|
14
|
+
get family(): any;
|
|
15
|
+
get cidrAddress(): any;
|
|
16
|
+
}
|
|
1
17
|
export namespace NetworkInterfaceTypeDefinition {
|
|
2
18
|
export let name: string;
|
|
3
19
|
export let priority: number;
|
|
@@ -93,12 +109,12 @@ export namespace NetworkInterfaceTypeDefinition {
|
|
|
93
109
|
collection: boolean;
|
|
94
110
|
writeable: boolean;
|
|
95
111
|
};
|
|
96
|
-
|
|
112
|
+
addresses: {
|
|
97
113
|
type: string;
|
|
98
114
|
collection: boolean;
|
|
99
115
|
writeable: boolean;
|
|
100
116
|
};
|
|
101
|
-
|
|
117
|
+
address: {
|
|
102
118
|
type: string;
|
|
103
119
|
collection: boolean;
|
|
104
120
|
writeable: boolean;
|
|
@@ -252,12 +268,12 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
252
268
|
collection: boolean;
|
|
253
269
|
writeable: boolean;
|
|
254
270
|
};
|
|
255
|
-
|
|
271
|
+
addresses: {
|
|
256
272
|
type: string;
|
|
257
273
|
collection: boolean;
|
|
258
274
|
writeable: boolean;
|
|
259
275
|
};
|
|
260
|
-
|
|
276
|
+
address: {
|
|
261
277
|
type: string;
|
|
262
278
|
collection: boolean;
|
|
263
279
|
writeable: boolean;
|
|
@@ -450,12 +466,12 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
|
|
|
450
466
|
collection: boolean;
|
|
451
467
|
writeable: boolean;
|
|
452
468
|
};
|
|
453
|
-
|
|
469
|
+
addresses: {
|
|
454
470
|
type: string;
|
|
455
471
|
collection: boolean;
|
|
456
472
|
writeable: boolean;
|
|
457
473
|
};
|
|
458
|
-
|
|
474
|
+
address: {
|
|
459
475
|
type: string;
|
|
460
476
|
collection: boolean;
|
|
461
477
|
writeable: boolean;
|
|
@@ -609,12 +625,12 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
|
|
|
609
625
|
collection: boolean;
|
|
610
626
|
writeable: boolean;
|
|
611
627
|
};
|
|
612
|
-
|
|
628
|
+
addresses: {
|
|
613
629
|
type: string;
|
|
614
630
|
collection: boolean;
|
|
615
631
|
writeable: boolean;
|
|
616
632
|
};
|
|
617
|
-
|
|
633
|
+
address: {
|
|
618
634
|
type: string;
|
|
619
635
|
collection: boolean;
|
|
620
636
|
writeable: boolean;
|
|
@@ -685,21 +701,7 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
|
|
|
685
701
|
prefixLength: number;
|
|
686
702
|
}>;
|
|
687
703
|
}
|
|
688
|
-
|
|
689
|
-
networkInterface: NetworkInterface;
|
|
690
|
-
address: string | Uint8Array | Uint16Array;
|
|
691
|
-
family: string;
|
|
692
|
-
subnet: Subnet;
|
|
693
|
-
domainNames: Set<string>;
|
|
694
|
-
};
|
|
695
|
-
/**
|
|
696
|
-
* @typedef {object} NetworkAddress
|
|
697
|
-
* @property {NetworkInterface} networkInterface
|
|
698
|
-
* @property {string|Uint8Array|Uint16Array} address
|
|
699
|
-
* @property {string} family
|
|
700
|
-
* @property {Subnet} subnet
|
|
701
|
-
* @property {Set<string>} domainNames
|
|
702
|
-
*/
|
|
704
|
+
import { Subnet } from "./subnet.mjs";
|
|
703
705
|
declare class SkeletonNetworkInterface extends Base {
|
|
704
706
|
_extends: any[];
|
|
705
707
|
_network: any;
|
|
@@ -718,9 +720,8 @@ declare class SkeletonNetworkInterface extends Base {
|
|
|
718
720
|
*/
|
|
719
721
|
networkAddresses(filter?: object): Iterable<NetworkAddress>;
|
|
720
722
|
networkAddress(filter: any): NetworkAddress;
|
|
721
|
-
get
|
|
722
|
-
get
|
|
723
|
+
get address(): any;
|
|
724
|
+
get addresses(): any[];
|
|
723
725
|
}
|
|
724
|
-
import { Subnet } from "./subnet.mjs";
|
|
725
726
|
import { Base } from "./base.mjs";
|
|
726
727
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export function addresses(networkAddresses: any): any[];
|
|
1
2
|
export function cidrAddresses(networkAddresses: any): any[];
|
|
2
3
|
export namespace networkProperties {
|
|
3
4
|
export namespace scope {
|
|
@@ -109,7 +110,7 @@ export namespace networkAddressProperties {
|
|
|
109
110
|
let writeable_11: boolean;
|
|
110
111
|
export { writeable_11 as writeable };
|
|
111
112
|
}
|
|
112
|
-
namespace
|
|
113
|
+
namespace addresses {
|
|
113
114
|
let type_12: string;
|
|
114
115
|
export { type_12 as type };
|
|
115
116
|
let collection_12: boolean;
|
|
@@ -117,7 +118,7 @@ export namespace networkAddressProperties {
|
|
|
117
118
|
let writeable_12: boolean;
|
|
118
119
|
export { writeable_12 as writeable };
|
|
119
120
|
}
|
|
120
|
-
namespace
|
|
121
|
+
namespace address {
|
|
121
122
|
let type_13: string;
|
|
122
123
|
export { type_13 as type };
|
|
123
124
|
let collection_13: boolean;
|
package/types/service.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function serviceAddresses(sources: any, filter: any, addressType?: string, addressFilter?: (a: any) => boolean): any[];
|
|
2
|
-
export function serviceEndpoints(sources: any, filter: any): any[];
|
|
2
|
+
export function serviceEndpoints(sources: any, filter: any, endpointFilter: any): any[];
|
|
3
3
|
export namespace endpointProperties {
|
|
4
4
|
export namespace port {
|
|
5
5
|
let type: string;
|
|
@@ -159,12 +159,12 @@ export namespace ServiceTypeDefinition {
|
|
|
159
159
|
collection: boolean;
|
|
160
160
|
writeable: boolean;
|
|
161
161
|
};
|
|
162
|
-
|
|
162
|
+
addresses: {
|
|
163
163
|
type: string;
|
|
164
164
|
collection: boolean;
|
|
165
165
|
writeable: boolean;
|
|
166
166
|
};
|
|
167
|
-
|
|
167
|
+
address: {
|
|
168
168
|
type: string;
|
|
169
169
|
collection: boolean;
|
|
170
170
|
writeable: boolean;
|
|
@@ -284,12 +284,12 @@ export class Service extends Base {
|
|
|
284
284
|
collection: boolean;
|
|
285
285
|
writeable: boolean;
|
|
286
286
|
};
|
|
287
|
-
|
|
287
|
+
addresses: {
|
|
288
288
|
type: string;
|
|
289
289
|
collection: boolean;
|
|
290
290
|
writeable: boolean;
|
|
291
291
|
};
|
|
292
|
-
|
|
292
|
+
address: {
|
|
293
293
|
type: string;
|
|
294
294
|
collection: boolean;
|
|
295
295
|
writeable: boolean;
|
|
@@ -308,12 +308,11 @@ export class Service extends Base {
|
|
|
308
308
|
get server(): any;
|
|
309
309
|
get domainName(): any;
|
|
310
310
|
get ipAddressOrDomainName(): any;
|
|
311
|
-
get
|
|
312
|
-
get
|
|
311
|
+
get addresses(): any;
|
|
312
|
+
get address(): any;
|
|
313
313
|
set ipAddresses(value: any);
|
|
314
314
|
get networks(): any;
|
|
315
|
-
|
|
316
|
-
findEndpoints(filter: any): Generator<any, void, any>;
|
|
315
|
+
endpoints(filter: any): any[];
|
|
317
316
|
set alias(value: any);
|
|
318
317
|
get alias(): any;
|
|
319
318
|
set port(value: any);
|
|
@@ -337,9 +336,9 @@ export class Endpoint {
|
|
|
337
336
|
toString(): string;
|
|
338
337
|
get socketAddress(): string;
|
|
339
338
|
get hostName(): any;
|
|
339
|
+
set address(value: any);
|
|
340
340
|
get address(): any;
|
|
341
|
-
|
|
342
|
-
get rawAddress(): any;
|
|
341
|
+
get family(): any;
|
|
343
342
|
#private;
|
|
344
343
|
}
|
|
345
344
|
export function sortByPriority(a: any, b: any): number;
|
|
@@ -113,12 +113,12 @@ export class DHCPService extends Service {
|
|
|
113
113
|
collection: boolean;
|
|
114
114
|
writeable: boolean;
|
|
115
115
|
};
|
|
116
|
-
|
|
116
|
+
addresses: {
|
|
117
117
|
type: string;
|
|
118
118
|
collection: boolean;
|
|
119
119
|
writeable: boolean;
|
|
120
120
|
};
|
|
121
|
-
|
|
121
|
+
address: {
|
|
122
122
|
type: string;
|
|
123
123
|
collection: boolean;
|
|
124
124
|
writeable: boolean;
|
|
@@ -238,12 +238,12 @@ export class DHCPService extends Service {
|
|
|
238
238
|
collection: boolean;
|
|
239
239
|
writeable: boolean;
|
|
240
240
|
};
|
|
241
|
-
|
|
241
|
+
addresses: {
|
|
242
242
|
type: string;
|
|
243
243
|
collection: boolean;
|
|
244
244
|
writeable: boolean;
|
|
245
245
|
};
|
|
246
|
-
|
|
246
|
+
address: {
|
|
247
247
|
type: string;
|
|
248
248
|
collection: boolean;
|
|
249
249
|
writeable: boolean;
|
package/types/services/dns.d.mts
CHANGED
|
@@ -113,12 +113,12 @@ export class DNSService extends ExtraSourceService {
|
|
|
113
113
|
collection: boolean;
|
|
114
114
|
writeable: boolean;
|
|
115
115
|
};
|
|
116
|
-
|
|
116
|
+
addresses: {
|
|
117
117
|
type: string;
|
|
118
118
|
collection: boolean;
|
|
119
119
|
writeable: boolean;
|
|
120
120
|
};
|
|
121
|
-
|
|
121
|
+
address: {
|
|
122
122
|
type: string;
|
|
123
123
|
collection: boolean;
|
|
124
124
|
writeable: boolean;
|
|
@@ -241,12 +241,12 @@ export class DNSService extends ExtraSourceService {
|
|
|
241
241
|
collection: boolean;
|
|
242
242
|
writeable: boolean;
|
|
243
243
|
};
|
|
244
|
-
|
|
244
|
+
addresses: {
|
|
245
245
|
type: string;
|
|
246
246
|
collection: boolean;
|
|
247
247
|
writeable: boolean;
|
|
248
248
|
};
|
|
249
|
-
|
|
249
|
+
address: {
|
|
250
250
|
type: string;
|
|
251
251
|
collection: boolean;
|
|
252
252
|
writeable: boolean;
|
package/types/services/ntp.d.mts
CHANGED
|
@@ -113,12 +113,12 @@ export class NTPService extends ExtraSourceService {
|
|
|
113
113
|
collection: boolean;
|
|
114
114
|
writeable: boolean;
|
|
115
115
|
};
|
|
116
|
-
|
|
116
|
+
addresses: {
|
|
117
117
|
type: string;
|
|
118
118
|
collection: boolean;
|
|
119
119
|
writeable: boolean;
|
|
120
120
|
};
|
|
121
|
-
|
|
121
|
+
address: {
|
|
122
122
|
type: string;
|
|
123
123
|
collection: boolean;
|
|
124
124
|
writeable: boolean;
|
|
@@ -241,12 +241,12 @@ export class NTPService extends ExtraSourceService {
|
|
|
241
241
|
collection: boolean;
|
|
242
242
|
writeable: boolean;
|
|
243
243
|
};
|
|
244
|
-
|
|
244
|
+
addresses: {
|
|
245
245
|
type: string;
|
|
246
246
|
collection: boolean;
|
|
247
247
|
writeable: boolean;
|
|
248
248
|
};
|
|
249
|
-
|
|
249
|
+
address: {
|
|
250
250
|
type: string;
|
|
251
251
|
collection: boolean;
|
|
252
252
|
writeable: boolean;
|