Implement Windows agent with RandomX mining and WebSocket fleet reporting, wire dashboard settings into the builder with saved exe paths, and add project README.
71 lines
1.3 KiB
Go
71 lines
1.3 KiB
Go
package config
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
const Version = "1.0.0"
|
|
|
|
// BuiltinConfig holds compile-time settings generated by the Miner Builder.
|
|
type BuiltinConfig struct {
|
|
WorkerName string
|
|
ServerURL string
|
|
Wallet string
|
|
Threads int
|
|
CPUPriority string
|
|
MiningMode string
|
|
SilentMode bool
|
|
RunAs string
|
|
AutoStart bool
|
|
BuildID string
|
|
BuiltAt time.Time
|
|
PoolHost string
|
|
PoolPort int
|
|
PoolTLS bool
|
|
PoolPass string
|
|
MaxCPUUsage int
|
|
MinFreeRAM int
|
|
IdleThresholdPct int
|
|
IdleDurationMinutes int
|
|
ScheduleStart string
|
|
ScheduleEnd string
|
|
}
|
|
|
|
// RuntimeConfig is the resolved configuration used by the agent.
|
|
type RuntimeConfig struct {
|
|
BuiltinConfig
|
|
AgentID string
|
|
}
|
|
|
|
func Load() RuntimeConfig {
|
|
b := GetBuiltinConfig()
|
|
if b.Threads <= 0 {
|
|
b.Threads = 4
|
|
}
|
|
if b.CPUPriority == "" {
|
|
b.CPUPriority = "below_normal"
|
|
}
|
|
if b.MiningMode == "" {
|
|
b.MiningMode = "always"
|
|
}
|
|
if b.MaxCPUUsage <= 0 {
|
|
b.MaxCPUUsage = 80
|
|
}
|
|
if b.MinFreeRAM <= 0 {
|
|
b.MinFreeRAM = 1024
|
|
}
|
|
if b.IdleThresholdPct <= 0 {
|
|
b.IdleThresholdPct = 20
|
|
}
|
|
if b.IdleDurationMinutes <= 0 {
|
|
b.IdleDurationMinutes = 5
|
|
}
|
|
if b.ScheduleStart == "" {
|
|
b.ScheduleStart = "21:00"
|
|
}
|
|
if b.ScheduleEnd == "" {
|
|
b.ScheduleEnd = "06:00"
|
|
}
|
|
return RuntimeConfig{BuiltinConfig: b}
|
|
}
|