Documentation
¶
Index ¶
- Variables
- func HTTP(url string, opts ...*HTTPOptions) (ok bool, err error)
- func Keyword(url, keyword string, opts ...*KeywordOptions) (bool, error)
- func Ping(domain string, timeout ...time.Duration) (ok bool, err error)
- func TCP(ip string, port int, timeout ...time.Duration) (ok bool, err error)
- func UDP(ip string, port int, timeout ...time.Duration) (ok bool, err error)
- type HTTPOptions
- type HealthCheck
- type KeywordOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var Version = "1.3.2"
Version is the current version of the i18n package.
Functions ¶
func HTTP ¶
func HTTP(url string, opts ...*HTTPOptions) (ok bool, err error)
HTTP checks if the given url is healthy (reachable) via HTTP
func Keyword ¶
func Keyword(url, keyword string, opts ...*KeywordOptions) (bool, error)
Keyword checks if the given url is healthy (reachable) via HTTP and contains the given keyword
Types ¶
type HTTPOptions ¶
type HTTPOptions struct {
Timeout time.Duration
//
Method string
Header map[string]string
Query map[string]string
Body any
//
OkStatusCodes []int
//
Ok func(response *fetch.Response) bool
}
HTTPOptions is the options for the HTTP health check
type HealthCheck ¶ added in v1.2.0
type HealthCheck interface {
// HTTP checks if the given url is healthy (reachable) via HTTP
HTTP(url string, opts ...*HTTPOptions) (ok bool, err error)
// TCP checks if the given ip and port is healthy (reachable) via TCP
TCP(ip string, port int, timeout ...time.Duration) (ok bool, err error)
// UDP checks if the given ip and port is healthy (reachable) via UDP
UDP(ip string, port int, timeout ...time.Duration) (ok bool, err error)
// Ping checks if the given domain is healthy (reachable) via ICMP
Ping(domain string, timeout ...time.Duration) (ok bool, err error)
// Keyword checks if the given url is healthy (reachable) via HTTP and contains the given keyword
Keyword(url, keyword string, opts ...*KeywordOptions) (bool, error)
}
HealthCheck is the interface for health check
type KeywordOptions ¶
type KeywordOptions struct {
HTTPOptions
}
KeywordOptions is the options for keyword health check
Click to show internal directories.
Click to hide internal directories.