mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 05:47:14 -04:00
Fixing this required the removal of the code that attempted to detect virtual interfaces. Not wanting to remove functionality, but not able to keep the code in place, I implemented a work around solution (see 4 below). Whilst in the area, I also fixed a few minor bugs i encountered (1, 5, 6 below) and stopped SSDP messages from going out on non-LAN interfaces (3) All these changes are related. Changes 1 IsInPrivateAddressSpace - improved subnet code checking 2 interfaces with no gateway were being excluded from SSDP blasts 3 filtered SSDP blasts from not LAN addresses as defined on the network page. 4 removed #986 mod - as this was part of the issue of #2986. Interfaces can be excluded from the LAN by putting the LAN address in brackets. eg. [10.1.1.1] will exclude an interface with ip address 10.1.1.1 from SSDP 5 fixed a problem where an invalid LAN address causing the SSDP to crash 6 corrected local link filter (FilterIPAddress) to filter on 169.254. addresses
55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
#pragma warning disable CS1591
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Net;
|
|
using System.Net.NetworkInformation;
|
|
|
|
namespace MediaBrowser.Common.Net
|
|
{
|
|
public interface INetworkManager
|
|
{
|
|
event EventHandler NetworkChanged;
|
|
|
|
Func<string[]> LocalSubnetsFn { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets a random port number that is currently available.
|
|
/// </summary>
|
|
/// <returns>System.Int32.</returns>
|
|
int GetRandomUnusedTcpPort();
|
|
|
|
int GetRandomUnusedUdpPort();
|
|
|
|
/// <summary>
|
|
/// Returns the MAC Address from first Network Card in Computer.
|
|
/// </summary>
|
|
/// <returns>The MAC Address.</returns>
|
|
List<PhysicalAddress> GetMacAddresses();
|
|
|
|
/// <summary>
|
|
/// Determines whether [is in private address space] [the specified endpoint].
|
|
/// </summary>
|
|
/// <param name="endpoint">The endpoint.</param>
|
|
/// <returns><c>true</c> if [is in private address space] [the specified endpoint]; otherwise, <c>false</c>.</returns>
|
|
bool IsInPrivateAddressSpace(string endpoint);
|
|
|
|
/// <summary>
|
|
/// Determines whether [is in local network] [the specified endpoint].
|
|
/// </summary>
|
|
/// <param name="endpoint">The endpoint.</param>
|
|
/// <returns><c>true</c> if [is in local network] [the specified endpoint]; otherwise, <c>false</c>.</returns>
|
|
bool IsInLocalNetwork(string endpoint);
|
|
|
|
IPAddress[] GetLocalIpAddresses();
|
|
|
|
bool IsAddressInSubnets(string addressString, string[] subnets);
|
|
|
|
bool IsAddressInSubnets(IPAddress address, bool excludeInterfaces, bool excludeRFC);
|
|
|
|
bool IsInSameSubnet(IPAddress address1, IPAddress address2, IPAddress subnetMask);
|
|
|
|
IPAddress GetLocalIpSubnetMask(IPAddress address);
|
|
}
|
|
}
|