From 2ecf5572baa0b9383b846dcea1a576e8310820ea Mon Sep 17 00:00:00 2001 From: Henry Dollman Date: Sat, 28 Sep 2024 16:48:55 -0400 Subject: [PATCH] remove addr, pubKey fields from agent struct --- beszel/cmd/agent/agent.go | 2 +- beszel/internal/agent/agent.go | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/beszel/cmd/agent/agent.go b/beszel/cmd/agent/agent.go index 0ea0097..26190d3 100644 --- a/beszel/cmd/agent/agent.go +++ b/beszel/cmd/agent/agent.go @@ -38,5 +38,5 @@ func main() { addr = portEnvVar } - agent.NewAgent(pubKey, addr).Run() + agent.NewAgent().Run(pubKey, addr) } diff --git a/beszel/internal/agent/agent.go b/beszel/internal/agent/agent.go index 155129e..0ffdd87 100644 --- a/beszel/internal/agent/agent.go +++ b/beszel/internal/agent/agent.go @@ -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