tcpprobe

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package tcpprobe implements a TCP probe.

Index

Constants

View Source
const (
	MaxResponseBytes int64 = 10e5 // largest response size accepted

)

Variables

This section is empty.

Functions

func Alert

func Alert(fn prober.AlertFn) func(*TcpProber)

Alert sets a custom alerting function.

If Alert is not called, the probes.SendAlertEmail function is called.

func Name

func Name(name string) func(*TcpProber)

Name sets the name for the prober.

func New

func New(target string, options ...func(*TcpProber)) *prober.Probe

New returns a new tcp probe with specified options.

func NewWithGeneric

func NewWithGeneric(target string, genericOpts []prober.Option, options ...func(*TcpProber)) *prober.Probe

NewWithGeneric returns a new instance of the tcp probe with specified options.

NewWithGeneric passes through specified prober.Options, after applying the tcpprobe-specific options.

func Timeout

func Timeout(timeout time.Duration) func(*TcpProber)

Timeout sets the timeout for the prober.

Types

type TcpProber

type TcpProber struct {
	Target  string        // host to probe
	Name    string        // name of the prober
	Timeout time.Duration // maximum duration to be allowed
	// contains filtered or unexported fields
}

TcpProber probes a target's HTTP response.

func (*TcpProber) Alert

func (p *TcpProber) Alert(name, desc string, badness int, records prober.Records) error

Alert calls the prober.AlertFn for the prober.

If no prober.AlertFn was set with the Alert() option, probes.SendAlertEmail is used by default.

func (TcpProber) Probe

func (p TcpProber) Probe() prober.Result

Probe verifies that the target can be reached within the timeout.

Jump to

Keyboard shortcuts

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