update
This commit is contained in:
14
internal/model/ingest_nonce.go
Normal file
14
internal/model/ingest_nonce.go
Normal 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" }
|
||||
Reference in New Issue
Block a user