mirror of
https://github.com/fankes/beszel.git
synced 2025-10-20 10:19:27 +08:00
remove addr, pubKey fields from agent struct
This commit is contained in:
@@ -38,5 +38,5 @@ func main() {
|
|||||||
addr = portEnvVar
|
addr = portEnvVar
|
||||||
}
|
}
|
||||||
|
|
||||||
agent.NewAgent(pubKey, addr).Run()
|
agent.NewAgent().Run(pubKey, addr)
|
||||||
}
|
}
|
||||||
|
@@ -27,8 +27,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Agent struct {
|
type Agent struct {
|
||||||
addr string // Adress that the ssh server listens on
|
|
||||||
pubKey []byte
|
|
||||||
hostname string // Hostname of the system
|
hostname string // Hostname of the system
|
||||||
kernelVersion string // Kernel version of the system
|
kernelVersion string // Kernel version of the system
|
||||||
cpuModel string // CPU model 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
|
sensorsContext context.Context // Sensors context to override sys location
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAgent(pubKey []byte, addr string) *Agent {
|
func NewAgent() *Agent {
|
||||||
return &Agent{
|
return &Agent{
|
||||||
addr: addr,
|
|
||||||
pubKey: pubKey,
|
|
||||||
sem: make(chan struct{}, 15),
|
sem: make(chan struct{}, 15),
|
||||||
prevContainerStatsMap: make(map[string]*container.PrevContainerStats),
|
prevContainerStatsMap: make(map[string]*container.PrevContainerStats),
|
||||||
prevContainerStatsMutex: &sync.Mutex{},
|
prevContainerStatsMutex: &sync.Mutex{},
|
||||||
@@ -360,7 +356,7 @@ func (a *Agent) gatherStats() system.CombinedData {
|
|||||||
return systemData
|
return systemData
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Agent) Run() {
|
func (a *Agent) Run(pubKey []byte, addr string) {
|
||||||
// Create map for disk stats
|
// Create map for disk stats
|
||||||
a.fsStats = make(map[string]*system.FsStats)
|
a.fsStats = make(map[string]*system.FsStats)
|
||||||
|
|
||||||
@@ -389,7 +385,7 @@ func (a *Agent) Run() {
|
|||||||
a.initializeDiskInfo()
|
a.initializeDiskInfo()
|
||||||
a.initializeNetIoStats()
|
a.initializeNetIoStats()
|
||||||
|
|
||||||
a.startServer()
|
a.startServer(pubKey, addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets initial / non-changing values about the host
|
// Sets initial / non-changing values about the host
|
||||||
|
Reference in New Issue
Block a user