agent

package
v0.0.0-...-9fcb5d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2025 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterApi

func RegisterApi(router *chi.Mux, statusUpdater *service.StatusUpdater, statusProvider AgentStatusProvider, configuration *config.Config)

func RegisterFileServer

func RegisterFileServer(router *chi.Mux, wwwDir string)

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

func New

func New(id uuid.UUID, jwt string, config *config.Config) *Agent

New creates a new agent.

func (*Agent) Run

func (a *Agent) Run(ctx context.Context) error

func (*Agent) Stop

func (a *Agent) Stop()

type AgentStatusProvider

type AgentStatusProvider interface {
	GetStatus() common.AgentStatus
}

type InventoryReply

type InventoryReply struct {
	AgentID   string        `json:"agentId"`
	Inventory api.Inventory `json:"inventory"`
}

func (InventoryReply) Render

type SelfSignedCertificateProvider

type SelfSignedCertificateProvider struct {
	// contains filtered or unexported fields
}

func NewSelfSignedCertificateProvider

func NewSelfSignedCertificateProvider(credentialAddr *net.TCPAddr) *SelfSignedCertificateProvider

func (*SelfSignedCertificateProvider) GetCertificate

func (s *SelfSignedCertificateProvider) GetCertificate(expire time.Time) (*x509.Certificate, *rsa.PrivateKey, error)

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server serves 3 endpoints: - /login serves the credentials login form - /api/v1/credentials called by the agent ui to pass the credentials entered by the user - /api/v1/status return the status of the agent.

func NewServer

func NewServer(port int, configuration *config.Config, cert *x509.Certificate, certPrivateKey *rsa.PrivateKey) *Server

func (*Server) Start

func (s *Server) Start(statusUpdater *service.StatusUpdater, statusProvider AgentStatusProvider)

func (*Server) Stop

func (s *Server) Stop(stopCh chan any)

type ServiceUIReply

type ServiceUIReply struct {
	URL string `json:"url"`
}

func (ServiceUIReply) Render

type StatusReply

type StatusReply struct {
	Status                     string `json:"status"`
	Connected                  string `json:"connected"`
	StatusInfo                 string `json:"statusInfo"`
	AgentStateUpdateSuccessful string `json:"agentStateUpdateSuccessful,omitempty"`
	AgentStateUpdateErrMessage string `json:"agentStateUpdateErrMessage,omitempty"`
	InventoryUpdateSuccessful  string `json:"inventoryUpdateSuccessful,omitempty"`
	InventoryUpdateErrMessage  string `json:"inventoryUpdateErrMessage,omitempty"`
}

func (StatusReply) Render

func (s StatusReply) Render(w http.ResponseWriter, r *http.Request) error

type VersionReply

type VersionReply struct {
	Version string `json:"version"`
}

func (VersionReply) Render

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL