nat: support port ranges in networking.nat.forwardPorts

This commit is contained in:
Ryan Trinkle 2017-11-30 13:36:48 -05:00
parent 83048c4fe0
commit a8f1ebf52c
1 changed files with 3 additions and 3 deletions

View File

@ -125,15 +125,15 @@ in
type = with types; listOf (submodule { type = with types; listOf (submodule {
options = { options = {
sourcePort = mkOption { sourcePort = mkOption {
type = types.int; type = types.either types.int (types.strMatching "[[:digit:]]+:[[:digit:]]+");
example = 8080; 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 { destination = mkOption {
type = types.str; type = types.str;
example = "10.0.0.1:80"; 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 { proto = mkOption {