pmcf 2.13.2 → 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 +1 -1
- package/src/service.mjs +42 -14
- package/types/service.d.mts +8 -2
package/package.json
CHANGED
package/src/service.mjs
CHANGED
|
@@ -166,19 +166,26 @@ export class Service extends Base {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
get endpoints() {
|
|
169
|
-
|
|
170
|
-
return [
|
|
171
|
-
new Endpoint(this, {
|
|
172
|
-
rawAddress: this.rawAddress,
|
|
173
|
-
port: this._port,
|
|
174
|
-
tls: false
|
|
175
|
-
})
|
|
176
|
-
];
|
|
177
|
-
}
|
|
169
|
+
const local = this._port === undefined ? {} : { port: this._port };
|
|
178
170
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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
|
+
)
|
|
187
|
+
)
|
|
188
|
+
.flat();
|
|
182
189
|
}
|
|
183
190
|
|
|
184
191
|
set alias(value) {
|
|
@@ -232,7 +239,9 @@ export class Service extends Base {
|
|
|
232
239
|
}
|
|
233
240
|
|
|
234
241
|
if (hasSVRRecords) {
|
|
235
|
-
for (const ep of this.endpoints.filter(
|
|
242
|
+
for (const ep of this.endpoints.filter(
|
|
243
|
+
e => e.protocol && e.networkInterface.scope !== "host" // TODO how to identify related interfaces
|
|
244
|
+
)) {
|
|
236
245
|
records.push(
|
|
237
246
|
DNSRecord(
|
|
238
247
|
dnsFullName(
|
|
@@ -286,10 +295,29 @@ export class Service extends Base {
|
|
|
286
295
|
}
|
|
287
296
|
|
|
288
297
|
export class Endpoint {
|
|
289
|
-
constructor(service, data) {
|
|
298
|
+
constructor(service, networkInterface, data) {
|
|
290
299
|
this.service = service;
|
|
300
|
+
this.networkInterface = networkInterface;
|
|
291
301
|
Object.assign(this, data);
|
|
292
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
|
+
}
|
|
293
321
|
}
|
|
294
322
|
|
|
295
323
|
export const sortByPriority = (a, b) => a.priority - b.priority;
|
package/types/service.d.mts
CHANGED
|
@@ -267,7 +267,7 @@ export class Service extends Base {
|
|
|
267
267
|
set ipAddresses(value: any);
|
|
268
268
|
get addresses(): any;
|
|
269
269
|
get networks(): any;
|
|
270
|
-
get endpoints(): any;
|
|
270
|
+
get endpoints(): any[];
|
|
271
271
|
set alias(value: any);
|
|
272
272
|
get alias(): any;
|
|
273
273
|
set port(value: any);
|
|
@@ -285,8 +285,14 @@ export class Service extends Base {
|
|
|
285
285
|
}[];
|
|
286
286
|
}
|
|
287
287
|
export class Endpoint {
|
|
288
|
-
constructor(service: any, data: any);
|
|
288
|
+
constructor(service: any, networkInterface: any, data: any);
|
|
289
289
|
service: any;
|
|
290
|
+
networkInterface: any;
|
|
291
|
+
toString(): string;
|
|
292
|
+
get hostName(): any;
|
|
293
|
+
set rawAddress(value: any);
|
|
294
|
+
get rawAddress(): any;
|
|
295
|
+
#private;
|
|
290
296
|
}
|
|
291
297
|
export function sortByPriority(a: any, b: any): number;
|
|
292
298
|
import { Base } from "./base.mjs";
|