pmcf 1.64.3 → 1.64.5
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 +5 -1
- package/src/cluster.mjs +14 -8
- package/src/host.mjs +11 -8
- package/src/owner.mjs +8 -4
- package/src/service.mjs +8 -1
- package/types/base.d.mts +1 -0
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -284,6 +284,10 @@ export class Base {
|
|
|
284
284
|
return this.owner?.timezone;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
get smtp() {
|
|
288
|
+
return this.findService({ type: "smtp" });
|
|
289
|
+
}
|
|
290
|
+
|
|
287
291
|
findService(filter) {
|
|
288
292
|
let best;
|
|
289
293
|
for (const service of this.findServices(filter)) {
|
|
@@ -297,7 +301,7 @@ export class Base {
|
|
|
297
301
|
|
|
298
302
|
*findServices(filter) {
|
|
299
303
|
if (this.owner) {
|
|
300
|
-
yield* this.owner
|
|
304
|
+
yield* this.owner.findServices(filter);
|
|
301
305
|
}
|
|
302
306
|
}
|
|
303
307
|
|
package/src/cluster.mjs
CHANGED
|
@@ -80,7 +80,7 @@ export class Cluster extends Host {
|
|
|
80
80
|
" notification_email {",
|
|
81
81
|
" " + this.administratorEmail,
|
|
82
82
|
" }",
|
|
83
|
-
|
|
83
|
+
` smtp_server ${this.smtp.rawAddress}`,
|
|
84
84
|
` notification_email_from keepalived@${host.domainName}`,
|
|
85
85
|
"}"
|
|
86
86
|
];
|
|
@@ -114,13 +114,19 @@ export class Cluster extends Host {
|
|
|
114
114
|
cfg.push(` protocol ${service.protocol.toUpperCase()}`);
|
|
115
115
|
|
|
116
116
|
for (const member of this.members) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
const memberService = member.findService({ type: service.type });
|
|
118
|
+
|
|
119
|
+
cfg.push(
|
|
120
|
+
` real_server ${member.rawAddress} ${memberService.port} {`
|
|
121
|
+
);
|
|
122
|
+
cfg.push(` weight ${memberService.weight}`);
|
|
123
|
+
|
|
124
|
+
switch (service.protocol) {
|
|
125
|
+
case "tcp":
|
|
126
|
+
cfg.push(` TCP_CHECK {`);
|
|
127
|
+
cfg.push(" connect_timeout 3");
|
|
128
|
+
cfg.push(" }");
|
|
129
|
+
break;
|
|
124
130
|
}
|
|
125
131
|
|
|
126
132
|
cfg.push(" }");
|
package/src/host.mjs
CHANGED
|
@@ -263,15 +263,18 @@ export class Host extends Base {
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
*findServices(filter) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
266
|
+
if (filter) {
|
|
267
|
+
for (const service of this.#services) {
|
|
268
|
+
if (
|
|
269
|
+
filter.type === "*" ||
|
|
270
|
+
filter.type === service.type ||
|
|
271
|
+
filter.name === service.name
|
|
272
|
+
) {
|
|
273
|
+
yield service;
|
|
274
|
+
}
|
|
274
275
|
}
|
|
276
|
+
} else {
|
|
277
|
+
yield* this.#services;
|
|
275
278
|
}
|
|
276
279
|
}
|
|
277
280
|
|
package/src/owner.mjs
CHANGED
|
@@ -146,9 +146,9 @@ export class Owner extends Base {
|
|
|
146
146
|
return this.typeNamed("host", name);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
*
|
|
150
|
-
yield
|
|
151
|
-
yield
|
|
149
|
+
*hosts() {
|
|
150
|
+
yield* this.typeList("host");
|
|
151
|
+
yield* this.typeList("cluster");
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
networkNamed(name) {
|
|
@@ -225,7 +225,10 @@ export class Owner extends Base {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
for (const nameOrNetwork of asIterator(destinationNetworks)) {
|
|
228
|
-
const other =
|
|
228
|
+
const other =
|
|
229
|
+
nameOrNetwork instanceof Owner
|
|
230
|
+
? nameOrNetwork
|
|
231
|
+
: this.networkNamed(nameOrNetwork);
|
|
229
232
|
if (other) {
|
|
230
233
|
if (!bridge.has(other)) {
|
|
231
234
|
bridge.add(other);
|
|
@@ -360,4 +363,5 @@ export class Owner extends Base {
|
|
|
360
363
|
yield location.domain;
|
|
361
364
|
}
|
|
362
365
|
}
|
|
366
|
+
|
|
363
367
|
}
|
package/src/service.mjs
CHANGED
|
@@ -131,7 +131,14 @@ export class Service extends Base {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
get weight() {
|
|
134
|
-
|
|
134
|
+
if (this.#weight !== undefined) {
|
|
135
|
+
return this.#weight;
|
|
136
|
+
}
|
|
137
|
+
if (this.owner.weight !== undefined) {
|
|
138
|
+
return this.owner.weight;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return 1;
|
|
135
142
|
}
|
|
136
143
|
|
|
137
144
|
set type(value) {
|
package/types/base.d.mts
CHANGED