remove addr, pubKey fields from agent struct

This commit is contained in:
Henry Dollman
2024-09-28 16:48:55 -04:00
parent 5e97167ee0
commit 2ecf5572ba
2 changed files with 4 additions and 8 deletions

View File

@@ -38,5 +38,5 @@ func main() {
addr = portEnvVar
}
agent.NewAgent(pubKey, addr).Run()
agent.NewAgent().Run(pubKey, addr)
}

View File

@@ -27,8 +27,6 @@ import (
)
type Agent struct {
addr string // Adress that the ssh server listens on
pubKey []byte
hostname string // Hostname of the system
kernelVersion string // Kernel version of the system
cpuModel string // CPU model of the system
@@ -47,10 +45,8 @@ type Agent struct {
sensorsContext context.Context // Sensors context to override sys location
}
func NewAgent(pubKey []byte, addr string) *Agent {
func NewAgent() *Agent {
return &Agent{
addr: addr,
pubKey: pubKey,
sem: make(chan struct{}, 15),
prevContainerStatsMap: make(map[string]*container.PrevContainerStats),
prevContainerStatsMutex: &sync.Mutex{},
@@ -360,7 +356,7 @@ func (a *Agent) gatherStats() system.CombinedData {
return systemData
}
func (a *Agent) Run() {
func (a *Agent) Run(pubKey []byte, addr string) {
// Create map for disk stats
a.fsStats = make(map[string]*system.FsStats)
@@ -389,7 +385,7 @@ func (a *Agent) Run() {
a.initializeDiskInfo()
a.initializeNetIoStats()
a.startServer()
a.startServer(pubKey, addr)
}
// Sets initial / non-changing values about the host