Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatHealthMessage ¶
func FormatHealthMessage(result HealthCheckResult, targetURL *url.URL) string
FormatHealthMessage creates a user-friendly health status message
Types ¶
type HealthCheckResult ¶
type HealthCheckResult struct {
Status ServerHealthStatus
Healthy bool
Error error
Timestamp time.Time
Duration time.Duration
}
HealthCheckResult contains the result of a health check
func CheckServerHealth ¶
func CheckServerHealth(targetURL *url.URL, timeout time.Duration) HealthCheckResult
CheckServerHealth performs a TCP connection check to verify a server is listening. The timeout parameter should be appropriate for the deployment context: - Local development: 3s is typically sufficient - Production/edge: May require longer timeouts due to network conditions
type ServerHealthStatus ¶
type ServerHealthStatus int
ServerHealthStatus represents the health status of the target server
const ( HealthHealthy ServerHealthStatus = iota // TCP connection successful HealthUnreachable // Connection refused or timeout )
Click to show internal directories.
Click to hide internal directories.