Documentation ¶
Index ¶
Constants ¶
View Source
const ( ErrInvalidBaseURL errors.Msg = "invalid bound base url" ErrRequestFailed errors.Msg = "request failed" )
View Source
const ErrUnknownTransportType errors.Msg = "cannot add tls.Config to http.Client.Transport of unknown type"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Config // contains filtered or unexported fields }
Client is a simple http.Client which can be used to perform health checks on a target (web)service.
type Config ¶
type Config struct { // TargetHostname is the hostname or ip address of the target server. TargetHostname string `env:"" default:"localhost"` // TargetPort is the port of the target server. TargetPort uint16 `env:"" default:"8080"` // TargetPath is the path to the health check endpoint on the target server. TargetPath string `env:"" default:"/healthy"` // RequestTimeout is the maximum time to wait for a health check response. RequestTimeout time.Duration `env:"" default:"3s"` }
func DefaultConfig ¶
func DefaultConfig() Config
type InvalidStatusCode ¶
type InvalidStatusCode struct {
Code int
}
InvalidStatusCode contains the non-expected status code received from a health check request.
func (InvalidStatusCode) Error ¶
func (e InvalidStatusCode) Error() string
type Option ¶
func WithBindTargetBaseURL ¶
WithBindTargetBaseURL where ptr points to a strings which contains the base url to the target server, of form "[scheme://]ipaddr|hostname[:port]", without trailing slash.
func WithBindTargetPath ¶
func WithHTTPClient ¶
WithHTTPClient allows to set a custom internal http.Client to the Client.
func WithTLSConfig ¶
WithTLSConfig sets the provided tls.Config to the Client's internal http.Transport.TLSClientConfig. Any provided easytls.Option(s) will be applied to this tls.Config using easytls.Apply.
Click to show internal directories.
Click to hide internal directories.