1. 新增安全响应头中间件强化请求安全性 2. 使用恒定时间比较修复API密钥验证时序漏洞 3. 新增限流器条目上限配置与自动清理逻辑 4. 优化CORS日志与客户端IP获取逻辑 5. 升级Go构建环境与基础镜像版本 6. 新增非root用户运行容器增强安全性
22 lines
519 B
Go
22 lines
519 B
Go
package common
|
|
|
|
import "time"
|
|
|
|
const (
|
|
DefaultPort = "8080"
|
|
DefaultTimeout = 30 * time.Second
|
|
MaxTextLength = 5000
|
|
MinSpeed = 0.25
|
|
MaxSpeed = 4.0
|
|
DefaultSpeed = 1.0
|
|
MaxRequestBodySize = 1024 * 1024
|
|
RateLimitRequests = 100
|
|
RateLimitWindow = time.Minute
|
|
MaxResponseTimes = 100
|
|
MaxErrors = 10
|
|
MaxConcurrentRequests = 10
|
|
CleanupInterval = time.Hour
|
|
MaxModelNameLength = 64
|
|
MaxRateLimiterEntries = 100000
|
|
)
|