nixos/networkd: add TokenBucketFilter options
This commit is contained in:
parent
55cd970d73
commit
d63035329e
1 changed files with 29 additions and 0 deletions
|
@ -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 a new issue