|
|
@ -84,7 +84,7 @@ namespace Jellyfin.Networking.Manager
|
|
|
|
private Collection<IPObject> _internalInterfaces;
|
|
|
|
private Collection<IPObject> _internalInterfaces;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Flag set when no custom LAN has been defined in the config.
|
|
|
|
/// Flag set when no custom LAN has been defined in the configuration.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
private bool _usingPrivateAddresses;
|
|
|
|
private bool _usingPrivateAddresses;
|
|
|
|
|
|
|
|
|
|
|
@ -228,7 +228,7 @@ namespace Jellyfin.Networking.Manager
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public Collection<IPObject> CreateIPCollection(string[] values, bool bracketed = false)
|
|
|
|
public Collection<IPObject> CreateIPCollection(string[] values, bool negated = false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Collection<IPObject> col = new Collection<IPObject>();
|
|
|
|
Collection<IPObject> col = new Collection<IPObject>();
|
|
|
|
if (values == null)
|
|
|
|
if (values == null)
|
|
|
@ -242,21 +242,14 @@ namespace Jellyfin.Networking.Manager
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (v.StartsWith('[') && v.EndsWith(']'))
|
|
|
|
if (v.StartsWith('!'))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (bracketed)
|
|
|
|
if (negated)
|
|
|
|
{
|
|
|
|
|
|
|
|
AddToCollection(col, v[1..^1]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (v.StartsWith('!'))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (bracketed)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AddToCollection(col, v[1..]);
|
|
|
|
AddToCollection(col, v[1..]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!bracketed)
|
|
|
|
else if (!negated)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AddToCollection(col, v);
|
|
|
|
AddToCollection(col, v);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -730,7 +723,7 @@ namespace Jellyfin.Networking.Manager
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Parses a string and adds it into the the collection, replacing any interface references.
|
|
|
|
/// Parses a string and adds it into the collection, replacing any interface references.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="col"><see cref="Collection{IPObject}"/>Collection.</param>
|
|
|
|
/// <param name="col"><see cref="Collection{IPObject}"/>Collection.</param>
|
|
|
|
/// <param name="token">String value to parse.</param>
|
|
|
|
/// <param name="token">String value to parse.</param>
|
|
|
@ -755,7 +748,19 @@ namespace Jellyfin.Networking.Manager
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (TryParse(token, out IPObject obj))
|
|
|
|
else if (TryParse(token, out IPObject obj))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!IsIP6Enabled)
|
|
|
|
// Expand if the ip address is "any".
|
|
|
|
|
|
|
|
if ((obj.Address.Equals(IPAddress.Any) && IsIP4Enabled)
|
|
|
|
|
|
|
|
|| (obj.Address.Equals(IPAddress.IPv6Any) && IsIP6Enabled))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (IPNetAddress iface in _interfaceAddresses)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (obj.AddressFamily == iface.AddressFamily)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
col.AddItem(iface);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (!IsIP6Enabled)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Remove IP6 addresses from multi-homed IPHosts.
|
|
|
|
// Remove IP6 addresses from multi-homed IPHosts.
|
|
|
|
obj.Remove(AddressFamily.InterNetworkV6);
|
|
|
|
obj.Remove(AddressFamily.InterNetworkV6);
|
|
|
@ -872,7 +877,7 @@ namespace Jellyfin.Networking.Manager
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var replacement = parts[1].Trim();
|
|
|
|
var replacement = parts[1].Trim();
|
|
|
|
if (string.Equals(parts[0], "remaining", StringComparison.OrdinalIgnoreCase))
|
|
|
|
if (string.Equals(parts[0], "all", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_publishedServerUrls[new IPNetAddress(IPAddress.Broadcast)] = replacement;
|
|
|
|
_publishedServerUrls[new IPNetAddress(IPAddress.Broadcast)] = replacement;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -956,7 +961,7 @@ namespace Jellyfin.Networking.Manager
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.LogDebug("Refreshing LAN information.");
|
|
|
|
_logger.LogDebug("Refreshing LAN information.");
|
|
|
|
|
|
|
|
|
|
|
|
// Get config options.
|
|
|
|
// Get configuration options.
|
|
|
|
string[] subnets = config.LocalNetworkSubnets;
|
|
|
|
string[] subnets = config.LocalNetworkSubnets;
|
|
|
|
|
|
|
|
|
|
|
|
// Create lists from user settings.
|
|
|
|
// Create lists from user settings.
|
|
|
|