diff options
author | zimbatm <zimbatm@zimbatm.com> | 2017-12-04 12:05:05 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-04 12:05:05 +0000 |
commit | 3807408c383b57805d27eb8293bd19cac591291a (patch) | |
tree | 099e98855804e0bda7a06e16621148b3a3edd9b0 /nixos | |
parent | 852fe5582292ce5ea826673da9497c75fc04139d (diff) | |
parent | a8f1ebf52c9a30b0beef2d4c895aa28e5e644921 (diff) | |
download | nixpkgs-3807408c383b57805d27eb8293bd19cac591291a.tar nixpkgs-3807408c383b57805d27eb8293bd19cac591291a.tar.gz nixpkgs-3807408c383b57805d27eb8293bd19cac591291a.tar.bz2 nixpkgs-3807408c383b57805d27eb8293bd19cac591291a.tar.lz nixpkgs-3807408c383b57805d27eb8293bd19cac591291a.tar.xz nixpkgs-3807408c383b57805d27eb8293bd19cac591291a.tar.zst nixpkgs-3807408c383b57805d27eb8293bd19cac591291a.zip |
Merge pull request #32212 from ryantrinkle/nat-port-forwarding-ranges
Nat port forwarding ranges
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/doc/manual/development/option-types.xml | 6 | ||||
-rw-r--r-- | nixos/modules/services/networking/nat.nix | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/nixos/doc/manual/development/option-types.xml b/nixos/doc/manual/development/option-types.xml index 83dcf0232d9..ec940d5d2b8 100644 --- a/nixos/doc/manual/development/option-types.xml +++ b/nixos/doc/manual/development/option-types.xml @@ -110,6 +110,12 @@ <listitem><para>A string. Multiple definitions are concatenated with a collon <literal>":"</literal>.</para></listitem> </varlistentry> + <varlistentry> + <term><varname>types.strMatching</varname></term> + <listitem><para>A string matching a specific regular expression. Multiple + definitions cannot be merged. The regular expression is processed using + <literal>builtins.match</literal>.</para></listitem> + </varlistentry> </variablelist> </section> diff --git a/nixos/modules/services/networking/nat.nix b/nixos/modules/services/networking/nat.nix index 9b04cf557fa..bfaf30c1178 100644 --- a/nixos/modules/services/networking/nat.nix +++ b/nixos/modules/services/networking/nat.nix @@ -131,15 +131,15 @@ in type = with types; listOf (submodule { options = { sourcePort = mkOption { - type = types.int; + type = types.either types.int (types.strMatching "[[:digit:]]+:[[:digit:]]+"); example = 8080; - description = "Source port of the external interface"; + description = "Source port of the external interface; to specify a port range, use a string with a colon (e.g. \"60000:61000\")"; }; destination = mkOption { type = types.str; example = "10.0.0.1:80"; - description = "Forward connection to destination ip:port"; + description = "Forward connection to destination ip:port; to specify a port range, use ip:start-end"; }; proto = mkOption { |