Documentation ¶
Overview ¶
Package agent is the service for interacting with Agent objects
Index ¶
- func WithMemoryAgentRepository() agents.Repository
- func WithMemoryGroupRepository() group.Repository
- type Service
- func (s *Service) Add(agent agents.Agent) (err error)
- func (s *Service) AddAgentToGroup(group string, id uuid.UUID) error
- func (s *Service) Agent(id uuid.UUID) (agents.Agent, error)
- func (s *Service) Agents() []agents.Agent
- func (s *Service) Authenticated(id uuid.UUID) bool
- func (s *Service) Exist(id uuid.UUID) bool
- func (s *Service) GroupMembers() map[string][]uuid.UUID
- func (s *Service) Groups() []string
- func (s *Service) IsChild(id uuid.UUID) bool
- func (s *Service) Lifetime(id uuid.UUID) (time.Duration, error)
- func (s *Service) Link(id, link uuid.UUID) error
- func (s *Service) Linked(id, link uuid.UUID) (bool, error)
- func (s *Service) Links(id uuid.UUID) ([]uuid.UUID, error)
- func (s *Service) Log(id uuid.UUID, message string) error
- func (s *Service) Remove(id uuid.UUID) (err error)
- func (s *Service) RemoveAgentFromGroup(group string, id uuid.UUID) error
- func (s *Service) ResetAuthentication(id uuid.UUID) (err error)
- func (s *Service) Status(id uuid.UUID) (status string, err error)
- func (s *Service) Unlink(id, link uuid.UUID) error
- func (s *Service) Update(agent agents.Agent) error
- func (s *Service) UpdateAgentInfo(id uuid.UUID, info messages.AgentInfo) (err error)
- func (s *Service) UpdateAlive(id uuid.UUID, alive bool) error
- func (s *Service) UpdateAuthenticated(id uuid.UUID, authenticated bool) error
- func (s *Service) UpdateComms(id uuid.UUID, comms agents.Comms) error
- func (s *Service) UpdateInitial(id uuid.UUID, t time.Time) error
- func (s *Service) UpdateListener(id, listener uuid.UUID) error
- func (s *Service) UpdateNote(id uuid.UUID, note string) (err error)
- func (s *Service) UpdateStatusCheckin(id uuid.UUID, t time.Time) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithMemoryAgentRepository ¶
func WithMemoryAgentRepository() agents.Repository
WithMemoryAgentRepository retrieves an in-memory Agent repository interface used to manage Agent object
func WithMemoryGroupRepository ¶
func WithMemoryGroupRepository() group.Repository
WithMemoryGroupRepository retrieves an in-memory Group repository interface used to manage Agent Group object
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service holds references to repositories to manage Agent objects or Group objects
func NewAgentService ¶
func NewAgentService() *Service
NewAgentService is a factory to create an Agent service to be used by other packages or services
func (*Service) AddAgentToGroup ¶
AddAgentToGroup adds the Agent to a group
func (*Service) Authenticated ¶
Authenticated determines if the Agent is authenticated or not
func (*Service) GroupMembers ¶
GroupMembers returns a list of lists that contain all groups and their members
func (*Service) IsChild ¶
IsChild checks to see if the Agent id is a peer-to-peer child to any other Agent
func (*Service) Lifetime ¶
Lifetime returns the amount an agent could live without successfully communicating with the server
func (*Service) RemoveAgentFromGroup ¶
RemoveAgentFromGroup removes an Agent ID from a group
func (*Service) ResetAuthentication ¶
ResetAuthentication sets the Agent's authentication status to false and its secret back to empty
func (*Service) Status ¶
Status determines if the agent is active, delayed, or dead based on its last checkin time and retry settings
func (*Service) UpdateAgentInfo ¶
UpdateAgentInfo replaces an existing Agent's embedded Build, Comms, Host, and Process structures This is typically used after initial checkin or when the Agent has a configuration change
func (*Service) UpdateAlive ¶
UpdateAlive set's the Agent's alive status to the provided value
func (*Service) UpdateAuthenticated ¶
UpdateAuthenticated set's the Agent's authenticated field value
func (*Service) UpdateComms ¶
UpdateComms replaces an existing Agent's embedded Comms structure
func (*Service) UpdateInitial ¶
UpdateInitial set's that Agent's initial checkin time field
func (*Service) UpdateNote ¶
UpdateNote replaces an existing Agent's note