pmcf 2.51.1 → 2.51.3

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.1",
3
+ "version": "2.51.3",
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",
@@ -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,30 @@ 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(
130
+ network.findServices({ type: "dhcp", priority: ">10" })
131
+ )
132
+ )
133
+ .sort((a, b) => (a.host === host ? -1 : 1))
134
+ .map((dhcp, i) => {
135
+ const ctrlAgentEndpoint = dhcp.endpoint(
136
+ e => e.type === "kea-control-agent"
137
+ );
138
+
139
+ return {
140
+ name: dhcp.host.name,
141
+ role: i === 0 ? "primary" : "standby",
142
+ url: ctrlAgentEndpoint?.url
143
+ };
144
+ });
145
+
146
+ peers.length = 2;
147
+
129
148
  const commonConfig = {
130
149
  "lease-database": {
131
150
  type: "memfile",
@@ -156,18 +175,7 @@ export class DHCPService extends Service {
156
175
  {
157
176
  "this-server-name": name,
158
177
  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
- ]
178
+ peers
171
179
  }
172
180
  ]
173
181
  }
@@ -219,10 +227,12 @@ export class DHCPService extends Service {
219
227
  };
220
228
  });
221
229
 
230
+ const ddnsEndpoint = this.endpoint(e => e.type === "kea-ddns");
231
+
222
232
  const ddns = {
223
233
  DhcpDdns: {
224
- "ip-address": "127.0.0.1",
225
- port: 53001,
234
+ "ip-address": ddnsEndpoint.address,
235
+ port: ddnsEndpoint.port,
226
236
  "control-socket": toUnix(
227
237
  this.endpoint(e => e.type === "kea-control-ddns")
228
238
  ),
@@ -241,8 +251,8 @@ export class DHCPService extends Service {
241
251
 
242
252
  const dhcpServerDdns = {
243
253
  "enable-updates": true,
244
- "server-ip": "127.0.0.1",
245
- "server-port": ddns.DhcpDdns.port,
254
+ "server-address": ddnsEndpoint.address,
255
+ "server-port": ddnsEndpoint.port,
246
256
  "max-queue-size": 64,
247
257
  "ncr-protocol": "UDP",
248
258
  "ncr-format": "JSON"