update ws & settings api (#547)

This commit is contained in:
UUBulb
2024-12-04 20:00:18 +08:00
committed by GitHub
parent 6295371cac
commit 872002d938
4 changed files with 38 additions and 9 deletions

View File

@@ -127,6 +127,21 @@ func (h *Host) PB() *pb.Host {
}
}
// Filter returns a new instance of Host with some fields redacted.
func (h *Host) Filter() *Host {
return &Host{
Platform: h.Platform,
CPU: h.CPU,
MemTotal: h.MemTotal,
DiskTotal: h.DiskTotal,
SwapTotal: h.SwapTotal,
Arch: h.Arch,
Virtualization: h.Virtualization,
BootTime: h.BootTime,
GPU: h.GPU,
}
}
func PB2Host(h *pb.Host) Host {
return Host{
Platform: h.GetPlatform(),