pmcf 2.14.0 → 2.14.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.14.0",
3
+ "version": "2.14.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/service.mjs CHANGED
@@ -166,28 +166,26 @@ export class Service extends Base {
166
166
  }
167
167
 
168
168
  get endpoints() {
169
- const nis = [...this.server.networkInterfaces.values()];
170
-
171
- if (!ServiceTypes[this.type]) {
172
- return nis.map(
173
- networkInterface =>
174
- new Endpoint(this, networkInterface, {
175
- rawAddress: this.rawAddress,
176
- port: this._port,
177
- tls: false
178
- })
179
- );
180
- }
169
+ const local = this._port === undefined ? {} : { port: this._port };
181
170
 
182
- return nis.map(networkInterface =>
183
- ServiceTypes[this.type].endpoints.map(
184
- e =>
185
- new Endpoint(this, networkInterface, {
186
- rawAddress: this.rawAddress,
187
- ...e
188
- })
171
+ const data = ServiceTypes[this.type]?.endpoints || [
172
+ {
173
+ tls: false
174
+ }
175
+ ];
176
+
177
+ return [...this.server.networkAddresses()]
178
+ .map(sa =>
179
+ data.map(
180
+ d =>
181
+ new Endpoint(this, sa.networkInterface, {
182
+ ...d,
183
+ rawAddress: sa.address,
184
+ ...local
185
+ })
186
+ )
189
187
  )
190
- ).flat();
188
+ .flat();
191
189
  }
192
190
 
193
191
  set alias(value) {
@@ -241,7 +239,9 @@ export class Service extends Base {
241
239
  }
242
240
 
243
241
  if (hasSVRRecords) {
244
- for (const ep of this.endpoints.filter(e => e.protocol)) {
242
+ for (const ep of this.endpoints.filter(
243
+ e => e.protocol && e.networkInterface.scope !== "host" // TODO how to identify related interfaces
244
+ )) {
245
245
  records.push(
246
246
  DNSRecord(
247
247
  dnsFullName(
@@ -300,6 +300,24 @@ export class Endpoint {
300
300
  this.networkInterface = networkInterface;
301
301
  Object.assign(this, data);
302
302
  }
303
+
304
+ toString() {
305
+ return `${this.rawAddress}[${this.port}]`;
306
+ }
307
+
308
+ get hostName() {
309
+ return this.networkInterface.hostName;
310
+ }
311
+
312
+ #rawAddress;
313
+
314
+ get rawAddress() {
315
+ return this.#rawAddress ?? this.networkInterface.rawAddress;
316
+ }
317
+
318
+ set rawAddress(value) {
319
+ this.#rawAddress = value;
320
+ }
303
321
  }
304
322
 
305
323
  export const sortByPriority = (a, b) => a.priority - b.priority;
@@ -288,6 +288,11 @@ export class Endpoint {
288
288
  constructor(service: any, networkInterface: any, data: any);
289
289
  service: any;
290
290
  networkInterface: any;
291
+ toString(): string;
292
+ get hostName(): any;
293
+ set rawAddress(value: any);
294
+ get rawAddress(): any;
295
+ #private;
291
296
  }
292
297
  export function sortByPriority(a: any, b: any): number;
293
298
  import { Base } from "./base.mjs";