mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 07:53:19 +00:00
nixos/networkd: add TokenBucketFilter options
This commit is contained in:
parent
55cd970d73
commit
d63035329e
@ -1119,6 +1119,20 @@ let
|
||||
(assertInt "PacketLimit")
|
||||
(assertRange "PacketLimit" 0 4294967294)
|
||||
];
|
||||
|
||||
sectionTokenBucketFilter = checkUnitConfig "TokenBucketFilter" [
|
||||
(assertOnlyFields [
|
||||
"Parent"
|
||||
"Handle"
|
||||
"LatencySec"
|
||||
"LimitBytes"
|
||||
"BurstBytes"
|
||||
"Rate"
|
||||
"MPUBytes"
|
||||
"PeakRate"
|
||||
"MTUBytes"
|
||||
])
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
@ -1809,6 +1823,17 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
tokenBucketFilterConfig = mkOption {
|
||||
default = {};
|
||||
example = { Parent = "ingress"; Rate = "100k"; };
|
||||
type = types.addCheck (types.attrsOf unitOption) check.network.sectionTokenBucketFilter;
|
||||
description = lib.mdDoc ''
|
||||
Each attribute in this set specifies an option in the
|
||||
`[TokenBucketFilter]` section of the unit. See
|
||||
{manpage}`systemd.network(5)` for details.
|
||||
'';
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
@ -2248,6 +2273,10 @@ let
|
||||
[NetworkEmulator]
|
||||
${attrsToSection def.networkEmulatorConfig}
|
||||
''
|
||||
+ optionalString (def.tokenBucketFilterConfig != { }) ''
|
||||
[TokenBucketFilter]
|
||||
${attrsToSection def.tockenBucketFilterConfig}
|
||||
''
|
||||
+ def.extraConfig;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user