Ship live alerts, pool status, AI monitor, remote agent commands, build manager, and uninstall flow; wire Calibrate settings (WS ping, pool traffic log, retention limits) at runtime and exclude server/data from git.
73 lines
2.3 KiB
Go
73 lines
2.3 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
type Agent struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Wallet string `json:"wallet"`
|
|
IP string `json:"ip"`
|
|
Version string `json:"version"`
|
|
Status string `json:"status"` // online, offline, error
|
|
CPUCores int `json:"cpu_cores"`
|
|
MemoryGB int `json:"memory_gb"`
|
|
LastSeen time.Time `json:"last_seen"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
|
|
// Runtime stats (updated via heartbeat)
|
|
Hashrate15s float64 `json:"hashrate_15s"`
|
|
Hashrate1m float64 `json:"hashrate_1m"`
|
|
Hashrate15m float64 `json:"hashrate_15m"`
|
|
SharesTotal int `json:"shares_total"`
|
|
SharesGood int `json:"shares_good"`
|
|
SharesBad int `json:"shares_bad"`
|
|
CPUUsagePct float64 `json:"cpu_usage_pct"`
|
|
MemoryUsagePct float64 `json:"memory_usage_pct"`
|
|
UptimeSeconds int `json:"uptime_seconds"`
|
|
}
|
|
|
|
type Share struct {
|
|
ID int64 `json:"id"`
|
|
AgentID string `json:"agent_id"`
|
|
JobID string `json:"job_id"`
|
|
Difficulty int64 `json:"difficulty"`
|
|
Accepted bool `json:"accepted"`
|
|
Hash string `json:"hash"`
|
|
Nonce string `json:"nonce"`
|
|
Error string `json:"error,omitempty"`
|
|
Timestamp time.Time `json:"timestamp"`
|
|
}
|
|
|
|
type HashrateSample struct {
|
|
ID int64 `json:"id"`
|
|
AgentID string `json:"agent_id"`
|
|
Hashrate float64 `json:"hashrate"`
|
|
Timestamp time.Time `json:"timestamp"`
|
|
}
|
|
|
|
type Job struct {
|
|
ID string `json:"id"`
|
|
Height int64 `json:"height"`
|
|
Difficulty int64 `json:"difficulty"`
|
|
BlockTemplate string `json:"block_template"`
|
|
SeedHash string `json:"seed_hash"`
|
|
Target string `json:"target"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type BuildRecord struct {
|
|
ID string `json:"id"`
|
|
WorkerName string `json:"worker_name"`
|
|
ServerURL string `json:"server_url"`
|
|
Wallet string `json:"wallet"`
|
|
Threads int `json:"threads"`
|
|
FileSize int64 `json:"file_size"`
|
|
FilePath string `json:"file_path"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
// Pool settings
|
|
PoolHost string `json:"pool_host"`
|
|
PoolPort int `json:"pool_port"`
|
|
PoolTLS bool `json:"pool_tls"`
|
|
PoolPass string `json:"pool_pass"`
|
|
}
|