aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-03-17 17:34:27 -0500
committerJP Dillingham <jp@dillingham.me>2024-03-17 17:34:27 -0500
commit46db12ccfec443341d0a64888e7601667d0b6f0d (patch)
treea69e49218d220e2b971a8a7b15e4fa994b1a8d5d
parentfcde0fb58aa3a4e8aa7fc268c286842de39a9bb5 (diff)
downloadslskd-46db12ccfec443341d0a64888e7601667d0b6f0d.tar.gz
remove i/o
-rw-r--r--src/slskd/Core/Options.cs34
1 files changed, 2 insertions, 32 deletions
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index e0ee1aa4..c38cf85e 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -24,6 +24,7 @@ namespace slskd
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
+ using System.IO;
using System.Linq;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
@@ -982,11 +983,6 @@ namespace slskd
public string[] Members { get; init; } = Array.Empty<string>();
/// <summary>
- /// A pre-parsed cache of IPAddressRange objects describing all blacklisted ranges.
- /// </summary>
- private List<IPAddressRange> BlacklistedCIDRs = new List<IPAddressRange>();
-
- /// <summary>
/// Gets the list of group CIDRs.
/// </summary>
public string[] Cidrs { get; init; } = Array.Empty<string>();
@@ -1019,32 +1015,6 @@ namespace slskd
}
}
- // if a blacklist file is specified, process it too.
- if (!string.IsNullOrEmpty(BlacklistFile))
- {
- try
- {
- var lines = System.IO.File.ReadAllLines(BlacklistFile).Where(line => !string.IsNullOrWhiteSpace(line) && !line.StartsWith("#"));
- foreach (var cidr in lines)
- {
- try
- {
- cache.Add(IPAddressRange.Parse(cidr));
- }
- catch (Exception ex)
- {
- results.Add(new ValidationResult($"CIDR {cidr} in blacklist file is invalid: {ex.Message}"));
- }
- }
- }
- catch (Exception ex)
- {
- results.Add(new ValidationResult($"CIDR blacklist file {BlacklistFile} could not be loaded: {ex.Message}"));
- }
- }
-
- BlacklistedCIDRs = cache.Distinct().ToList();
-
return results;
}
}
@@ -1883,7 +1853,7 @@ namespace slskd
[Argument(default, "https-cert-pfx")]
[EnvironmentVariable("HTTPS_CERT_PFX")]
[Description("path to X509 certificate .pfx")]
- [FileExists]
+ [FileExists(FileAccess.Read)]
[RequiresRestart]
public string Pfx { get; init; }