pmcf 2.24.0 → 2.24.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/package.json +1 -1
- package/src/dns-utils.mjs +7 -0
- package/src/network-interface.mjs +29 -2
- package/src/services/dns.mjs +10 -5
- package/types/dns-utils.d.mts +1 -0
- package/types/network-interface.d.mts +326 -1
package/package.json
CHANGED
package/src/dns-utils.mjs
CHANGED
|
@@ -5,6 +5,13 @@ export function dnsFullName(name) {
|
|
|
5
5
|
return name.endsWith(".") ? name : name + ".";
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
export function dnsRecordTypeForAddressFamily(family) {
|
|
9
|
+
switch(family) {
|
|
10
|
+
case 'IPv4': return "A";
|
|
11
|
+
case 'IPv6': return "AAAA";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
8
15
|
export function DNSRecord(key, type, ...values) {
|
|
9
16
|
let pad = "";
|
|
10
17
|
|
|
@@ -36,7 +36,7 @@ export class NetworkAddress {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
get domainNames() {
|
|
39
|
-
this.networkInterface.domainNames;
|
|
39
|
+
return this.networkInterface.domainNames;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
get family() {
|
|
@@ -332,7 +332,7 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
|
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
get kind() {
|
|
335
|
-
return
|
|
335
|
+
return LoopbackNetworkInterfaceTypeDefinition.name;
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
get scope() {
|
|
@@ -347,3 +347,30 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
|
|
|
347
347
|
return _localAddresses;
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
+
|
|
351
|
+
const WireguardNetworkInterfaceTypeDefinition = {
|
|
352
|
+
name: "wireguard",
|
|
353
|
+
specializationOf: NetworkInterfaceTypeDefinition,
|
|
354
|
+
owners: NetworkInterfaceTypeDefinition.owners,
|
|
355
|
+
extends: NetworkInterfaceTypeDefinition,
|
|
356
|
+
priority: 0.1,
|
|
357
|
+
properties: {}
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
export class WireguardNetworkInterface extends SkeletonNetworkInterface {
|
|
361
|
+
static {
|
|
362
|
+
addType(this);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
static get typeDefinition() {
|
|
366
|
+
return WireguardNetworkInterfaceTypeDefinition;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
get kind() {
|
|
370
|
+
return WireguardNetworkInterfaceTypeDefinition.name;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
get ipAddresses() {
|
|
374
|
+
return new Map();
|
|
375
|
+
}
|
|
376
|
+
}
|
package/src/services/dns.mjs
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { createHmac } from "node:crypto";
|
|
3
3
|
import { FileContentProvider } from "npm-pkgbuild";
|
|
4
|
-
import {
|
|
4
|
+
import { isLinkLocal, reverseArpa } from "ip-utilties";
|
|
5
5
|
import { writeLines } from "../utils.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
DNSRecord,
|
|
8
|
+
dnsFullName,
|
|
9
|
+
dnsRecordTypeForAddressFamily
|
|
10
|
+
} from "../dns-utils.mjs";
|
|
7
11
|
import { addType } from "../types.mjs";
|
|
8
12
|
import { ServiceTypeDefinition, serviceAddresses } from "../service.mjs";
|
|
9
13
|
import {
|
|
@@ -299,7 +303,7 @@ async function generateZoneDefs(dns, location, packageData) {
|
|
|
299
303
|
na => na.networkInterface.kind != "loopback"
|
|
300
304
|
)) {
|
|
301
305
|
zone.records.add(
|
|
302
|
-
DNSRecord("@", na.family
|
|
306
|
+
DNSRecord("@", dnsRecordTypeForAddressFamily(na.family), na.address)
|
|
303
307
|
);
|
|
304
308
|
}
|
|
305
309
|
}
|
|
@@ -364,7 +368,8 @@ async function generateZoneDefs(dns, location, packageData) {
|
|
|
364
368
|
address,
|
|
365
369
|
subnet,
|
|
366
370
|
networkInterface,
|
|
367
|
-
domainNames
|
|
371
|
+
domainNames,
|
|
372
|
+
family
|
|
368
373
|
} of location.networkAddresses()) {
|
|
369
374
|
if (
|
|
370
375
|
!dns.exclude.has(networkInterface.network) &&
|
|
@@ -381,7 +386,7 @@ async function generateZoneDefs(dns, location, packageData) {
|
|
|
381
386
|
zone.records.add(
|
|
382
387
|
DNSRecord(
|
|
383
388
|
dnsFullName(domainName),
|
|
384
|
-
|
|
389
|
+
dnsRecordTypeForAddressFamily(family),
|
|
385
390
|
address
|
|
386
391
|
)
|
|
387
392
|
);
|
package/types/dns-utils.d.mts
CHANGED
|
@@ -10,7 +10,7 @@ export class NetworkAddress {
|
|
|
10
10
|
/** @type {Subnet} */ subnet: Subnet;
|
|
11
11
|
/** @type {NetworkInterface} */ networkInterface: NetworkInterface;
|
|
12
12
|
/** @type {string|Uint8Array|Uint16Array} */ address: string | Uint8Array | Uint16Array;
|
|
13
|
-
get domainNames():
|
|
13
|
+
get domainNames(): any;
|
|
14
14
|
get family(): any;
|
|
15
15
|
get cidrAddress(): any;
|
|
16
16
|
}
|
|
@@ -697,6 +697,331 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
|
|
|
697
697
|
get hostName(): string;
|
|
698
698
|
get ipAddresses(): Map<string, Subnet>;
|
|
699
699
|
}
|
|
700
|
+
export class WireguardNetworkInterface extends SkeletonNetworkInterface {
|
|
701
|
+
static get typeDefinition(): {
|
|
702
|
+
name: string;
|
|
703
|
+
specializationOf: {
|
|
704
|
+
name: string;
|
|
705
|
+
priority: number;
|
|
706
|
+
owners: string[];
|
|
707
|
+
extends: {
|
|
708
|
+
name: string;
|
|
709
|
+
owners: any[];
|
|
710
|
+
properties: {
|
|
711
|
+
owner: {
|
|
712
|
+
type: string;
|
|
713
|
+
collection: boolean;
|
|
714
|
+
writeable: boolean;
|
|
715
|
+
};
|
|
716
|
+
type: {
|
|
717
|
+
type: string;
|
|
718
|
+
collection: boolean;
|
|
719
|
+
writeable: boolean;
|
|
720
|
+
};
|
|
721
|
+
name: {
|
|
722
|
+
type: string;
|
|
723
|
+
collection: boolean;
|
|
724
|
+
identifier: boolean;
|
|
725
|
+
writeable: boolean;
|
|
726
|
+
};
|
|
727
|
+
description: {
|
|
728
|
+
type: string;
|
|
729
|
+
collection: boolean;
|
|
730
|
+
writeable: boolean;
|
|
731
|
+
};
|
|
732
|
+
priority: {
|
|
733
|
+
type: string;
|
|
734
|
+
collection: boolean;
|
|
735
|
+
writeable: boolean;
|
|
736
|
+
};
|
|
737
|
+
directory: {
|
|
738
|
+
type: string;
|
|
739
|
+
collection: boolean;
|
|
740
|
+
writeable: boolean;
|
|
741
|
+
};
|
|
742
|
+
packaging: {
|
|
743
|
+
type: string;
|
|
744
|
+
collection: boolean;
|
|
745
|
+
writeable: boolean;
|
|
746
|
+
};
|
|
747
|
+
tags: {
|
|
748
|
+
type: string;
|
|
749
|
+
collection: boolean;
|
|
750
|
+
writeable: boolean;
|
|
751
|
+
};
|
|
752
|
+
};
|
|
753
|
+
};
|
|
754
|
+
specializations: {};
|
|
755
|
+
factoryFor(value: any): any;
|
|
756
|
+
properties: {
|
|
757
|
+
hostName: {
|
|
758
|
+
type: string;
|
|
759
|
+
collection: boolean;
|
|
760
|
+
writeable: boolean;
|
|
761
|
+
};
|
|
762
|
+
ipAddresses: {
|
|
763
|
+
type: string;
|
|
764
|
+
collection: boolean;
|
|
765
|
+
writeable: boolean;
|
|
766
|
+
};
|
|
767
|
+
hwaddr: {
|
|
768
|
+
type: string;
|
|
769
|
+
collection: boolean;
|
|
770
|
+
writeable: boolean;
|
|
771
|
+
};
|
|
772
|
+
network: {
|
|
773
|
+
type: string;
|
|
774
|
+
collection: boolean;
|
|
775
|
+
writeable: boolean;
|
|
776
|
+
};
|
|
777
|
+
destination: {
|
|
778
|
+
type: string;
|
|
779
|
+
collection: boolean;
|
|
780
|
+
writeable: boolean;
|
|
781
|
+
};
|
|
782
|
+
arpbridge: {
|
|
783
|
+
type: string;
|
|
784
|
+
collection: boolean;
|
|
785
|
+
writeable: boolean;
|
|
786
|
+
};
|
|
787
|
+
cidrAddresses: {
|
|
788
|
+
type: string;
|
|
789
|
+
collection: boolean;
|
|
790
|
+
writeable: boolean;
|
|
791
|
+
};
|
|
792
|
+
cidrAddress: {
|
|
793
|
+
type: string;
|
|
794
|
+
collection: boolean;
|
|
795
|
+
writeable: boolean;
|
|
796
|
+
};
|
|
797
|
+
addresses: {
|
|
798
|
+
type: string;
|
|
799
|
+
collection: boolean;
|
|
800
|
+
writeable: boolean;
|
|
801
|
+
};
|
|
802
|
+
address: {
|
|
803
|
+
type: string;
|
|
804
|
+
collection: boolean;
|
|
805
|
+
writeable: boolean;
|
|
806
|
+
};
|
|
807
|
+
scope: {
|
|
808
|
+
type: string;
|
|
809
|
+
collection: boolean;
|
|
810
|
+
writeable: boolean;
|
|
811
|
+
values: string[];
|
|
812
|
+
default: string;
|
|
813
|
+
};
|
|
814
|
+
class: {
|
|
815
|
+
type: string;
|
|
816
|
+
collection: boolean;
|
|
817
|
+
writeable: boolean;
|
|
818
|
+
values: string[];
|
|
819
|
+
};
|
|
820
|
+
kind: {
|
|
821
|
+
type: string;
|
|
822
|
+
collection: boolean;
|
|
823
|
+
writeable: boolean;
|
|
824
|
+
values: string[];
|
|
825
|
+
};
|
|
826
|
+
ssid: {
|
|
827
|
+
type: string;
|
|
828
|
+
collection: boolean;
|
|
829
|
+
writeable: boolean;
|
|
830
|
+
};
|
|
831
|
+
psk: {
|
|
832
|
+
type: string;
|
|
833
|
+
collection: boolean;
|
|
834
|
+
writeable: boolean;
|
|
835
|
+
};
|
|
836
|
+
metric: {
|
|
837
|
+
type: string;
|
|
838
|
+
collection: boolean;
|
|
839
|
+
writeable: boolean;
|
|
840
|
+
default: number;
|
|
841
|
+
};
|
|
842
|
+
MTU: {
|
|
843
|
+
type: string;
|
|
844
|
+
collection: boolean;
|
|
845
|
+
writeable: boolean;
|
|
846
|
+
default: number;
|
|
847
|
+
};
|
|
848
|
+
gateway: {
|
|
849
|
+
type: string;
|
|
850
|
+
collection: boolean;
|
|
851
|
+
writeable: boolean;
|
|
852
|
+
};
|
|
853
|
+
multicastDNS: {
|
|
854
|
+
type: string;
|
|
855
|
+
collection: boolean;
|
|
856
|
+
writeable: boolean;
|
|
857
|
+
default: boolean;
|
|
858
|
+
};
|
|
859
|
+
};
|
|
860
|
+
};
|
|
861
|
+
owners: string[];
|
|
862
|
+
extends: {
|
|
863
|
+
name: string;
|
|
864
|
+
priority: number;
|
|
865
|
+
owners: string[];
|
|
866
|
+
extends: {
|
|
867
|
+
name: string;
|
|
868
|
+
owners: any[];
|
|
869
|
+
properties: {
|
|
870
|
+
owner: {
|
|
871
|
+
type: string;
|
|
872
|
+
collection: boolean;
|
|
873
|
+
writeable: boolean;
|
|
874
|
+
};
|
|
875
|
+
type: {
|
|
876
|
+
type: string;
|
|
877
|
+
collection: boolean;
|
|
878
|
+
writeable: boolean;
|
|
879
|
+
};
|
|
880
|
+
name: {
|
|
881
|
+
type: string;
|
|
882
|
+
collection: boolean;
|
|
883
|
+
identifier: boolean;
|
|
884
|
+
writeable: boolean;
|
|
885
|
+
};
|
|
886
|
+
description: {
|
|
887
|
+
type: string;
|
|
888
|
+
collection: boolean;
|
|
889
|
+
writeable: boolean;
|
|
890
|
+
};
|
|
891
|
+
priority: {
|
|
892
|
+
type: string;
|
|
893
|
+
collection: boolean;
|
|
894
|
+
writeable: boolean;
|
|
895
|
+
};
|
|
896
|
+
directory: {
|
|
897
|
+
type: string;
|
|
898
|
+
collection: boolean;
|
|
899
|
+
writeable: boolean;
|
|
900
|
+
};
|
|
901
|
+
packaging: {
|
|
902
|
+
type: string;
|
|
903
|
+
collection: boolean;
|
|
904
|
+
writeable: boolean;
|
|
905
|
+
};
|
|
906
|
+
tags: {
|
|
907
|
+
type: string;
|
|
908
|
+
collection: boolean;
|
|
909
|
+
writeable: boolean;
|
|
910
|
+
};
|
|
911
|
+
};
|
|
912
|
+
};
|
|
913
|
+
specializations: {};
|
|
914
|
+
factoryFor(value: any): any;
|
|
915
|
+
properties: {
|
|
916
|
+
hostName: {
|
|
917
|
+
type: string;
|
|
918
|
+
collection: boolean;
|
|
919
|
+
writeable: boolean;
|
|
920
|
+
};
|
|
921
|
+
ipAddresses: {
|
|
922
|
+
type: string;
|
|
923
|
+
collection: boolean;
|
|
924
|
+
writeable: boolean;
|
|
925
|
+
};
|
|
926
|
+
hwaddr: {
|
|
927
|
+
type: string;
|
|
928
|
+
collection: boolean;
|
|
929
|
+
writeable: boolean;
|
|
930
|
+
};
|
|
931
|
+
network: {
|
|
932
|
+
type: string;
|
|
933
|
+
collection: boolean;
|
|
934
|
+
writeable: boolean;
|
|
935
|
+
};
|
|
936
|
+
destination: {
|
|
937
|
+
type: string;
|
|
938
|
+
collection: boolean;
|
|
939
|
+
writeable: boolean;
|
|
940
|
+
};
|
|
941
|
+
arpbridge: {
|
|
942
|
+
type: string;
|
|
943
|
+
collection: boolean;
|
|
944
|
+
writeable: boolean;
|
|
945
|
+
};
|
|
946
|
+
cidrAddresses: {
|
|
947
|
+
type: string;
|
|
948
|
+
collection: boolean;
|
|
949
|
+
writeable: boolean;
|
|
950
|
+
};
|
|
951
|
+
cidrAddress: {
|
|
952
|
+
type: string;
|
|
953
|
+
collection: boolean;
|
|
954
|
+
writeable: boolean;
|
|
955
|
+
};
|
|
956
|
+
addresses: {
|
|
957
|
+
type: string;
|
|
958
|
+
collection: boolean;
|
|
959
|
+
writeable: boolean;
|
|
960
|
+
};
|
|
961
|
+
address: {
|
|
962
|
+
type: string;
|
|
963
|
+
collection: boolean;
|
|
964
|
+
writeable: boolean;
|
|
965
|
+
};
|
|
966
|
+
scope: {
|
|
967
|
+
type: string;
|
|
968
|
+
collection: boolean;
|
|
969
|
+
writeable: boolean;
|
|
970
|
+
values: string[];
|
|
971
|
+
default: string;
|
|
972
|
+
};
|
|
973
|
+
class: {
|
|
974
|
+
type: string;
|
|
975
|
+
collection: boolean;
|
|
976
|
+
writeable: boolean;
|
|
977
|
+
values: string[];
|
|
978
|
+
};
|
|
979
|
+
kind: {
|
|
980
|
+
type: string;
|
|
981
|
+
collection: boolean;
|
|
982
|
+
writeable: boolean;
|
|
983
|
+
values: string[];
|
|
984
|
+
};
|
|
985
|
+
ssid: {
|
|
986
|
+
type: string;
|
|
987
|
+
collection: boolean;
|
|
988
|
+
writeable: boolean;
|
|
989
|
+
};
|
|
990
|
+
psk: {
|
|
991
|
+
type: string;
|
|
992
|
+
collection: boolean;
|
|
993
|
+
writeable: boolean;
|
|
994
|
+
};
|
|
995
|
+
metric: {
|
|
996
|
+
type: string;
|
|
997
|
+
collection: boolean;
|
|
998
|
+
writeable: boolean;
|
|
999
|
+
default: number;
|
|
1000
|
+
};
|
|
1001
|
+
MTU: {
|
|
1002
|
+
type: string;
|
|
1003
|
+
collection: boolean;
|
|
1004
|
+
writeable: boolean;
|
|
1005
|
+
default: number;
|
|
1006
|
+
};
|
|
1007
|
+
gateway: {
|
|
1008
|
+
type: string;
|
|
1009
|
+
collection: boolean;
|
|
1010
|
+
writeable: boolean;
|
|
1011
|
+
};
|
|
1012
|
+
multicastDNS: {
|
|
1013
|
+
type: string;
|
|
1014
|
+
collection: boolean;
|
|
1015
|
+
writeable: boolean;
|
|
1016
|
+
default: boolean;
|
|
1017
|
+
};
|
|
1018
|
+
};
|
|
1019
|
+
};
|
|
1020
|
+
priority: number;
|
|
1021
|
+
properties: {};
|
|
1022
|
+
};
|
|
1023
|
+
get kind(): string;
|
|
1024
|
+
}
|
|
700
1025
|
import { Subnet } from "./subnet.mjs";
|
|
701
1026
|
declare class SkeletonNetworkInterface extends Base {
|
|
702
1027
|
_extends: any[];
|