node.go 687 B

12345678910111213141516171819202122232425262728293031323334
  1. package modelse
  2. import (
  3. "sync"
  4. )
  5. var (
  6. NODE_INFO *NodeInfoT
  7. )
  8. type NodeInfoT struct {
  9. Hostname string `json:"hostname"`
  10. HostIp string `json:"host_ip"`
  11. KernelVersion string `json:"kernel_version"`
  12. SystemUUID string `json:"system_uuid"`
  13. HostID int64 `json:"host_id"`
  14. AccountID int `json:"account_id"`
  15. LicenseKey string `json:"license_key"`
  16. Lock sync.RWMutex `json:"lock,omitempty"`
  17. }
  18. type NodeInfoInterface interface {
  19. GetNodeInfo() *NodeInfoT
  20. }
  21. func init() {
  22. NODE_INFO = new(NodeInfoT)
  23. }
  24. func (n *NodeInfoT) GetNodeInfo() *NodeInfoT {
  25. n.Lock.Lock()
  26. defer n.Lock.Unlock()
  27. return n
  28. }