pmcf 2.65.0 → 2.65.2

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/README.md CHANGED
@@ -22,6 +22,7 @@
22
22
 
23
23
  * [Base](#base)
24
24
  * [Parameters](#parameters)
25
+ * [extends](#extends)
25
26
  * [findService](#findservice)
26
27
  * [Parameters](#parameters-1)
27
28
  * [SkeletonNetworkInterface](#skeletonnetworkinterface)
@@ -44,6 +45,10 @@
44
45
  * `owner`  
45
46
  * `data`  
46
47
 
48
+ ### extends
49
+
50
+ Returns **Iterable<[Base](#base)>**&#x20;
51
+
47
52
  ### findService
48
53
 
49
54
  #### Parameters
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.65.0",
3
+ "version": "2.65.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -52,7 +52,7 @@
52
52
  "pkg-dir": "^8.0.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@types/node": "^22.15.29",
55
+ "@types/node": "^22.15.30",
56
56
  "ava": "^6.3.0",
57
57
  "c8": "^10.1.3",
58
58
  "documentation": "^14.0.3",
package/src/module.mjs CHANGED
@@ -14,6 +14,7 @@ export * from "./network-interfaces/ethernet.mjs";
14
14
  export * from "./network-interfaces/wlan.mjs";
15
15
  export * from "./network-interfaces/wireguard.mjs";
16
16
  export * from "./host.mjs";
17
+ export * from "./service-types.mjs";
17
18
  export * from "./service.mjs";
18
19
  export * from "./extra-source-service.mjs";
19
20
  export * from "./endpoint.mjs";
@@ -0,0 +1,77 @@
1
+ export const ServiceTypes = {
2
+ "pacman-repo": {
3
+ extends: ["https"]
4
+ },
5
+ mqtt: { endpoints: [{ protocol: "tcp", port: 1883, tls: false }] },
6
+ "secure-mqtt": { endpoints: [{ protocol: "tcp", port: 8883, tls: true }] },
7
+ ntp: { endpoints: [{ protocol: "udp", port: 123, tls: false }] },
8
+ dns: { endpoints: [{ protocol: "udp", port: 53, tls: false }] },
9
+ ldap: { endpoints: [{ protocol: "tcp", port: 389, tls: false }] },
10
+ ldaps: { endpoints: [{ protocol: "tcp", port: 636, tls: true }] },
11
+ http: { endpoints: [{ protocol: "tcp", port: 80, tls: false }] },
12
+ https: {
13
+ endpoints: [{ protocol: "tcp", port: 443, tls: true }],
14
+ dnsRecord: { type: "HTTPS", parameters: { alpn: "h2" } }
15
+ },
16
+ http3: {
17
+ extends: ["https"],
18
+ dnsRecord: {
19
+ type: "HTTPS",
20
+ parameters: { "no-default-alpn": undefined, alpn: "h3" }
21
+ }
22
+ },
23
+ rtsp: { endpoints: [{ protocol: "tcp", port: 554, tls: false }] },
24
+ smtp: {
25
+ endpoints: [{ protocol: "tcp", port: 25, tls: false }],
26
+ dnsRecord: { type: "MX" }
27
+ },
28
+ ssh: { endpoints: [{ protocol: "tcp", port: 22, tls: false }] },
29
+ imap: { endpoints: [{ protocol: "tcp", port: 143, tls: false }] },
30
+ imaps: { endpoints: [{ protocol: "tcp", port: 993, tls: true }] },
31
+ dhcp: { endpoints: [{ protocol: "udp", port: 547, tls: false }] },
32
+ "dhcpv6-client": {
33
+ endpoints: [
34
+ { protocol: "tcp", port: 546, tls: false },
35
+ { protocol: "udp", port: 546, tls: false }
36
+ ]
37
+ },
38
+ "dhcpv6-server": { endpoints: [{ port: 547, tls: false }] },
39
+ smb: { endpoints: [{ protocol: "tcp", port: 445, tls: false }] },
40
+ timemachine: {
41
+ extends: ["smb"],
42
+ endpoints: [{ protocol: "tcp", port: 445, tls: false }],
43
+ dnsRecord: {
44
+ type: "TXT",
45
+ parameters: {
46
+ sys: "waMa=0",
47
+ adVF: "0x100",
48
+ dk0: "adVN=MF-TM-999"
49
+ // adVF: "0x82"
50
+ }
51
+ }
52
+ }
53
+ };
54
+
55
+ export function addServiceTypes(st) {
56
+ Object.assign(ServiceTypes, st);
57
+ }
58
+
59
+ export function serviceTypeEndpoints(type) {
60
+ let st = ServiceTypes[type];
61
+ if (st) {
62
+ if (st.extends) {
63
+ return st.extends.reduce(
64
+ (a, c) => [...a, ...(ServiceTypes[c]?.endpoints || [])],
65
+ st.endpoints || []
66
+ );
67
+ }
68
+
69
+ return st.endpoints;
70
+ }
71
+
72
+ return [
73
+ {
74
+ tls: false
75
+ }
76
+ ];
77
+ }
package/src/service.mjs CHANGED
@@ -2,6 +2,7 @@ import { Base, Host, Endpoint, DomainNameEndpoint } from "pmcf";
2
2
  import { addType } from "./types.mjs";
3
3
  import { asArray } from "./utils.mjs";
4
4
  import { networkAddressProperties } from "./network-support.mjs";
5
+ import { serviceTypeEndpoints, ServiceTypes } from "./service-types.mjs";
5
6
  import {
6
7
  DNSRecord,
7
8
  dnsFullName,
@@ -10,79 +11,6 @@ import {
10
11
  dnsPriority
11
12
  } from "./dns-utils.mjs";
12
13
 
13
- const ServiceTypes = {
14
- "pacman-repo": {
15
- extends: ["https"]
16
- },
17
- mqtt: { endpoints: [{ protocol: "tcp", port: 1883, tls: false }] },
18
- ntp: { endpoints: [{ protocol: "udp", port: 123, tls: false }] },
19
- dns: { endpoints: [{ protocol: "udp", port: 53, tls: false }] },
20
- ldap: { endpoints: [{ protocol: "tcp", port: 389, tls: false }] },
21
- ldaps: { endpoints: [{ protocol: "tcp", port: 636, tls: true }] },
22
- http: { endpoints: [{ protocol: "tcp", port: 80, tls: false }] },
23
- https: {
24
- endpoints: [{ protocol: "tcp", port: 443, tls: true }],
25
- dnsRecord: { type: "HTTPS", parameters: { alpn: "h2" } }
26
- },
27
- http3: {
28
- extends: ["https"],
29
- dnsRecord: {
30
- type: "HTTPS",
31
- parameters: { "no-default-alpn": undefined, alpn: "h3" }
32
- }
33
- },
34
- rtsp: { endpoints: [{ protocol: "tcp", port: 554, tls: false }] },
35
- smtp: {
36
- endpoints: [{ protocol: "tcp", port: 25, tls: false }],
37
- dnsRecord: { type: "MX" }
38
- },
39
- ssh: { endpoints: [{ protocol: "tcp", port: 22, tls: false }] },
40
- imap: { endpoints: [{ protocol: "tcp", port: 143, tls: false }] },
41
- imaps: { endpoints: [{ protocol: "tcp", port: 993, tls: true }] },
42
- dhcp: { endpoints: [{ protocol: "udp", port: 547, tls: false }] },
43
- "dhcpv6-client": {
44
- endpoints: [
45
- { protocol: "tcp", port: 546, tls: false },
46
- { protocol: "udp", port: 546, tls: false }
47
- ]
48
- },
49
- "dhcpv6-server": { endpoints: [{ port: 547, tls: false }] },
50
- smb: { endpoints: [{ protocol: "tcp", port: 445, tls: false }] },
51
- timemachine: {
52
- extends: ["smb"],
53
- endpoints: [{ protocol: "tcp", port: 445, tls: false }],
54
- dnsRecord: {
55
- type: "TXT",
56
- parameters: {
57
- sys: "waMa=0",
58
- adVF: "0x100",
59
- dk0: "adVN=MF-TM-999"
60
- // adVF: "0x82"
61
- }
62
- }
63
- }
64
- };
65
-
66
- export 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
- return [
80
- {
81
- tls: false
82
- }
83
- ];
84
- }
85
-
86
14
  export const endpointProperties = {
87
15
  port: { type: "number", collection: false, writeable: true },
88
16
  protocol: {
@@ -194,9 +122,8 @@ export class Service extends Base {
194
122
  return this.host.subnets;
195
123
  }
196
124
 
197
- get serviceTypeEndpoints()
198
- {
199
- return serviceTypeEndpoints(this.type);
125
+ get serviceTypeEndpoints() {
126
+ return serviceTypeEndpoints(this.type);
200
127
  }
201
128
 
202
129
  endpoints(filter) {
@@ -16,11 +16,8 @@ import {
16
16
  addresses
17
17
  } from "pmcf";
18
18
  import { addType } from "../types.mjs";
19
- import {
20
- ServiceTypeDefinition,
21
- Service,
22
- serviceTypeEndpoints
23
- } from "../service.mjs";
19
+ import { serviceTypeEndpoints } from "../service-types.mjs";
20
+ import { Service, ServiceTypeDefinition } from "../service.mjs";
24
21
  import { ExtraSourceServiceTypeDefinition } from "../extra-source-service.mjs";
25
22
  import { addHook } from "../hooks.mjs";
26
23
 
@@ -93,6 +90,21 @@ const BindServiceTypeDefinition = {
93
90
  }
94
91
  };
95
92
 
93
+ const BindServiceTypes = {
94
+ "bind-statistics": {
95
+ endpoints: [
96
+ {
97
+ port: 19521,
98
+ protocol: "tcp",
99
+ tls: false
100
+ }
101
+ ]
102
+ },
103
+ rdnc: {
104
+ endpoints: [{ type: "rdnc", port: 953, protocol: "tcp", tls: false }]
105
+ }
106
+ };
107
+
96
108
  const rdncEndpoint = {
97
109
  type: "rdnc",
98
110
  port: 953,
@@ -141,7 +141,7 @@ export class KeaService extends Service {
141
141
 
142
142
  const dnsServerEndpoints = serviceEndpoints(network, {
143
143
  services: {
144
- type: "dns",
144
+ types: "dns",
145
145
  priority: ">=300"
146
146
  },
147
147
  endpoints: endpoint => endpoint.networkInterface.kind !== "loopback"
@@ -14,6 +14,7 @@ export * from "./network-interfaces/ethernet.mjs";
14
14
  export * from "./network-interfaces/wlan.mjs";
15
15
  export * from "./network-interfaces/wireguard.mjs";
16
16
  export * from "./host.mjs";
17
+ export * from "./service-types.mjs";
17
18
  export * from "./service.mjs";
18
19
  export * from "./extra-source-service.mjs";
19
20
  export * from "./endpoint.mjs";
@@ -0,0 +1,160 @@
1
+ export function addServiceTypes(st: any): void;
2
+ export function serviceTypeEndpoints(type: any): any;
3
+ export const ServiceTypes: {
4
+ "pacman-repo": {
5
+ extends: string[];
6
+ };
7
+ mqtt: {
8
+ endpoints: {
9
+ protocol: string;
10
+ port: number;
11
+ tls: boolean;
12
+ }[];
13
+ };
14
+ "secure-mqtt": {
15
+ endpoints: {
16
+ protocol: string;
17
+ port: number;
18
+ tls: boolean;
19
+ }[];
20
+ };
21
+ ntp: {
22
+ endpoints: {
23
+ protocol: string;
24
+ port: number;
25
+ tls: boolean;
26
+ }[];
27
+ };
28
+ dns: {
29
+ endpoints: {
30
+ protocol: string;
31
+ port: number;
32
+ tls: boolean;
33
+ }[];
34
+ };
35
+ ldap: {
36
+ endpoints: {
37
+ protocol: string;
38
+ port: number;
39
+ tls: boolean;
40
+ }[];
41
+ };
42
+ ldaps: {
43
+ endpoints: {
44
+ protocol: string;
45
+ port: number;
46
+ tls: boolean;
47
+ }[];
48
+ };
49
+ http: {
50
+ endpoints: {
51
+ protocol: string;
52
+ port: number;
53
+ tls: boolean;
54
+ }[];
55
+ };
56
+ https: {
57
+ endpoints: {
58
+ protocol: string;
59
+ port: number;
60
+ tls: boolean;
61
+ }[];
62
+ dnsRecord: {
63
+ type: string;
64
+ parameters: {
65
+ alpn: string;
66
+ };
67
+ };
68
+ };
69
+ http3: {
70
+ extends: string[];
71
+ dnsRecord: {
72
+ type: string;
73
+ parameters: {
74
+ "no-default-alpn": any;
75
+ alpn: string;
76
+ };
77
+ };
78
+ };
79
+ rtsp: {
80
+ endpoints: {
81
+ protocol: string;
82
+ port: number;
83
+ tls: boolean;
84
+ }[];
85
+ };
86
+ smtp: {
87
+ endpoints: {
88
+ protocol: string;
89
+ port: number;
90
+ tls: boolean;
91
+ }[];
92
+ dnsRecord: {
93
+ type: string;
94
+ };
95
+ };
96
+ ssh: {
97
+ endpoints: {
98
+ protocol: string;
99
+ port: number;
100
+ tls: boolean;
101
+ }[];
102
+ };
103
+ imap: {
104
+ endpoints: {
105
+ protocol: string;
106
+ port: number;
107
+ tls: boolean;
108
+ }[];
109
+ };
110
+ imaps: {
111
+ endpoints: {
112
+ protocol: string;
113
+ port: number;
114
+ tls: boolean;
115
+ }[];
116
+ };
117
+ dhcp: {
118
+ endpoints: {
119
+ protocol: string;
120
+ port: number;
121
+ tls: boolean;
122
+ }[];
123
+ };
124
+ "dhcpv6-client": {
125
+ endpoints: {
126
+ protocol: string;
127
+ port: number;
128
+ tls: boolean;
129
+ }[];
130
+ };
131
+ "dhcpv6-server": {
132
+ endpoints: {
133
+ port: number;
134
+ tls: boolean;
135
+ }[];
136
+ };
137
+ smb: {
138
+ endpoints: {
139
+ protocol: string;
140
+ port: number;
141
+ tls: boolean;
142
+ }[];
143
+ };
144
+ timemachine: {
145
+ extends: string[];
146
+ endpoints: {
147
+ protocol: string;
148
+ port: number;
149
+ tls: boolean;
150
+ }[];
151
+ dnsRecord: {
152
+ type: string;
153
+ parameters: {
154
+ sys: string;
155
+ adVF: string;
156
+ dk0: string;
157
+ };
158
+ };
159
+ };
160
+ };
@@ -1,4 +1,3 @@
1
- export function serviceTypeEndpoints(type: any): any;
2
1
  /**
3
2
  *
4
3
  * @param {*} sources