mirror of
https://github.com/fankes/beszel.git
synced 2025-10-20 02:09:28 +08:00
change hub file structure
This commit is contained in:
9
internal/entities/container/stats.go
Normal file
9
internal/entities/container/stats.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package container
|
||||
|
||||
type ContainerStats struct {
|
||||
Name string `json:"n"`
|
||||
Cpu float64 `json:"c"`
|
||||
Mem float64 `json:"m"`
|
||||
NetworkSent float64 `json:"ns"`
|
||||
NetworkRecv float64 `json:"nr"`
|
||||
}
|
27
internal/entities/email/email.go
Normal file
27
internal/entities/email/email.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package email
|
||||
|
||||
type EmailData struct {
|
||||
to string
|
||||
subj string
|
||||
body string
|
||||
}
|
||||
|
||||
func NewEmailData(to, subj, body string) *EmailData {
|
||||
return &EmailData{
|
||||
to: to,
|
||||
subj: subj,
|
||||
body: body,
|
||||
}
|
||||
}
|
||||
|
||||
func (e *EmailData) To() string {
|
||||
return e.to
|
||||
}
|
||||
|
||||
func (e *EmailData) Subject() string {
|
||||
return e.subj
|
||||
}
|
||||
|
||||
func (e *EmailData) Body() string {
|
||||
return e.body
|
||||
}
|
17
internal/entities/server/server.go
Normal file
17
internal/entities/server/server.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package server
|
||||
|
||||
import "golang.org/x/crypto/ssh"
|
||||
|
||||
type Server struct {
|
||||
Host string
|
||||
Port string
|
||||
Status string
|
||||
Client *ssh.Client
|
||||
}
|
||||
|
||||
func NewServer(host, port string) *Server {
|
||||
return &Server{
|
||||
Host: host,
|
||||
Port: port,
|
||||
}
|
||||
}
|
18
internal/entities/system/stats.go
Normal file
18
internal/entities/system/stats.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package system
|
||||
|
||||
type SystemStats struct {
|
||||
Cpu float64 `json:"cpu"`
|
||||
Mem float64 `json:"m"`
|
||||
MemUsed float64 `json:"mu"`
|
||||
MemPct float64 `json:"mp"`
|
||||
MemBuffCache float64 `json:"mb"`
|
||||
Swap float64 `json:"s"`
|
||||
SwapUsed float64 `json:"su"`
|
||||
Disk float64 `json:"d"`
|
||||
DiskUsed float64 `json:"du"`
|
||||
DiskPct float64 `json:"dp"`
|
||||
DiskRead float64 `json:"dr"`
|
||||
DiskWrite float64 `json:"dw"`
|
||||
NetworkSent float64 `json:"ns"`
|
||||
NetworkRecv float64 `json:"nr"`
|
||||
}
|
20
internal/entities/system/system.go
Normal file
20
internal/entities/system/system.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package system
|
||||
|
||||
import "beszel/internal/entities/container"
|
||||
|
||||
type SystemInfo struct {
|
||||
Cores int `json:"c"`
|
||||
Threads int `json:"t"`
|
||||
CpuModel string `json:"m"`
|
||||
// Os string `json:"o"`
|
||||
Uptime uint64 `json:"u"`
|
||||
Cpu float64 `json:"cpu"`
|
||||
MemPct float64 `json:"mp"`
|
||||
DiskPct float64 `json:"dp"`
|
||||
}
|
||||
|
||||
type SystemData struct {
|
||||
Stats SystemStats `json:"stats"`
|
||||
Info SystemInfo `json:"info"`
|
||||
Containers []container.ContainerStats `json:"container"`
|
||||
}
|
Reference in New Issue
Block a user