feat: 节点互联双向同步——授权/计划/客户(邮箱)按业务键LWW增量同步,HTTPS+HMAC互联密钥,默认10分钟宽松节奏
This commit is contained in:
1 parent
06a9dac99b
commit
44387835e1
13 files changed
+1180
-1
No files matched your search
@@ -0,0 +1,29 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
// Peer 节点状态:pending 已配置未握手,active 握手成功可同步,disabled 手动停用 // Logan.Li
|
||||
const (
|
||||
PeerStatusPending = "pending"
|
||||
PeerStatusActive = "active"
|
||||
PeerStatusDisabled = "disabled"
|
||||
)
|
||||
|
||||
// PeerNode 互联节点:双向授权同步的对端(地址 + 互联密钥 + 游标) // Logan.Li
|
||||
type PeerNode struct {
|
||||
ID uint `json:"id" gorm:"primaryKey"`
|
||||
Name string `json:"name" gorm:"size:100;not null"`
|
||||
BaseURL string `json:"base_url" gorm:"size:255;not null"` // 对端 https 地址(含 /api)
|
||||
SharedKey string `json:"-" gorm:"size:128;not null"` // 互联密钥,双向一致,HMAC 签名用
|
||||
Status string `json:"status" gorm:"size:20;default:'pending'"`
|
||||
RemoteNode string `json:"remote_node" gorm:"size:64"` // 对端节点 ID,握手后回填
|
||||
LastSyncAt *time.Time `json:"last_sync_at,omitempty"` // 本地对端同步游标(增量起点)
|
||||
LastResult string `json:"last_result" gorm:"size:255"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// TableName 指定表名 // Logan.Li
|
||||
func (PeerNode) TableName() string {
|
||||
return "peer_nodes"
|
||||
}
|
||||
Reference in new issue
Block a user