This commit is contained in:
2026-04-21 22:36:48 +08:00
commit 488c695fdf
748 changed files with 266838 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
package entities
import "time"
// SuspiciousIPRecord 可疑IP请求记录
type SuspiciousIPRecord struct {
ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"`
IP string `gorm:"type:varchar(64);not null;index:idx_ip_created,priority:1" json:"ip"`
Path string `gorm:"type:varchar(255);not null;index:idx_path_created,priority:1" json:"path"`
Method string `gorm:"type:varchar(16);not null;default:GET" json:"method"`
RequestCount int `gorm:"not null;default:1" json:"request_count"`
WindowSeconds int `gorm:"not null;default:10" json:"window_seconds"`
TriggerReason string `gorm:"type:varchar(64);not null;default:rate_limit" json:"trigger_reason"`
UserAgent string `gorm:"type:varchar(512);not null;default:''" json:"user_agent"`
CreatedAt time.Time `gorm:"autoCreateTime;index:idx_ip_created,priority:2;index:idx_path_created,priority:2;index:idx_created" json:"created_at"`
}
// TableName 指定表名
func (SuspiciousIPRecord) TableName() string {
return "suspicious_ip_records"
}