pmcf 2.51.0 → 2.51.2

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.51.0",
3
+ "version": "2.51.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -51,7 +51,7 @@
51
51
  "pkg-dir": "^8.0.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@types/node": "^22.15.18",
54
+ "@types/node": "^22.15.19",
55
55
  "ava": "^6.3.0",
56
56
  "c8": "^10.1.3",
57
57
  "documentation": "^14.0.3",
package/src/service.mjs CHANGED
@@ -275,7 +275,7 @@ export class Service extends Base {
275
275
 
276
276
  if (hasSVRRecords) {
277
277
  for (const ep of this.endpoints(
278
- e => e.protocol && e.networkInterface.kind !== "loopback"
278
+ e => e.protocol && e.networkInterface && e.networkInterface.kind !== "loopback"
279
279
  )) {
280
280
  records.push(
281
281
  DNSRecord(
@@ -77,13 +77,12 @@ export class DHCPService extends Service {
77
77
  endpoints(filter) {
78
78
  const endpoints = super.endpoints(filter);
79
79
 
80
- for (const na of this.host.networkAddresses(
81
- na => na.networkInterface.kind === "loopback"
82
- )) {
83
- endpoints.push(
84
- new HTTPEndpoint(this, na, controlAgentEndpoint),
85
- new Endpoint(this, na, ddnsEndpoint)
86
- );
80
+ for (const na of this.host.networkAddresses()) {
81
+ endpoints.push(new HTTPEndpoint(this, na, controlAgentEndpoint));
82
+
83
+ if (na.networkInterface.kind === "loopback") {
84
+ endpoints.push(new Endpoint(this, na, ddnsEndpoint));
85
+ }
87
86
  }
88
87
 
89
88
  endpoints.push(
@@ -122,10 +121,24 @@ export class DHCPService extends Service {
122
121
  }
123
122
  };
124
123
 
125
- const ctrlAgentEndpoint = this.endpoint(
124
+ const ctrlAgentEndpoint = this.endpoint(
126
125
  e => e.type === "kea-control-agent"
127
126
  );
128
127
 
128
+ const peers = (
129
+ await Array.fromAsync(network.findServices({ type: "dhcp" }))
130
+ ).map(dhcp => {
131
+ const ctrlAgentEndpoint = dhcp.endpoint(
132
+ e => e.type === "kea-control-agent"
133
+ );
134
+
135
+ return {
136
+ name: dhcp.host.name,
137
+ role: dhcp.priority < 10 ? "primary" : "standby",
138
+ url: ctrlAgentEndpoint?.url
139
+ };
140
+ });
141
+
129
142
  const commonConfig = {
130
143
  "lease-database": {
131
144
  type: "memfile",
@@ -156,18 +169,7 @@ export class DHCPService extends Service {
156
169
  {
157
170
  "this-server-name": name,
158
171
  mode: "hot-standby",
159
- peers: [
160
- {
161
- name: name,
162
- url: ctrlAgentEndpoint.url,
163
- role: "primary"
164
- } /*,
165
- {
166
- name: "server2",
167
- url: "http://172.28.0.254:8000/",
168
- role: "standby"
169
- }*/
170
- ]
172
+ peers
171
173
  }
172
174
  ]
173
175
  }
@@ -219,10 +221,12 @@ export class DHCPService extends Service {
219
221
  };
220
222
  });
221
223
 
224
+ const ddnsEndpoint = this.endpoint(e => e.type === "kea-ddns");
225
+
222
226
  const ddns = {
223
227
  DhcpDdns: {
224
- "ip-address": "127.0.0.1",
225
- port: 53001,
228
+ "ip-address": ddnsEndpoint.address,
229
+ port: ddnsEndpoint.port,
226
230
  "control-socket": toUnix(
227
231
  this.endpoint(e => e.type === "kea-control-ddns")
228
232
  ),
@@ -241,8 +245,8 @@ export class DHCPService extends Service {
241
245
 
242
246
  const dhcpServerDdns = {
243
247
  "enable-updates": true,
244
- "server-ip": "127.0.0.1",
245
- "server-port": ddns.DhcpDdns.port,
248
+ "ip-address": ddnsEndpoint.address,
249
+ port: ddnsEndpoint.port,
246
250
  "max-queue-size": 64,
247
251
  "ncr-protocol": "UDP",
248
252
  "ncr-format": "JSON"