probehttp

package
v0.0.0-...-d8998dc Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

package probehttp is vendored from k8s.io/kubernetes/pkg/probe and k8s.io/kubernetes/pkg/probe/http

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPGetInterface

type HTTPGetInterface interface {
	Do(req *http.Request) (*http.Response, error)
}

type HTTPProber

type HTTPProber interface {
	Probe(url *url.URL, headers http.Header, timeout time.Duration) (Result, string, error)
}

func New

func New() HTTPProber

func NewWithTLSConfig

func NewWithTLSConfig(config *tls.Config) HTTPProber

NewWithTLSConfig takes tls config as parameter.

type Result

type Result string
const (
	Success Result = "success"
	Failure Result = "failure"
	Unknown Result = "unknown"
)

func DoHTTPProbe

func DoHTTPProbe(url *url.URL, headers http.Header, client HTTPGetInterface) (Result, string, error)

DoHTTPProbe 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.

Jump to

Keyboard shortcuts

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