pmcf 2.36.3 → 2.37.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 +1 -1
- package/src/endpoint.mjs +9 -0
- package/src/service.mjs +23 -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,23 @@ 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
|
+
let ste = ServiceTypes[st.extends];
|
|
71
|
+
|
|
72
|
+
if (ste.endpoints) {
|
|
73
|
+
return st.endpoints
|
|
74
|
+
? [...st.endpoints, ...ste.endpoints]
|
|
75
|
+
: ste.endpoints;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return st.endpoints;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
64
83
|
export const endpointProperties = {
|
|
65
84
|
port: { type: "number", collection: false, writeable: true },
|
|
66
85
|
protocol: {
|
|
@@ -173,7 +192,7 @@ export class Service extends Base {
|
|
|
173
192
|
? { type: this.type }
|
|
174
193
|
: { type: this.type, port: this._port };
|
|
175
194
|
|
|
176
|
-
const data =
|
|
195
|
+
const data = serviceTypeEndpoints(this.type) || [
|
|
177
196
|
{
|
|
178
197
|
tls: false
|
|
179
198
|
}
|
|
@@ -318,9 +337,9 @@ export function serviceEndpoints(sources, options = {}) {
|
|
|
318
337
|
|
|
319
338
|
const res = [...new Set(options.select ? all.map(options.select) : all)];
|
|
320
339
|
|
|
321
|
-
if(options.limit < res.length) {
|
|
340
|
+
if (options.limit < res.length) {
|
|
322
341
|
res.length = options.limit;
|
|
323
342
|
}
|
|
324
|
-
|
|
343
|
+
|
|
325
344
|
return options.join ? res.join(options.join) : res;
|
|
326
345
|
}
|