aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Core
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-02-04 16:00:49 -0600
committerJP Dillingham <jp@dillingham.me>2024-02-04 16:00:49 -0600
commite49ce88e3487f424b2fc824d13b08086f00f633e (patch)
tree384e8b64b4ed219e43c12cf080f2b430fd380b5b /src/slskd/Core
parentf07c2cab4c4226e40be989d1a40aea0296a1756b (diff)
downloadslskd-e49ce88e3487f424b2fc824d13b08086f00f633e.tar.gz
add global limits
Diffstat (limited to 'src/slskd/Core')
-rw-r--r--src/slskd/Core/Options.cs102
1 files changed, 54 insertions, 48 deletions
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index 2aadf206..992541bc 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -787,6 +787,12 @@ namespace slskd
public GlobalUploadOptions Upload { get; init; } = new GlobalUploadOptions();
/// <summary>
+ /// Gets global limits.
+ /// </summary>
+ [Validate]
+ public LimitsOptions Limits { get; init; } = new LimitsOptions();
+
+ /// <summary>
/// Gets global download options.
/// </summary>
[Validate]
@@ -844,6 +850,54 @@ namespace slskd
}
/// <summary>
+ /// Limit options.
+ /// </summary>
+ public class LimitsOptions
+ {
+ /// <summary>
+ /// Gets limits for queued transfers.
+ /// </summary>
+ [Validate]
+ public Limits Queued { get; init; } = new Limits();
+
+ /// <summary>
+ /// Gets daily limits for transfers.
+ /// </summary>
+ [Validate]
+ public Limits Daily { get; init; } = new Limits();
+
+ /// <summary>
+ /// Gets weekly limits for transfers.
+ /// </summary>
+ [Validate]
+ public Limits Weekly { get; init; } = new Limits();
+
+ /// <summary>
+ /// Limits.
+ /// </summary>
+ public class Limits
+ {
+ /// <summary>
+ /// Gets the limit for number of files.
+ /// </summary>
+ [Range(1, int.MaxValue)]
+ public int? Files { get; init; } = null;
+
+ /// <summary>
+ /// Gets the limit for number of megabytes.
+ /// </summary>
+ [Range(1, int.MaxValue)]
+ public int? Megabytes { get; init; } = null;
+
+ /// <summary>
+ /// Gets the limit for number of failures.
+ /// </summary>
+ [Range(1, int.MaxValue)]
+ public int? Failures { get; init; } = null;
+ }
+ }
+
+ /// <summary>
/// User groups.
/// </summary>
public class GroupsOptions : IValidatableObject
@@ -1027,54 +1081,6 @@ namespace slskd
[Range(1, int.MaxValue)]
public int SpeedLimit { get; init; } = int.MaxValue;
}
-
- /// <summary>
- /// Upload limit options.
- /// </summary>
- public class LimitsOptions
- {
- /// <summary>
- /// Gets limits for queued transfers.
- /// </summary>
- [Validate]
- public LimitsExtendedOptions Queued { get; init; } = new LimitsExtendedOptions();
-
- /// <summary>
- /// Gets daily limits for transfers.
- /// </summary>
- [Validate]
- public LimitsExtendedOptions Daily { get; init; } = new LimitsExtendedOptions();
-
- /// <summary>
- /// Gets weekly limits for transfers.
- /// </summary>
- [Validate]
- public LimitsExtendedOptions Weekly { get; init; } = new LimitsExtendedOptions();
- }
-
- /// <summary>
- /// Extended limit options.
- /// </summary>
- public class LimitsExtendedOptions
- {
- /// <summary>
- /// Gets the limit for number of files.
- /// </summary>
- [Range(-1, int.MaxValue)]
- public int? Files { get; init; } = null;
-
- /// <summary>
- /// Gets the limit for number of megabytes.
- /// </summary>
- [Range(-1, int.MaxValue)]
- public int? Megabytes { get; init; } = null;
-
- /// <summary>
- /// Gets the limit for number of failures.
- /// </summary>
- [Range(-1, int.MaxValue)]
- public int? Failures { get; init; } = null;
- }
}
/// <summary>