fix
This commit is contained in:
@@ -24,6 +24,8 @@ type Config struct {
|
||||
CleanTask CleanTask
|
||||
Tianyuanapi TianyuanapiConfig
|
||||
VerifyConfig VerifyConfig
|
||||
Security SecurityConfig // 安全配置
|
||||
Logging LoggingConfig // 日志配置
|
||||
}
|
||||
|
||||
// JwtAuth 用于 JWT 鉴权配置
|
||||
|
||||
10
app/main/api/internal/config/logging.go
Normal file
10
app/main/api/internal/config/logging.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
// LoggingConfig 日志配置
|
||||
type LoggingConfig struct {
|
||||
UserOperationLogDir string `json:"userOperationLogDir" yaml:"userOperationLogDir"` // 用户操作日志目录
|
||||
MaxFileSize int64 `json:"maxFileSize" yaml:"maxFileSize"` // 单个日志文件最大大小(字节)
|
||||
LogLevel string `json:"logLevel" yaml:"logLevel"` // 日志级别
|
||||
EnableConsole bool `json:"enableConsole" yaml:"enableConsole"` // 是否启用控制台输出
|
||||
EnableFile bool `json:"enableFile" yaml:"enableFile"` // 是否启用文件输出
|
||||
}
|
||||
36
app/main/api/internal/config/security.go
Normal file
36
app/main/api/internal/config/security.go
Normal file
@@ -0,0 +1,36 @@
|
||||
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"`
|
||||
}
|
||||
Reference in New Issue
Block a user