mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 12:40:07 +00:00
展示服务器列表
This commit is contained in:
@@ -7,8 +7,6 @@ const CtxKeyIsUserLogin = "ckiul"
|
||||
|
||||
// CtxKeyOauth2State ..
|
||||
const CtxKeyOauth2State = "cko2s"
|
||||
// CtxKeyServer ..
|
||||
const CtxKeyServer = "cks"
|
||||
|
||||
// Common ..
|
||||
type Common struct {
|
||||
|
||||
@@ -11,8 +11,8 @@ const (
|
||||
// State ..
|
||||
type State struct {
|
||||
CPU float64
|
||||
MEMTotal uint64
|
||||
MEMUsed uint64
|
||||
MemTotal uint64
|
||||
MemUsed uint64
|
||||
SwapTotal uint64
|
||||
SwapUsed uint64
|
||||
DiskTotal uint64
|
||||
@@ -25,8 +25,8 @@ type State struct {
|
||||
func (s *State) PB() *pb.State {
|
||||
return &pb.State{
|
||||
Cpu: s.CPU,
|
||||
MemTotal: s.MEMTotal,
|
||||
MemUsed: s.MEMUsed,
|
||||
MemTotal: s.MemTotal,
|
||||
MemUsed: s.MemUsed,
|
||||
SwapTotal: s.SwapTotal,
|
||||
SwapUsed: s.SwapUsed,
|
||||
DiskTotal: s.DiskTotal,
|
||||
@@ -36,6 +36,21 @@ func (s *State) PB() *pb.State {
|
||||
}
|
||||
}
|
||||
|
||||
// PB2State ..
|
||||
func PB2State(s *pb.State) State {
|
||||
return State{
|
||||
CPU: s.GetCpu(),
|
||||
MemTotal: s.GetMemTotal(),
|
||||
MemUsed: s.GetMemUsed(),
|
||||
SwapTotal: s.GetSwapTotal(),
|
||||
SwapUsed: s.GetSwapUsed(),
|
||||
DiskTotal: s.GetDiskTotal(),
|
||||
DiskUsed: s.GetDiskUsed(),
|
||||
NetIn: s.GetNetIn(),
|
||||
NetOut: s.GetNetOut(),
|
||||
}
|
||||
}
|
||||
|
||||
// Host ..
|
||||
type Host struct {
|
||||
Platform string
|
||||
@@ -65,3 +80,19 @@ func (h *Host) PB() *pb.Host {
|
||||
Version: h.Version,
|
||||
}
|
||||
}
|
||||
|
||||
// PB2Host ...
|
||||
func PB2Host(h *pb.Host) Host {
|
||||
return Host{
|
||||
Platform: h.GetPlatform(),
|
||||
PlatformVersion: h.GetPlatformVersion(),
|
||||
CPU: h.GetCpu(),
|
||||
Arch: h.GetArch(),
|
||||
Virtualization: h.GetVirtualization(),
|
||||
Uptime: h.GetUptime(),
|
||||
BootTime: h.GetBootTime(),
|
||||
IP: h.GetIp(),
|
||||
CountryCode: h.GetCountryCode(),
|
||||
Version: h.GetVersion(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,7 @@ type Server struct {
|
||||
Common
|
||||
Name string
|
||||
Secret string
|
||||
|
||||
Host Host
|
||||
State State
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user