pmcf 2.36.3 → 2.37.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/endpoint.mjs +9 -0
- package/src/service.mjs +20 -4
- package/types/endpoint.d.mts +5 -0
package/package.json
CHANGED
package/src/endpoint.mjs
CHANGED
package/src/service.mjs
CHANGED
|
@@ -10,6 +10,9 @@ import {
|
|
|
10
10
|
} from "./dns-utils.mjs";
|
|
11
11
|
|
|
12
12
|
const ServiceTypes = {
|
|
13
|
+
"pacman-repo": {
|
|
14
|
+
extends: ["https"]
|
|
15
|
+
},
|
|
13
16
|
ntp: { endpoints: [{ protocol: "udp", port: 123, tls: false }] },
|
|
14
17
|
dns: { endpoints: [{ protocol: "udp", port: 53, tls: false }] },
|
|
15
18
|
ldap: { endpoints: [{ protocol: "tcp", port: 389, tls: false }] },
|
|
@@ -22,7 +25,6 @@ const ServiceTypes = {
|
|
|
22
25
|
http3: {
|
|
23
26
|
extends: ["https"],
|
|
24
27
|
type: "https",
|
|
25
|
-
endpoints: [{ protocol: "tcp", port: 443, tls: true }],
|
|
26
28
|
dnsRecord: {
|
|
27
29
|
type: "HTTPS",
|
|
28
30
|
parameters: { "no-default-alpn": undefined, alpn: "h3" }
|
|
@@ -61,6 +63,20 @@ const ServiceTypes = {
|
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
65
|
|
|
66
|
+
function serviceTypeEndpoints(type) {
|
|
67
|
+
let st = ServiceTypes[type];
|
|
68
|
+
if (st) {
|
|
69
|
+
if (st.extends) {
|
|
70
|
+
return st.extends.reduce(
|
|
71
|
+
(a, c) => [...a, ...(ServiceTypes[c]?.endpoints||[])],
|
|
72
|
+
st.endpoints || []
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return st.endpoints;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
64
80
|
export const endpointProperties = {
|
|
65
81
|
port: { type: "number", collection: false, writeable: true },
|
|
66
82
|
protocol: {
|
|
@@ -173,7 +189,7 @@ export class Service extends Base {
|
|
|
173
189
|
? { type: this.type }
|
|
174
190
|
: { type: this.type, port: this._port };
|
|
175
191
|
|
|
176
|
-
const data =
|
|
192
|
+
const data = serviceTypeEndpoints(this.type) || [
|
|
177
193
|
{
|
|
178
194
|
tls: false
|
|
179
195
|
}
|
|
@@ -318,9 +334,9 @@ export function serviceEndpoints(sources, options = {}) {
|
|
|
318
334
|
|
|
319
335
|
const res = [...new Set(options.select ? all.map(options.select) : all)];
|
|
320
336
|
|
|
321
|
-
if(options.limit < res.length) {
|
|
337
|
+
if (options.limit < res.length) {
|
|
322
338
|
res.length = options.limit;
|
|
323
339
|
}
|
|
324
|
-
|
|
340
|
+
|
|
325
341
|
return options.join ? res.join(options.join) : res;
|
|
326
342
|
}
|