This commit is contained in:
toom1996
2026-09-07 00:04:01 +08:00
parent 6a5a4378ab
commit 10d8a96e8c
29 changed files with 5349 additions and 0 deletions

View File

@ -0,0 +1,14 @@
package model
// IngestNonce 爬虫上报的一次性随机串,用于防重放。
//
// 每次合法请求携带唯一 X-Nonce;后台先查库,若存在则拒绝(409 重放),
// 否则放行并写入。nonce 本身随机且一次性,空间可忽略;
// created_at 用于定期清理(如保留 7 天)以防表无限增长。
type IngestNonce struct {
Nonce string `gorm:"primaryKey;column:nonce;size:64" json:"nonce"`
CreatedAt uint32 `gorm:"column:created_at" json:"created_at"`
}
// TableName 指定 nonce 表名。
func (IngestNonce) TableName() string { return "ingest_nonces" }