check

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolHttp1_0     = Protocol("http1.0")
	ProtocolHttp1_0_tls = Protocol("http1.0-tls")
	ProtocolHttp1_1     = Protocol("http1.1")
	ProtocolHttp1_1_tls = Protocol("http1.1-tls")
	ProtocolH2          = Protocol("h2")
	ProtocolH2c         = Protocol("h2c")
	ProtocolH3          = Protocol("h3")
)
View Source
const (
	SubCheckNameProtocol                     = "protocol"
	SubCheckNameSenderResponseBeforeReceiver = "sender_response_before_receiver"
	SubCheckNameSamePathSenderRejection      = "same_path_sender_rejection"
	SubCheckNameContentTypeForwarding        = "content_type_forwarding"
	SubCheckNameContentDispositionForwarding = "content_disposition_forwarding"
	SubCheckNameXRobotsTagNone               = "x_robots_tag_none"
	SubCheckNameTransferred                  = "transferred"
	SubCheckNameReusePath                    = "reuse_path"
	SubCheckNamePartialTransfer              = "partial_transfer"
)

Subcheck name is top-level. The same subcheck names in different checks should be the same meaning.

Variables

This section is empty.

Functions

func RunChecks

func RunChecks(checks []Check, commonConfig *Config, protocols []Protocol) <-chan Result

Types

type Check

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

func AllChecks

func AllChecks() []Check

type Config

type Config struct {
	RunServerCmd                                     []string
	HealthCheckPath                                  string
	ServerSchemalessUrl                              string
	Protocol                                         Protocol
	TlsSkipVerifyCert                                bool
	Concurrency                                      uint
	SenderResponseBeforeReceiverTimeout              time.Duration
	FirstByteCheckTimeout                            time.Duration
	GetResponseReceivedTimeout                       time.Duration
	GetReqWroteRequestWaitForH3                      time.Duration // because httptrace not supported: https://github.com/quic-go/quic-go/issues/3342
	TransferBytePerSec                               int
	SortedTransferSpans                              []time.Duration
	WaitDurationAfterSenderCancel                    time.Duration
	WaitDurationBetweenReceiverWroteRequestAndCancel time.Duration
	WaitDurationAfterReceiverCancel                  time.Duration
}

type Protocol

type Protocol string

type Result

type Result struct {
	// result name can be "<check name>.<subcheck name>" or "<check name>"
	Name      string          `json:"name"`
	Protocol  Protocol        `json:"protocol"`
	Message   string          `json:"message,omitempty"`
	OkForJson *bool           `json:"ok,omitempty"`
	Errors    []ResultError   `json:"errors,omitempty"`
	Warnings  []ResultWarning `json:"warnings,omitempty"`
}

type ResultError

type ResultError struct {
	Message string `json:"message"`
}

func ContentTypeMismatchError

func ContentTypeMismatchError(expectedContentType string, actualContentType string) ResultError

func FailedToGetPortError

func FailedToGetPortError() ResultError

func FailedToRunServerError

func FailedToRunServerError(err error) ResultError

func NewError

func NewError(message string, err error) ResultError

func NotOkStatusError

func NotOkStatusError(status int) ResultError

type ResultWarning

type ResultWarning struct {
	Message string `json:"message"`
}

func NewWarning

func NewWarning(message string, err error) ResultWarning

func XRobotsTagNoneWarning

func XRobotsTagNoneWarning(actualValue string) ResultWarning

type RunCheckReporter added in v0.8.0

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

func NewRunCheckReporter added in v0.8.0

func NewRunCheckReporter(ch chan<- RunCheckResult) RunCheckReporter

func (*RunCheckReporter) Close added in v0.8.0

func (r *RunCheckReporter) Close()

func (*RunCheckReporter) Report added in v0.8.0

func (r *RunCheckReporter) Report(result RunCheckResult)

type RunCheckResult

type RunCheckResult struct {
	// empty string is ok
	SubCheckName string
	Message      string
	Errors       []ResultError
	Warnings     []ResultWarning
}

func NewRunCheckResultWithOneError

func NewRunCheckResultWithOneError(resultError ResultError) RunCheckResult

Jump to

Keyboard shortcuts

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