Documentation
¶
Overview ¶
Package config provides configuration management for the CipherSwarm agent.
Index ¶
Constants ¶
const ( // DefaultGPUTempThreshold is the GPU temperature threshold in Celsius. DefaultGPUTempThreshold = 80 // DefaultSleepOnFailure is the sleep duration after task failure. DefaultSleepOnFailure = 60 * time.Second // DefaultStatusTimer is the status update interval in seconds. DefaultStatusTimer = 10 // DefaultHeartbeatInterval is the heartbeat interval. DefaultHeartbeatInterval = 10 * time.Second // DefaultTaskTimeout is the task timeout (long-running tasks are expected). DefaultTaskTimeout = 24 * time.Hour // DefaultDownloadMaxRetries is the max download retry attempts. DefaultDownloadMaxRetries = 3 // DefaultDownloadRetryDelay is the base delay between download retries. DefaultDownloadRetryDelay = 2 * time.Second // DefaultInsecureDownloads controls TLS certificate verification for downloads. DefaultInsecureDownloads = false // DefaultMaxHeartbeatBackoff is the max heartbeat backoff multiplier (caps at 64x). DefaultMaxHeartbeatBackoff = 6 // MaxBackoffShift caps exponential-backoff shift exponents (1 << n) so a large // retry count or backoff multiplier cannot overflow time.Duration into a // negative value. 1<<20 (~1e6 * base) already dwarfs any sane backoff. MaxBackoffShift = 20 // DefaultConnectTimeout is the TCP connect timeout for API requests. DefaultConnectTimeout = 10 * time.Second // DefaultReadTimeout is the read timeout for API responses. DefaultReadTimeout = 30 * time.Second // DefaultWriteTimeout is accepted from server config but not used in the transport chain // (Go's http.Transport has no write timeout — it's a server-side concept). DefaultWriteTimeout = 10 * time.Second // DefaultRequestTimeout is the overall request timeout for API calls. DefaultRequestTimeout = 60 * time.Second // DefaultAPIMaxRetries is the max retry attempts for failed API requests. DefaultAPIMaxRetries = 3 // DefaultAPIRetryInitialDelay is the initial delay between API retries. DefaultAPIRetryInitialDelay = 1 * time.Second // DefaultAPIRetryMaxDelay is the maximum delay between API retries. DefaultAPIRetryMaxDelay = 30 * time.Second // DefaultCircuitBreakerFailureThreshold is the number of failures before the circuit opens. DefaultCircuitBreakerFailureThreshold = 5 // DefaultCircuitBreakerTimeout is the duration before a tripped circuit half-opens. DefaultCircuitBreakerTimeout = 30 * time.Second )
Default configuration values — the single source of truth for all defaults. cmd/root.go references these exported constants for CLI flag defaults.
const AgentVersion = "0.5.5"
AgentVersion is the current version of the agent software.
const MaxReasonableRetries = 10
MaxReasonableRetries caps server-recommended retry count to prevent excessive retry storms from a misconfigured server.
const MaxReasonableTimeout = 5 * time.Minute
MaxReasonableTimeout caps server-recommended timeout values to prevent a misconfigured server from setting absurdly large timeouts (e.g., 24 hours).
Variables ¶
This section is empty.
Functions ¶
func ClampDuration ¶ added in v0.6.2
ClampDuration returns value if it is within (0, ceiling], otherwise returns the default. Logs a warning when clamping is applied (both for non-positive values and ceiling breaches).
func ClampInt ¶ added in v0.6.2
ClampInt returns value if it is within [minVal, maxVal], otherwise returns the default. Logs a warning when clamping is applied (both for below-minimum and above-maximum values).
func InitConfig ¶
func InitConfig(cfgFile string)
InitConfig initializes the configuration from various sources.
func SetDefaultConfigValues ¶
func SetDefaultConfigValues()
SetDefaultConfigValues sets default configuration values.
func SetupSharedState ¶
func SetupSharedState()
SetupSharedState configures the shared state from configuration values.
Types ¶
This section is empty.