Documentation ¶
Index ¶
Constants ¶
const ( ContentType = "Content-Type" ContentUrlEncodedForm = "application/x-www-form-urlencoded" ContentJson = "application/json" ContentPlainText = "text/plain" )
Variables ¶
This section is empty.
Functions ¶
func DoHTTPGetProbe ¶
func DoHTTPGetProbe(url *url.URL, headers http.Header, client HTTPInterface) (api.Result, string, error)
DoHTTPGetProbe checks if a GET request to the url succeeds. If the HTTP response code is successful (i.e. 400 > code >= 200), it returns Success. If the HTTP response code is unsuccessful or HTTP communication fails, it returns Failure. This is exported because some other packages may want to do direct HTTP probes.
func DoHTTPPostProbe ¶
func DoHTTPPostProbe(addr *url.URL, headers http.Header, client HTTPInterface, form url.Values, body string) (api.Result, string, error)
DoHTTPPostProbe checks if a POST request to the url succeeds. If the HTTP response code is successful (i.e. 400 > code >= 200), it returns Success. If the HTTP response code is unsuccessful or HTTP communication fails, it returns Failure. This is exported because some other packages may want to do direct HTTP probes.
Types ¶
type GetProber ¶
type GetProber interface {
Probe(url *url.URL, headers http.Header, timeout time.Duration) (api.Result, string, error)
}
GetProber is an interface that defines the Probe function for doing HTTP probe.
func NewGetWithTLSConfig ¶
NewWithTLSConfig takes tls config as parameter. followNonLocalRedirects configures whether the prober should follow redirects to a different hostname.
If disabled, redirects to other hosts will trigger a warning result.
func NewHttpGet ¶
New creates GetProber that will skip TLS verification while probing. followNonLocalRedirects configures whether the prober should follow redirects to a different hostname.
If disabled, redirects to other hosts will trigger a warning result.
type HTTPInterface ¶
HTTPInterface is an interface for making HTTP requests, that returns a response and error.
type PostProber ¶
type PostProber interface {
Probe(url *url.URL, headers http.Header, form url.Values, body string, timeout time.Duration) (api.Result, string, error)
}
PostProber is an interface that defines the Probe function for doing HTTP probe.
func NewHttpPost ¶
func NewHttpPost(followNonLocalRedirects bool) PostProber
New creates PostProber that will skip TLS verification while probing. followNonLocalRedirects configures whether the prober should follow redirects to a different hostname.
If disabled, redirects to other hosts will trigger a warning result.
func NewPostWithTLSConfig ¶
func NewPostWithTLSConfig(config *tls.Config, followNonLocalRedirects bool) PostProber
NewWithTLSConfig takes tls config as parameter. followNonLocalRedirects configures whether the prober should follow redirects to a different hostname.
If disabled, redirects to other hosts will trigger a warning result.