healthcheck

package
v1.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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, insecure bool) HealthCheckResult

CheckServerHealth performs a connection check to verify a server is listening. For HTTPS URLs, it performs a TLS handshake to avoid incomplete handshake warnings on the server side. The insecure parameter controls whether to skip TLS certificate verification (matching the --insecure flag behavior for webhook forwarding). 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
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL