healthcheck

package
v1.10.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

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