pmcf 6.1.9 → 6.2.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": "6.1.9",
3
+ "version": "6.2.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -16,7 +16,9 @@ import {
16
16
  DomainNameEndpoint,
17
17
  HTTPEndpoint,
18
18
  UnixEndpoint,
19
- addType
19
+ addType,
20
+ FAMILY_UNIX,
21
+ FAMILY_DNS
20
22
  } from "pmcf";
21
23
  import { asArray } from "./utils.mjs";
22
24
  import { networkAddressAttributes } from "./common-attributes.mjs";
@@ -135,12 +137,12 @@ export class CoreService extends Base {
135
137
 
136
138
  for (const e of data) {
137
139
  switch (e.family) {
138
- case "unix":
140
+ case FAMILY_UNIX:
139
141
  result.push(new UnixEndpoint(this, e.path, e));
140
142
  break;
141
143
 
142
144
  case undefined:
143
- case "dns":
145
+ case FAMILY_DNS:
144
146
  case FAMILY_IPV4:
145
147
  case FAMILY_IPV6:
146
148
  const options =
package/src/endpoint.mjs CHANGED
@@ -2,6 +2,9 @@ import { FAMILY_IPV6 } from "ip-utilties";
2
2
  import { addType } from "pmcf";
3
3
  import { endpointAttributes, CoreService } from "./core-service.mjs";
4
4
 
5
+ export const FAMILY_UNIX = "unix";
6
+ export const FAMILY_DNS = "dns";
7
+
5
8
  class BaseEndpoint {
6
9
  static name = "endpoint";
7
10
  static priority = 1.1;
@@ -112,7 +115,7 @@ export class DomainNameEndpoint extends PortEndpoint {
112
115
  }
113
116
 
114
117
  get family() {
115
- return "dns"; // TODO
118
+ return FAMILY_DNS;
116
119
  }
117
120
 
118
121
  get address() {
@@ -198,7 +201,7 @@ export class UnixEndpoint extends BaseEndpoint {
198
201
  }
199
202
 
200
203
  get family() {
201
- return "unix";
204
+ return FAMILY_UNIX;
202
205
  }
203
206
 
204
207
  get host() {
@@ -1,4 +1,5 @@
1
1
  import { FAMILY_IPV4, FAMILY_IPV6 } from "ip-utilties";
2
+ import { FAMILY_UNIX } from "./endpoint.mjs";
2
3
 
3
4
  export const ServiceTypes = {
4
5
  "alpm-repo": {
@@ -83,7 +84,7 @@ export const ServiceTypes = {
83
84
  ]
84
85
  },
85
86
  ldapi: {
86
- endpoints: [{ family: "unix", scheme: "ldapi", path: "/run/ldapi" }]
87
+ endpoints: [{ family: FAMILY_UNIX, scheme: "ldapi", path: "/run/ldapi" }]
87
88
  },
88
89
  http: {
89
90
  endpoints: [
@@ -23,7 +23,8 @@ import {
23
23
  serviceEndpoints,
24
24
  addresses,
25
25
  networkAddressType,
26
- addType
26
+ addType,
27
+ FAMILY_DNS
27
28
  } from "pmcf";
28
29
  import { yesno, writeLines, asArray } from "../utils.mjs";
29
30
  import {
@@ -501,8 +502,8 @@ export class bind extends ExtraSourceService {
501
502
 
502
503
  async writeForwarders(outputControl) {
503
504
  const forwarders = serviceEndpoints(this.source, {
504
- services: 'services[types[dns] && priority>=100 && priority<200]',
505
- endpoints: endpoint => endpoint.family !== "dns",
505
+ services: "services[types[dns] && priority>=100 && priority<200]",
506
+ endpoints: endpoint => endpoint.family !== FAMILY_DNS,
506
507
  select: e => e.address,
507
508
  limit: 5
508
509
  });
@@ -2,7 +2,7 @@ import { join } from "node:path";
2
2
  import { FAMILY_IPV4, FAMILY_IPV6 } from "ip-utilties";
3
3
  import { FileContentProvider } from "npm-pkgbuild";
4
4
  import { isLinkLocal } from "ip-utilties";
5
- import { serviceEndpoints, addType, ExtraSourceService } from "pmcf";
5
+ import { serviceEndpoints, addType, ExtraSourceService, FAMILY_UNIX } from "pmcf";
6
6
  import { writeLines } from "../utils.mjs";
7
7
 
8
8
  export class chrony extends ExtraSourceService {
@@ -25,7 +25,7 @@ export class chrony extends ExtraSourceService {
25
25
  tls: false
26
26
  },
27
27
  {
28
- family: "unix",
28
+ family: FAMILY_UNIX,
29
29
  path: "/var/run/chrony/chronyd.sock"
30
30
  }
31
31
  ]
@@ -1,11 +1,11 @@
1
1
  import { FAMILY_IPV4 } from "ip-utilties";
2
- import { CoreService, addType } from "pmcf";
2
+ import { CoreService, addType, FAMILY_UNIX } from "pmcf";
3
3
 
4
4
  export class headscale extends CoreService {
5
5
  static service = {
6
6
  endpoints: [
7
7
  {
8
- family: "unix",
8
+ family: FAMILY_UNIX,
9
9
  path: "/run/headscale/headscale.sock"
10
10
  },
11
11
  {
@@ -17,7 +17,8 @@ import {
17
17
  sortDescendingByPriority,
18
18
  serviceEndpoints,
19
19
  SUBNET_LOCALHOST_IPV4,
20
- SUBNET_LOCALHOST_IPV6
20
+ SUBNET_LOCALHOST_IPV6,
21
+ FAMILY_UNIX
21
22
  } from "pmcf";
22
23
  import { writeLines } from "../utils.mjs";
23
24
 
@@ -106,7 +107,7 @@ export class kea extends CoreService {
106
107
  "kea-control-dhcp4": {
107
108
  endpoints: [
108
109
  {
109
- family: "unix",
110
+ family: FAMILY_UNIX,
110
111
  path: "/run/kea/ctrl-4"
111
112
  }
112
113
  ]
@@ -114,7 +115,7 @@ export class kea extends CoreService {
114
115
  "kea-control-dhcp6": {
115
116
  endpoints: [
116
117
  {
117
- family: "unix",
118
+ family: FAMILY_UNIX,
118
119
  path: "/run/kea/ctrl-6"
119
120
  }
120
121
  ]
@@ -122,7 +123,7 @@ export class kea extends CoreService {
122
123
  "kea-control-ddns": {
123
124
  endpoints: [
124
125
  {
125
- family: "unix",
126
+ family: FAMILY_UNIX,
126
127
  path: "/run/kea/ctrl-ddns"
127
128
  }
128
129
  ]
@@ -272,7 +273,7 @@ export class kea extends CoreService {
272
273
 
273
274
  const toUnix = endpoint => {
274
275
  return {
275
- "socket-type": "unix",
276
+ "socket-type": FAMILY_UNIX,
276
277
  "socket-name": endpoint?.path
277
278
  };
278
279
  };