watch

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2020 License: MIT Imports: 23 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ErrorInvalidEndpoint           ErrorType = "endpointInvalid"
	ErrorTypeServerTooSlow                   = "serverTooSlow"
	ErrorTypeNotImplemented                  = "notImplemented"
	ErrorTypeUnknownError                    = "unknownError"
	ErrorTypeClientError                     = "clientError"
	ErrorTypeDNS                             = "dns"
	ErrorTypeDNSConfig                       = "dnsConfig"
	ErrorTypeTLSCertificateInvalid           = "tlsCertificateInvalid"
	ErrorTypeTLSHostNameError                = "tlsHostNameError"
	ErrorTypeTLSSystemRootsError             = "tlsSystemRootsError"
	ErrorTypeTLSUnknownAuthority             = "tlsUnknownAutority"
	ErrorTypeWrongHTTPStatusCode             = "wrongHTTPStatus"
	ErrorTypeCertificateIsExpiring           = "certificateIsExpiring"
	ErrorTypeUnexpectedContentType           = "unexpectedContentType"
	ErrorTypeSessionFail                     = "sessionFail"
	ErrorTypeGoQueryMismatch                 = "goqueryMismatch"
	ErrorTypeGoQuery                         = "goQueryGeneralError"
	ErrorTypeDataMismatch                    = "dataMismatch"
	ErrorJsonPath                            = "jsonPathError"
	ErrorRegex                               = "regexError"
	ErrorBadResponseBody                     = "badResponseBody"
	ErrorTypeHeaderMismatch                  = "headerMismatch"
	ErrorTypeRedirectMismatch                = "redirectMismatch"
	ErrorTypeReplyMismatch                   = "replyMismatch"
)

Variables

Functions

func SetUserAgentVersion

func SetUserAgentVersion(version string)

Types

type CheckContext

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

type Error

type Error struct {
	Error    string    `json:"error"`
	Type     ErrorType `json:"type"`
	Comment  string    `json:"comment,omitempty"`
	Location string    `json:"location,omitempty"`
}

func ValidateContentType

func ValidateContentType(ctx *CheckContext) (errs []Error)

func ValidateDuration

func ValidateDuration(ctx *CheckContext) (errs []Error)

func ValidateGoQuery

func ValidateGoQuery(ctx *CheckContext) (errs []Error)

func ValidateHeaders

func ValidateHeaders(ctx *CheckContext) (errs []Error)

func ValidateJsonPath

func ValidateJsonPath(ctx *CheckContext) (errs []Error)

func ValidateMatchReply

func ValidateMatchReply(ctx *CheckContext) (errs []Error)

func ValidateRedirects

func ValidateRedirects(ctx *CheckContext) (errs []Error)

func ValidateRegex

func ValidateRegex(ctx *CheckContext) (errs []Error)

func ValidateStatusCode

func ValidateStatusCode(ctx *CheckContext) (errs []Error)

type ErrorType

type ErrorType string

type Result

type Result struct {
	ID        string        `json:"id"`
	Errors    []Error       `json:"errors"`
	Timeout   bool          `json:"timeout"`
	Timestamp time.Time     `json:"timestamp"`
	RunTime   time.Duration `json:"runtime"`
}

func NewResult

func NewResult(id string) *Result

type ValidatorFunc

type ValidatorFunc func(ctx *CheckContext) (errs []Error)

type Watcher

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

func Watch

func Watch(service *config.Service, chanResult chan Result) *Watcher

Watch create a watcher and start watching

func (*Watcher) LastErrors

func (w *Watcher) LastErrors() []Error

func (*Watcher) SetLastErrors

func (w *Watcher) SetLastErrors(errs []Error)

func (*Watcher) Stop

func (w *Watcher) Stop()

Stop watching - beware this is async

Jump to

Keyboard shortcuts

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