aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2022-02-28 07:41:55 -0600
committerJP Dillingham <jpdillingham@gmail.com>2022-02-28 07:41:55 -0600
commit9aff760ef3f7d1f8db925a8a5078d1fb7e7184bb (patch)
treed470370a75e6ea15a2639dd0cbe026238a9bc49e
parent8c7861a0dfc2fd25379e03e1f23b4ae561206fc3 (diff)
downloadslskd-9aff760ef3f7d1f8db925a8a5078d1fb7e7184bb.tar.gz
add threshold options for the leecher group
-rw-r--r--config/slskd.example.yml3
-rw-r--r--src/slskd/Options.cs38
2 files changed, 40 insertions, 1 deletions
diff --git a/config/slskd.example.yml b/config/slskd.example.yml
index 2bf0863b..21c95076 100644
--- a/config/slskd.example.yml
+++ b/config/slskd.example.yml
@@ -25,6 +25,9 @@
# strategy: roundrobin
# slots: 10
# leechers:
+# thresholds:
+# files: 1
+# directories: 1
# upload:
# priority: 999
# strategy: roundrobin
diff --git a/src/slskd/Options.cs b/src/slskd/Options.cs
index 5bebeb68..83e72586 100644
--- a/src/slskd/Options.cs
+++ b/src/slskd/Options.cs
@@ -480,7 +480,7 @@ namespace slskd
/// These options apply to users that have been identified as leechers, and have not been added as a member of any group.
/// </remarks>
[Validate]
- public BuiltInOptions Leechers { get; init; } = new BuiltInOptions();
+ public LeecherOptions Leechers { get; init; } = new LeecherOptions();
/// <summary>
/// Gets user defined groups and options.
@@ -514,6 +514,42 @@ namespace slskd
}
/// <summary>
+ /// Built in leecher group options.
+ /// </summary>
+ public class LeecherOptions
+ {
+ /// <summary>
+ /// Gets leecher threshold options.
+ /// </summary>
+ [Validate]
+ public ThresholdOptions Thresholds { get; init } = new ThresholdOptions();
+
+ /// <summary>
+ /// Gets upload options.
+ /// </summary>
+ [Validate]
+ public UploadOptions Upload { get; init; } = new UploadOptions();
+ }
+
+ /// <summary>
+ /// Leecher threshold options.
+ /// </summary>
+ public class ThresholdOptions
+ {
+ /// <summary>
+ /// Gets the minimum number of shared files required to avoid being classified as a leecher.
+ /// </summary>
+ [Range(1, int.MaxValue)]
+ public int Files { get; init; } = 1;
+
+ /// <summary>
+ /// Gets the minimum number of shared directories required to avoid being classified as a leecher.
+ /// </summary>
+ [Range(1, int.MaxValue)]
+ public int Directories { get; init; } = 1;
+ }
+
+ /// <summary>
/// User defined user group options.
/// </summary>
public class UserDefinedOptions