From 46db12ccfec443341d0a64888e7601667d0b6f0d Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 17 Mar 2024 17:34:27 -0500 Subject: remove i/o --- src/slskd/Core/Options.cs | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) (limited to 'src') 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; @@ -981,11 +982,6 @@ namespace slskd /// public string[] Members { get; init; } = Array.Empty(); - /// - /// A pre-parsed cache of IPAddressRange objects describing all blacklisted ranges. - /// - private List BlacklistedCIDRs = new List(); - /// /// Gets the list of group CIDRs. /// @@ -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; } -- cgit v1.2.3