chore: 统一本地服务器与远程仓库源码

- 合并 main 与 master 历史并以服务器结构为基线
- 保留迁移、数据保留、AWS 账单与部署安全能力
- 建立 SDD 规格和 CI 验证闭环
This commit is contained in:
Logan.Li committed 2026-08-05 20:03:25 +08:00
commit fd60361d93
460 files changed
+37492 -23871

No files matched your search

+18 -2
View File
@@ -4,11 +4,27 @@ import (
"time"
)
// AgentCredential 每台 Agent 独立凭证,只保存 bcrypt 哈希,明文仅在签发时返回。 // Logan.Li
type AgentCredential struct {
ID uint `gorm:"primarykey" json:"id"`
Hostname string `gorm:"size:255;uniqueIndex;not null" json:"hostname"`
TokenPrefix string `gorm:"size:32;uniqueIndex;not null" json:"token_prefix"`
TokenHash string `gorm:"size:255;not null" json:"-"`
Status string `gorm:"size:16;default:active;index" json:"status"`
IssuedBy string `gorm:"size:128" json:"issued_by"`
LastUsedAt *time.Time `json:"last_used_at"`
ExpiresAt *time.Time `json:"expires_at"`
RotatedAt time.Time `json:"rotated_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (AgentCredential) TableName() string { return "monitor_agent_credentials" }
// AgentReport Agent 上报的原始指标数据 // Logan.Li
type AgentReport struct {
ID uint `gorm:"primarykey" json:"id"`
Hostname string `gorm:"size:255;index;not null" json:"hostname"`
IP string `gorm:"size:64;index" json:"ip"` // Agent 上报的本机 IP,用于资产别名关联。 // Logan.Li
CPUUsage float64 `gorm:"type:decimal(6,2)" json:"cpu_usage"`
CPUIOwait float64 `gorm:"type:decimal(6,2)" json:"cpu_iowait"`
CPUCores int `json:"cpu_cores"`
@@ -206,7 +222,7 @@ type AgentPortPolicy struct {
}
func (AgentPortPolicy) TableName() string {
return "monitor_agent_port_policy"
return "monitor_agent_port_policies"
}
// AgentPortPolicyDTO 前端交互用的端口策略格式(含已解析的数组)