health

package
v0.0.0-...-b1b0948 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HealthCheck

type HealthCheck struct {
	// contains filtered or unexported fields
}

HealthCheck is looking after the proxy origin availability using either a set by HealthCheck.SetHealthCheck check function or the defaultHealthCheck func.

func NewHealthCheck

func NewHealthCheck(origin *url.URL) *HealthCheck

NewHealthCheck is the ProxyHealth constructor

func (*HealthCheck) IsAvailable

func (h *HealthCheck) IsAvailable() bool

IsAvailable returns whether the proxy origin was successfully connected at the last check time.

func (*HealthCheck) SetCheckFunc

func (h *HealthCheck) SetCheckFunc(check func(addr *url.URL) bool, period time.Duration)

SetCheckFunc sets the passed check func as the algorithm of checking the origin availability and calls for it with interval defined with the passed period variable. The SetCheckFunc provides a concurrency save way of setting and replacing the current health check algorithm, so the Stop function shouldn't be called before the SetCheckFunc call.

func (*HealthCheck) Stop

func (h *HealthCheck) Stop()

Stop gracefully stops the instance execution. Should be called when the instance work is no more needed.

Jump to

Keyboard shortcuts

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