check

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 29 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. Purpose: Compromise in a narrow area not the entire check.

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
	FixedLengthBodyGetTimeout                        time.Duration
	ServiceWorkerRejectionTimeout                    time.Duration
	NSimultaneousRequests                            int
}

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"`
	ServerRunId string          `json:"server_run_id,omitempty"`
}

type ResultError

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

func FailedToGetPortError

func FailedToGetPortError() ResultError

func NewError

func NewError(message string, err error) ResultError

type ResultWarning

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

func NewWarning

func NewWarning(message string, err error) 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)

func (*RunCheckReporter) SetServerRunId added in v0.10.0

func (r *RunCheckReporter) SetServerRunId(serverRunId string)

type RunCheckResult

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

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