Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent[H models.ModelsBridge | models.ModelsGateway] struct { // ConfigMutex is a mutex for updating the config ConfigMutex *sync.RWMutex // contains filtered or unexported fields }
func NewAgent ¶
func NewAgent[H models.ModelsBridge | models.ModelsGateway](ctx context.Context, config Config[H]) *Agent[H]
NewAgent returns a new Agent for a Bridge or Gateway host
func (*Agent[H]) Start ¶
Start starts the agent loop. It immediately returns an error in case of an error in starting. Otherwise it will listen to a.Context.Done() for terminating.
type Config ¶
type Config[H models.ModelsBridge | models.ModelsGateway] struct { // Heartbeat is how often we want to send an update message to menshen with our configuration information // This needs to take into consideration how menshen is configured. Heartbeat time.Duration // Hosts is a slice of information about the hosts that the agent should send to menshen Hosts []*H // MenshenURL is the URL to send host info to ie "http://localhost:8080" or "https://example.com:443" MenshenURL *url.URL // Logger is a slog.Logger for the Agent to use for logging Logger *slog.Logger PresharedKey string // ErrorChan is a channel to return errors from our main loop on ErrorChan chan error // WG is a WaitGroup that allows waiting for the finish of the agent execution loop WG *sync.WaitGroup // Plugins is a list of "plugins" which provide transform functions for allowing user supplied host updates Plugins []plugins.Plugin[H] }
Source Files
¶
- agent.go
Click to show internal directories.
Click to hide internal directories.