Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAllCheckTriesFailed = errors.New("all check tries failed")
var ErrHTTPStatusNotOK = errors.New("HTTP response status is not OK")
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
func NewChecker ¶
func (*Checker) SetConfig ¶
func (c *Checker) SetConfig(tlsDialAddrs []string, icmpTargets []netip.Addr, smallCheckType string, startupOnFail bool, )
SetConfig sets the following: - TCP+TLS dial addresses - ICMP echo IP addresses to target - the desired small check type (dns or icmp) - whether to startup the periodic checks if the startup check fails. This function MUST be called before calling Checker.Start.
func (*Checker) Start ¶
Start starts the Checker which behaves differently according to its internal field startupOnFail, which is set by calling Checker.SetConfig.
By default, startupOnFail should be false and the behavior is as follows: A blocking 6s-timed TCP+TLS check is performed first. If it fails, an error is returned and the Checker is not started. On success, it starts the periodic checks in a separate goroutine, returning the runError error channel and a nil error.
If startupOnFail is true, the behavior is as follows: A blocking 6s-timed TCP+TLS check is performed first. If it fails, the error is sent to the runError channel, but no error is returned and the Checker continues to start the periodic checks in a separate goroutine, returning the runError error channel and a nil error.
The periodic checks consist in: - a "small" ICMP echo check every minute - a "full" TCP+TLS check every 5 minutes
The Checker has to be ultimately stopped by calling Checker.Stop.