You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TTL time.Duration`yaml:"ttl" env:"CACHE_TTL"`// Cache TTL for features/KVM (set to 0 to disable caching, max 5 minutes)
133
+
PowerStateTTL time.Duration`yaml:"powerstate_ttl" env:"CACHE_POWERSTATE_TTL"`// Power state TTL (typically shorter since it changes more frequently, max 1 minute)
134
+
}
113
135
)
114
136
137
+
// ValidateCacheConfig validates cache configuration values for security.
138
+
// Returns error if values are negative or exceed maximum limits.
139
+
func (c*Config) ValidateCacheConfig() error {
140
+
ifc.TTL<MinCacheTTL {
141
+
returnErrCacheTTLNegative
142
+
}
143
+
144
+
ifc.TTL>MaxCacheTTL {
145
+
returnErrCacheTTLExceedsMax
146
+
}
147
+
148
+
ifc.PowerStateTTL<MinCacheTTL {
149
+
returnErrCachePowerStateTTLNegative
150
+
}
151
+
152
+
ifc.PowerStateTTL>MaxPowerStateTTL {
153
+
returnErrCachePowerStateTTLExceedsMax
154
+
}
155
+
156
+
returnnil
157
+
}
158
+
115
159
// getPreferredIPAddress detects the most likely candidate IP address for this machine.
116
160
// It prefers non-loopback IPv4 addresses and excludes link-local addresses.
0 commit comments