Add node mode with SSH auto-install and Remnawave-style manual deploy.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -27,8 +27,55 @@ type Protocol struct {
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type NodeStatus string
|
||||
|
||||
const (
|
||||
NodeStatusPending NodeStatus = "pending"
|
||||
NodeStatusInstalling NodeStatus = "installing"
|
||||
NodeStatusOnline NodeStatus = "online"
|
||||
NodeStatusOffline NodeStatus = "offline"
|
||||
NodeStatusError NodeStatus = "error"
|
||||
)
|
||||
|
||||
type Node struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Host string `json:"host"`
|
||||
SSHPort int `json:"ssh_port"`
|
||||
SSHUser string `json:"ssh_user"`
|
||||
SSHAuthType string `json:"ssh_auth_type"` // password | key
|
||||
SSHSecretEnc string `json:"-"`
|
||||
NodePort int `json:"node_port"`
|
||||
SecretKey string `json:"-"`
|
||||
Status NodeStatus `json:"status"`
|
||||
InstallMode string `json:"install_mode"` // auto | manual
|
||||
LastError string `json:"last_error"`
|
||||
InstallLog string `json:"install_log"`
|
||||
AgentVersion string `json:"agent_version"`
|
||||
LastSeenAt *time.Time `json:"last_seen_at,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (n Node) StatusLabel() string {
|
||||
switch n.Status {
|
||||
case NodeStatusOnline:
|
||||
return "Online"
|
||||
case NodeStatusInstalling:
|
||||
return "Установка"
|
||||
case NodeStatusOffline:
|
||||
return "Offline"
|
||||
case NodeStatusError:
|
||||
return "Ошибка"
|
||||
default:
|
||||
return "Ожидание"
|
||||
}
|
||||
}
|
||||
|
||||
type DashboardStats struct {
|
||||
ProtocolsTotal int
|
||||
ProtocolsEnabled int
|
||||
AdminsTotal int
|
||||
NodesTotal int
|
||||
NodesOnline int
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user