node.go 779 B

123456789101112131415161718192021222324252627282930313233343536
  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. AgentVersion string `json:"agent_version"`
  18. SysTag string `json:"sys"`
  19. }
  20. type NodeInfoInterface interface {
  21. GetNodeInfo() *NodeInfoT
  22. }
  23. func init() {
  24. NODE_INFO = new(NodeInfoT)
  25. }
  26. func (n *NodeInfoT) GetNodeInfo() *NodeInfoT {
  27. n.Lock.Lock()
  28. defer n.Lock.Unlock()
  29. return n
  30. }