summaryrefslogtreecommitdiff
path: root/modules/wg/options.nix
blob: 4f090d034ce3351c9c9f3d84b055b810d3bb9993 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{ lib
, ...}:
{
  options.oxalab.wg = with lib;
  lib.mkOption {
    default = [];
    type = types.listOf (types.submodule {
      options = {
        # general network stuff
        networkName = mkOption {
          type = types.nullOr types.str;
          default = null;
        };
        CIDRs = mkOption {
          type = types.nullOr (types.listOf types.str);
          default = null;
        };

        hosts = mkOption {
          default = {};
          type = types.attrsOf (types.submodule {
            options = {

              enable = mkOption {
                type = types.bool;
                default = true;
              };
              address = mkOption {
                type = types.listOf types.str;
                default = null;
              };
              publicKey = mkOption {
                type = types.str;
                default = null;
              };
              privateKeyFile = mkOption {
                type = types.path;
                default = null;
              };

              endpoint.enable = mkOption {
                type = types.bool;
                default = false;
              };
              endpoint.endpoint = mkOption {
                type = types.nullOr types.str;
                default = null;
              };
              endpoint.port = mkOption {
                type = types.nullOr types.int;
                default = null;
              };
              endpoint.publicIface = mkOption {
                type = types.nullOr types.str;
                default = null;
              };

              endpoint.extraPeers = mkOption {
                default = [];
                type = types.listOf (types.submodule {
                  options = {
                    address = mkOption {
                      type = types.listOf types.str;
                      default = [];
                    };
                    publicKey = mkOption {
                      type = types.nullOr types.str;
                      default = null;
                    };
                  };
                });
              };
            };
          });
        };
      };
    });
  };
}