Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@
};

key = mkOption {
type = types.str;
description = "Obfuscation key (must match on both sides)";
type = types.nullOr types.str;
default = null;
description = "Obfuscation key (must match on both sides; required when keyFile is not set)";
example = "your_secret_key";
};

Expand Down Expand Up @@ -202,9 +203,17 @@
}
{
assertion = all (inst:
inst.enable -> (inst.key != "" || inst.keyFile != null)
inst.enable ->
(
inst.keyFile != null
|| (
inst.key != null
&& builtins.stringLength inst.key >= 1
&& builtins.stringLength inst.key <= 255
)
)
) (attrValues cfg.instances);
message = "Each enabled wg-obfuscator instance must have either 'key' or 'keyFile' set";
message = "Each enabled wg-obfuscator instance must have either 'keyFile' set, or 'key' set to a string of length 1–255 characters";
}
];

Expand Down Expand Up @@ -263,7 +272,7 @@
max-clients = ${toString inst.maxClients}
idle-timeout = ${toString inst.idleTimeout}
max-dummy = ${toString inst.maxDummy}
'') (attrValues instances)
'') instances
)}
EOF

Expand Down
Loading