/// <summary> /// 防火墙拦截日志 /// </summary> /// <param name="s"></param> public static void InterceptLog(IpIntercepter s) { RedisHelper.IncrBy("interceptCount"); var result = s.IP.GetPhysicsAddressInfo().Result; s.Address = result?.Status == 0 ? result.AddressResult.FormattedAddress : s.IP.GetIPLocation(); RedisHelper.LPush("intercept", s); }
/// <summary> /// 防火墙拦截日志 /// </summary> /// <param name="s"></param> public static void InterceptLog(IpIntercepter s) { RedisHelper.IncrBy("interceptCount"); var result = s.IP.GetPhysicsAddressInfo().Result; if (result?.Status == 0) { s.Address = result.AddressResult.FormattedAddress; } else { using var searcher = new DbSearcher(Path.Combine(AppContext.BaseDirectory + "App_Data", "ip2region.db")); s.Address = searcher.MemorySearch(s.IP).Region; } RedisHelper.LPush("intercept", s); }
/// <summary> /// 防火墙拦截日志 /// </summary> /// <param name="s"></param> public static void InterceptLog(IpIntercepter s) { RedisHelper.IncrBy("interceptCount"); RedisHelper.LPush("intercept", s); }