pmcf 2.23.0 → 2.24.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": "2.23.0",
3
+ "version": "2.24.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -5,7 +5,11 @@ import {
5
5
  formatCIDR
6
6
  } from "ip-utilties";
7
7
  import { Base } from "./base.mjs";
8
- import { Subnet } from "./subnet.mjs";
8
+ import {
9
+ Subnet,
10
+ SUBNET_LOCALHOST_IPV4,
11
+ SUBNET_LOCALHOST_IPV6
12
+ } from "./subnet.mjs";
9
13
  import {
10
14
  networkProperties,
11
15
  networkAddressProperties
@@ -314,8 +318,8 @@ const LoopbackNetworkInterfaceTypeDefinition = {
314
318
  };
315
319
 
316
320
  const _localAddresses = new Map([
317
- ["127.0.0.1", { address: "127.0.0/8", prefix: "127.0.0", prefixLength: 8 }], // TODO
318
- ["::1", { address: "::1/128", prefix: "::1", prefixLength: 128 }]
321
+ ["127.0.0.1", SUBNET_LOCALHOST_IPV4],
322
+ ["::1", SUBNET_LOCALHOST_IPV6]
319
323
  ]);
320
324
 
321
325
  export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
@@ -328,7 +332,7 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
328
332
  }
329
333
 
330
334
  get kind() {
331
- return "loopback";
335
+ return LoopbackNetworkInterfaceTypeDefinition.name;
332
336
  }
333
337
 
334
338
  get scope() {
@@ -343,3 +347,30 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
343
347
  return _localAddresses;
344
348
  }
345
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/subnet.mjs CHANGED
@@ -83,6 +83,10 @@ export class Subnet extends Base {
83
83
  }
84
84
  }
85
85
 
86
+ const _owner = { addObject() {} };
87
+ export const SUBNET_LOCALHOST_IPV4 = new Subnet(_owner, "127.0.0.1/8");
88
+ export const SUBNET_LOCALHOST_IPV6 = new Subnet(_owner, "::1/128");
89
+
86
90
  export function subnets(sources) {
87
91
  const all = new Set();
88
92
 
@@ -695,11 +695,332 @@ export class LoopbackNetworkInterface extends SkeletonNetworkInterface {
695
695
  get kind(): string;
696
696
  get scope(): string;
697
697
  get hostName(): string;
698
- get ipAddresses(): Map<string, {
699
- address: string;
700
- prefix: string;
701
- prefixLength: number;
702
- }>;
698
+ get ipAddresses(): Map<string, Subnet>;
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;
703
1024
  }
704
1025
  import { Subnet } from "./subnet.mjs";
705
1026
  declare class SkeletonNetworkInterface extends Base {
@@ -37,4 +37,6 @@ export class Subnet extends Base {
37
37
  get longAddress(): string;
38
38
  _traverse(...args: any[]): boolean;
39
39
  }
40
+ export const SUBNET_LOCALHOST_IPV4: Subnet;
41
+ export const SUBNET_LOCALHOST_IPV6: Subnet;
40
42
  import { Base } from "./base.mjs";