namespace Dpz.Core.Infrastructure.RateLimiting;
/// <summary>
/// 窗口期限流配置
/// 所有字段均有默认值,未配置时也能正常运行
/// </summary>
public class RateLimitConfig
{
/// <summary>
/// 统计窗口大小(分钟)
/// </summary>
public int WindowMinutes { get; set; } = 5;
/// <summary>
/// 单个窗口内触发限流的事件数阈值
/// </summary>
public int MaxEvents { get; set; } = 3;
/// <summary>
/// 超过阈值后的封禁时长(分钟)
/// </summary>
public int BlockMinutes { get; set; } = 30;
/// <summary>
/// 封禁期内每个请求的延迟响应时间(秒)
/// </summary>
public int BlockDelaySeconds { get; set; } = 2;
}
AI 正在分析代码…
评论加载中...