You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

34 lines
947 B

using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
using System.Net;
namespace Znyc.Cloudcar.Admin.Commons.Net
{
public class RemoteIpParser : IIpAddressParser
{
public bool ContainsIp(string ipRule, string clientIp)
{
return IpAddressUtil.ContainsIp(ipRule, clientIp);
}
public bool ContainsIp(List<string> ipRules, string clientIp)
{
return IpAddressUtil.ContainsIp(ipRules, clientIp);
}
public bool ContainsIp(List<string> ipRules, string clientIp, out string rule)
{
return IpAddressUtil.ContainsIp(ipRules, clientIp, out rule);
}
public virtual IPAddress GetClientIp(HttpContext context)
{
return context.Connection.RemoteIpAddress;
}
public IPAddress ParseIp(string ipAddress)
{
return IpAddressUtil.ParseIp(ipAddress);
}
}
}