Fix build

This commit is contained in:
Shadowghost 2022-07-19 21:53:10 +02:00
parent 066db8ac7f
commit 997aa3f1e7
3 changed files with 10 additions and 10 deletions

View File

@ -241,7 +241,7 @@ namespace Jellyfin.Networking.Manager
{
var interfaceObject = new IPData(info.Address, new IPNetwork(info.Address, info.PrefixLength), adapter.Name);
interfaceObject.Index = ipProperties.GetIPv4Properties().Index;
interfaceObject.Name = adapter.Name.ToLower(CultureInfo.InvariantCulture);
interfaceObject.Name = adapter.Name.ToLowerInvariant();
_interfaces.Add(interfaceObject);
}
@ -249,7 +249,7 @@ namespace Jellyfin.Networking.Manager
{
var interfaceObject = new IPData(info.Address, new IPNetwork(info.Address, info.PrefixLength), adapter.Name);
interfaceObject.Index = ipProperties.GetIPv6Properties().Index;
interfaceObject.Name = adapter.Name.ToLower(CultureInfo.InvariantCulture);
interfaceObject.Name = adapter.Name.ToLowerInvariant();
_interfaces.Add(interfaceObject);
}
@ -381,7 +381,7 @@ namespace Jellyfin.Networking.Manager
if (config.IgnoreVirtualInterfaces)
{
// Remove potentially exisiting * and split config string into prefixes
var virtualInterfacePrefixes = config.VirtualInterfaceNames.Replace("*", string.Empty, StringComparison.OrdinalIgnoreCase).ToLower().Split(',');
var virtualInterfacePrefixes = config.VirtualInterfaceNames.Replace("*", string.Empty, StringComparison.OrdinalIgnoreCase).ToLowerInvariant().Split(',');
// Check all interfaces for matches against the prefixes and add the interface IPs to _bindExclusions
if (_bindAddresses.Count > 0 && virtualInterfacePrefixes.Length > 0)
@ -419,10 +419,10 @@ namespace Jellyfin.Networking.Manager
if (remoteIPFilter.Any() && !string.IsNullOrWhiteSpace(remoteIPFilter.First()))
{
// Parse all IPs with netmask to a subnet
_ = TryParseSubnets(remoteIPFilter.Where(x => x.Contains("/", StringComparison.OrdinalIgnoreCase)).ToArray(), out _remoteAddressFilter, false);
_ = TryParseSubnets(remoteIPFilter.Where(x => x.Contains('/', StringComparison.OrdinalIgnoreCase)).ToArray(), out _remoteAddressFilter, false);
// Parse everything else as an IP and construct subnet with a single IP
var ips = remoteIPFilter.Where(x => !x.Contains("/", StringComparison.OrdinalIgnoreCase));
var ips = remoteIPFilter.Where(x => !x.Contains('/', StringComparison.OrdinalIgnoreCase));
foreach (var ip in ips)
{
if (IPAddress.TryParse(ip, out var ipp))
@ -573,7 +573,7 @@ namespace Jellyfin.Networking.Manager
if (_interfaces != null)
{
// Match all interfaces starting with names starting with token
var matchedInterfaces = _interfaces.Where(s => s.Name.Equals(intf.ToLower(CultureInfo.InvariantCulture), StringComparison.OrdinalIgnoreCase));
var matchedInterfaces = _interfaces.Where(s => s.Name.Equals(intf.ToLowerInvariant(), StringComparison.OrdinalIgnoreCase));
if (matchedInterfaces.Any())
{
_logger.LogInformation("Interface {Token} used in settings. Using its interface addresses.", intf);
@ -998,7 +998,7 @@ namespace Jellyfin.Networking.Manager
var validPublishedServerUrls = _publishedServerUrls.Where(x => x.Key.Address.Equals(IPAddress.Any)).ToList();
validPublishedServerUrls.AddRange(_publishedServerUrls.Where(x => x.Key.Address.Equals(IPAddress.IPv6Any)));
validPublishedServerUrls.AddRange(_publishedServerUrls.Where(x => x.Key.Subnet.Contains(source)));
validPublishedServerUrls.Distinct();
validPublishedServerUrls = validPublishedServerUrls.GroupBy(x => x.Key).Select(y => y.First()).ToList();
// Check for user override.
foreach (var data in validPublishedServerUrls)

View File

@ -18,12 +18,12 @@ namespace MediaBrowser.Common.Net
event EventHandler NetworkChanged;
/// <summary>
/// Gets a value indicating whether iP6 is enabled.
/// Gets a value indicating whether IPv6 is enabled.
/// </summary>
bool IsIpv6Enabled { get; }
/// <summary>
/// Gets a value indicating whether iP4 is enabled.
/// Gets a value indicating whether IPv4 is enabled.
/// </summary>
bool IsIpv4Enabled { get; }

View File

@ -58,7 +58,7 @@ namespace Jellyfin.Networking.Tests
using var nm = new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
NetworkManager.MockNetworkSettings = string.Empty;
Assert.Equal(value, "[" + String.Join(",", nm.GetInternalBindAddresses().Select(x => x.Address + "/" + x.Subnet.PrefixLength)) + "]");
Assert.Equal(value, "[" + string.Join(",", nm.GetInternalBindAddresses().Select(x => x.Address + "/" + x.Subnet.PrefixLength)) + "]");
}
[Theory]