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.

68 lines
1.5 KiB

1 month ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Sog;
using ProtoCSStruct;
using Sog.IO;
namespace Account
{
/// <summary>
/// ip黑白名单列表
/// </summary>
public static class LimitIPList
{
public static bool CheckIPValid(string id)
{
if(string.IsNullOrEmpty(id))
{
return true;
}
//是否开启白名单
if(AccountServerUtils.GetServerConfig().enableWhiteIPList)
{
if(false == LimitIpDevice.CheckInWhiteIp(id))
{
return false;
}
}
//是否开启黑名单
if(AccountServerUtils.GetServerConfig().enableBlackIPList)
{
if(LimitIpDevice.CheckInBlackIp(id))
{
return false;
}
}
return true;
}
public static bool CheckDeviceIdValid(string deviceId)
{
if (string.IsNullOrEmpty(deviceId))
{
return true;
}
//是否开启白名单
if (AccountServerUtils.GetServerConfig().enableWhiteIPList)
{
return LimitIpDevice.CheckInWhiteDeviceId(deviceId);
}
return true;
}
public static void Clear()
{
LimitIpDevice.Clear();
}
}
}