pmcf 2.24.3 → 2.25.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.24.3",
3
+ "version": "2.25.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/endpoint.mjs CHANGED
@@ -1,9 +1,7 @@
1
- import { familyIP } from "ip-utilties";
2
-
3
1
  export class Endpoint {
4
- constructor(service, networkInterface, data) {
2
+ constructor(service, networkAddress, data) {
5
3
  this.service = service;
6
- this.networkInterface = networkInterface;
4
+ this.networkAddress = networkAddress;
7
5
  Object.assign(this, data);
8
6
  }
9
7
 
@@ -16,13 +14,13 @@ export class Endpoint {
16
14
  }
17
15
 
18
16
  get hostName() {
19
- return this.networkInterface.hostName;
17
+ return this.networkAddress.networkInterface.hostName;
20
18
  }
21
19
 
22
20
  #address;
23
21
 
24
22
  get address() {
25
- return this.#address ?? this.networkInterface.address;
23
+ return this.#address ?? this.networkAddress.address;
26
24
  }
27
25
 
28
26
  set address(value) {
@@ -30,6 +28,10 @@ export class Endpoint {
30
28
  }
31
29
 
32
30
  get family() {
33
- return familyIP(this.address);
31
+ return this.networkAddress.family;
32
+ }
33
+
34
+ get networkInterface() {
35
+ return this.networkAddress.networkInterface;
34
36
  }
35
37
  }
package/src/service.mjs CHANGED
@@ -189,12 +189,11 @@ export class Service extends Base {
189
189
  ];
190
190
 
191
191
  const result = [...this.server.networkAddresses()]
192
- .map(sa =>
192
+ .map(na =>
193
193
  data.map(
194
194
  d =>
195
- new Endpoint(this, sa.networkInterface, {
195
+ new Endpoint(this, na, {
196
196
  ...d,
197
- address: sa.address,
198
197
  ...local
199
198
  })
200
199
  )
@@ -52,17 +52,16 @@ export class DHCPService extends Service {
52
52
  }
53
53
 
54
54
  endpoints(filter) {
55
- const l0 = this.server.findNetworkInterface({ scope: "host" });
55
+ const endpoints = super.endpoints(filter);
56
56
 
57
- if (l0) {
58
- return [
59
- ...super.endpoints(filter),
60
- new Endpoint(this, l0, controlAgentEndpoint),
61
- new Endpoint(this, l0, ddnsEndpoint)
62
- ];
57
+ for (const na of this.server.networkAddresses(
58
+ na => na.networkInterface.kind === "localhost"
59
+ )) {
60
+ endpoints.push(new Endpoint(this, na, controlAgentEndpoint));
61
+ endpoints.push(new Endpoint(this, na, ddnsEndpoint));
63
62
  }
64
63
 
65
- return super.endpoints(filter);
64
+ return endpoints;
66
65
  }
67
66
 
68
67
  async *preparePackages(dir) {
@@ -256,7 +255,7 @@ export class DHCPService extends Service {
256
255
  }
257
256
  ],
258
257
  subnet4: [...subnets]
259
- .filter(s => s.family==='IPv4')
258
+ .filter(s => s.family === "IPv4")
260
259
  .map((subnet, index) => {
261
260
  return {
262
261
  id: index + 1,
@@ -85,10 +85,14 @@ export class NTPService extends ExtraSourceService {
85
85
  };
86
86
 
87
87
  const lines = [
88
- ...serviceEndpoints(this, {
89
- ...NTP_SERVICE_FILTER,
90
- priority: ">=10"
91
- }).map(
88
+ ...serviceEndpoints(
89
+ this,
90
+ {
91
+ ...NTP_SERVICE_FILTER,
92
+ priority: ">=10"
93
+ },
94
+ e => e.family === 'IPv4' && e.networkInterface.kind !== "loopback"
95
+ ).map(
92
96
  endpoint =>
93
97
  `${endpoint.service.isPool ? "pool" : "server"} ${
94
98
  endpoint.address
@@ -1,12 +1,13 @@
1
1
  export class Endpoint {
2
- constructor(service: any, networkInterface: any, data: any);
2
+ constructor(service: any, networkAddress: any, data: any);
3
3
  service: any;
4
- networkInterface: any;
4
+ networkAddress: any;
5
5
  toString(): string;
6
6
  get socketAddress(): string;
7
7
  get hostName(): any;
8
8
  set address(value: any);
9
9
  get address(): any;
10
10
  get family(): any;
11
+ get networkInterface(): any;
11
12
  #private;
12
13
  }