package config // SecurityConfig 安全配置 type SecurityConfig struct { // 频率限制配置 RateLimit struct { Enabled bool `json:"enabled" yaml:"enabled"` // 是否启用频率限制 WindowSize int64 `json:"windowSize" yaml:"windowSize"` // 时间窗口大小(秒) MaxRequests int64 `json:"maxRequests" yaml:"maxRequests"` // 最大请求次数 // 频率限制触发后的黑名单升级配置 TriggerThreshold int64 `json:"triggerThreshold" yaml:"triggerThreshold"` // 触发多少次频率限制后加入黑名单 TriggerWindow int64 `json:"triggerWindow" yaml:"triggerWindow"` // 触发次数统计时间窗口(小时) } `json:"rateLimit" yaml:"rateLimit"` // IP黑名单配置 IPBlacklist struct { Enabled bool `json:"enabled" yaml:"enabled"` // 是否启用IP黑名单 } `json:"ipBlacklist" yaml:"ipBlacklist"` // 用户黑名单配置 UserBlacklist struct { Enabled bool `json:"enabled" yaml:"enabled"` // 是否启用用户黑名单 } `json:"userBlacklist" yaml:"userBlacklist"` // 异常检测配置 AnomalyDetection struct { Enabled bool `json:"enabled" yaml:"enabled"` // 是否启用异常检测 } `json:"anomalyDetection" yaml:"anomalyDetection"` // 短时并发攻击检测配置 BurstAttack struct { Enabled bool `json:"enabled" yaml:"enabled"` // 是否启用短时并发攻击检测 TimeWindow int64 `json:"timeWindow" yaml:"timeWindow"` // 检测时间窗口(秒) MaxConcurrent int64 `json:"maxConcurrent" yaml:"maxConcurrent"` // 最大并发请求数 } `json:"burstAttack" yaml:"burstAttack"` }