http

package
v0.0.0-...-16cb735 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	// contains filtered or unexported fields
}

func NewCheck

func NewCheck(options map[string]interface{}) (*Check, error)

NewCheck creates a new check for a service

func (*Check) Config

func (check *Check) Config() core.MonitorConfiguration

func (*Check) Description

func (check *Check) Description() string

func (*Check) Name

func (check *Check) Name() string

func (*Check) Perform

func (check *Check) Perform() (core.Status, error)

func (*Check) PerformGet

func (check *Check) PerformGet() (core.Status, error)

func (*Check) Version

func (check *Check) Version() string

func (*Check) Watch

func (check *Check) Watch(update chan<- *core.ServiceStatus, stop <-chan bool, wg *sync.WaitGroup) error

type MonitorConfiguration

type MonitorConfiguration struct {
	// URL of the service
	URL string `mapstructure:"url"`
	// Timeout is the duration to wait for a ping to finish, such as "1s"
	Timeout time.Duration `mapstructure:"timeout"`
	// Interval is the interval to use when watching the target, such as "1s"
	Interval time.Duration `mapstructure:"interval"`
	// Method is the HTTP method to use, such as "GET"
	Method string `mapstructure:"method"`
	// FollowRedirects specifies whether or not redirects should be followed
	FollowRedirects bool `mapstructure:"followRedirects"`
	// MaximumRedirects specifies the maximum number of redirects to follow before throwing an error
	MaximumRedirects int `mapstructure:"maximumRedirects"`
	// Expect is the matching clauses to determine an alive service
	Expect struct {
		// Status is the expected HTTP status
		Status int `mapstructure:"status"`
		// Regex is a regular expression that the body should match
		Regex string `mapstructure:"regex"`
		// CompiledRegex is the above regex in its compiled form
		CompiledRegex *regexp.Regexp
	} `mapstructure:"expect"`
}

func ParseConfiguration

func ParseConfiguration(options map[string]interface{}) (*MonitorConfiguration, error)

func (*MonitorConfiguration) Validate

func (config *MonitorConfiguration) Validate() []error

Jump to

Keyboard shortcuts

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