node.go 738 B

1234567891011121314151617181920212223242526272829303132333435
  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. }
  19. type NodeInfoInterface interface {
  20. GetNodeInfo() *NodeInfoT
  21. }
  22. func init() {
  23. NODE_INFO = new(NodeInfoT)
  24. }
  25. func (n *NodeInfoT) GetNodeInfo() *NodeInfoT {
  26. n.Lock.Lock()
  27. defer n.Lock.Unlock()
  28. return n
  29. }