2019-01-13 20:02:23 +00:00
|
|
|
using System;
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
namespace MediaBrowser.Model.Net
|
|
|
|
{
|
|
|
|
public class IpAddressInfo
|
|
|
|
{
|
|
|
|
public static IpAddressInfo Any = new IpAddressInfo("0.0.0.0", IpAddressFamily.InterNetwork);
|
|
|
|
public static IpAddressInfo IPv6Any = new IpAddressInfo("00000000000000000000", IpAddressFamily.InterNetworkV6);
|
|
|
|
public static IpAddressInfo Loopback = new IpAddressInfo("127.0.0.1", IpAddressFamily.InterNetwork);
|
|
|
|
public static IpAddressInfo IPv6Loopback = new IpAddressInfo("::1", IpAddressFamily.InterNetworkV6);
|
|
|
|
|
|
|
|
public string Address { get; set; }
|
2019-02-22 04:06:49 +00:00
|
|
|
public IpAddressInfo SubnetMask { get; set; }
|
2018-12-27 23:27:57 +00:00
|
|
|
public IpAddressFamily AddressFamily { get; set; }
|
|
|
|
|
|
|
|
public IpAddressInfo(string address, IpAddressFamily addressFamily)
|
|
|
|
{
|
|
|
|
Address = address;
|
|
|
|
AddressFamily = addressFamily;
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool Equals(IpAddressInfo address)
|
|
|
|
{
|
|
|
|
return string.Equals(address.Address, Address, StringComparison.OrdinalIgnoreCase);
|
|
|
|
}
|
|
|
|
|
2019-01-06 20:50:43 +00:00
|
|
|
public override string ToString()
|
2018-12-27 23:27:57 +00:00
|
|
|
{
|
|
|
|
return Address;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public enum IpAddressFamily
|
|
|
|
{
|
|
|
|
InterNetwork,
|
|
|
|
InterNetworkV6
|
|
|
|
}
|
|
|
|
}
|