diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-04-27 20:36:53 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-27 20:36:53 -0500 |
| commit | 8c611f627b1859a1d9963388fb40f7dfeaeda652 (patch) | |
| tree | 6564d337d0fe73a3c2f93b601e3e782e42f964c1 /src/slskd/Core | |
| parent | cb4d254099cf846f918214c2be07341d93d90900 (diff) | |
| parent | 2b97e3ef7f65b57c3cbe2f3298aef4f856a47985 (diff) | |
| download | slskd-8c611f627b1859a1d9963388fb40f7dfeaeda652.tar.gz | |
Merge branch 'master' into docker-volume
Diffstat (limited to 'src/slskd/Core')
| -rw-r--r-- | src/slskd/Core/Options.cs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 7b38143e..8cc369af 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -50,6 +50,7 @@ namespace slskd using slskd.Events; using slskd.Relay; using slskd.Shares; + using slskd.Transfers; using slskd.Validation; using Utility.CommandLine; using Utility.EnvironmentVariables; @@ -1010,6 +1011,42 @@ namespace slskd [Description("the total download speed limit")] [Range(1, int.MaxValue)] public int SpeedLimit { get; init; } = int.MaxValue; + + /// <summary> + /// Gets download retry options. + /// </summary> + [Validate] + public RetryOptions Retry { get; init; } = new RetryOptions(); + + /// <summary> + /// Download retry options. + /// </summary> + public class RetryOptions + { + /// <summary> + /// Gets the maximum number of times to retry a failed transfer. + /// </summary> + [Range(1, int.MaxValue)] + public int Attempts { get; init; } = 3; + + /// <summary> + /// Gets the base time to wait between retry attempts, in milliseconds. + /// </summary> + [Range(1000, int.MaxValue)] + public int Delay { get; init; } = 5000; + + /// <summary> + /// Gets the maximum time to wait between retry attempts, in milliseconds. + /// </summary> + [Range(30_000, int.MaxValue)] + public int MaxDelay { get; init; } = 60_000; + + /// <summary> + /// Gets the strategy for handling incomplete files upon retry. + /// </summary> + [Enum(typeof(RetryIncompleteStrategy))] + public string Incomplete { get; init; } = RetryIncompleteStrategy.Overwrite.ToString().ToLowerInvariant(); + } } /// <summary> @@ -1150,6 +1187,11 @@ namespace slskd public string[] Members { get; init; } = Array.Empty<string>(); /// <summary> + /// Gets the list of regular expression patterns matched against usernames. + /// </summary> + public string[] Patterns { get; init; } = Array.Empty<string>(); + + /// <summary> /// Gets the list of group CIDRs. /// </summary> public string[] Cidrs { get; init; } = Array.Empty<string>(); @@ -1163,6 +1205,14 @@ namespace slskd { var results = new List<ValidationResult>(); + foreach (var pattern in Patterns ?? Array.Empty<string>()) + { + if (!pattern.IsValidRegex()) + { + results.Add(new ValidationResult($"Pattern '{pattern}' is not a valid regular expression")); + } + } + foreach (var cidr in Cidrs ?? Array.Empty<string>()) { try |
