using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Sog; using ProtoCSStruct; using Sog.IO; namespace Account { /// /// ip黑白名单列表 /// 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(); } } }