internal_net

package
v0.0.0-...-841f565 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHTTPProbe

func CreateHTTPProbe(options ProbeOptions) (ProbeOptions, ProbeFunc)

CreateHTTPProbe uses default http.Get to test connectivity to an HTTP|HTTPS endpoint

func CreateNetProbe

func CreateNetProbe(options ProbeOptions) (ProbeOptions, ProbeFunc)

CreateNetProbe uses default net.DialTimeout to test connectivity to a TCP or UDP endpoint

func CreateProbe

func CreateProbe(options ProbeOptions) (ProbeFunc, ProbeOptions, error)

func RunProbe

func RunProbe(options ProbeOptions, probeFunc ProbeFunc) error

RunProbe attempts to validate connectivity to an arbitrary network and port

Types

type ProbeFunc

type ProbeFunc func() error

ProbeFunc a function which returns an error if a target cannot be reached or fails its probe chekc

type ProbeFuncFactory

type ProbeFuncFactory func(ctx context.Context, options ProbeOptions) (ProbeOptions, ProbeFunc)

ProbeFuncFactory a generic connection interface to wrap dialer's

type ProbeOptions

type ProbeOptions struct {
	Timeout        time.Duration
	Delay          time.Duration
	MaxRetries     int
	ExpectedStatus int
	Address        *url.URL
	// TLSVerify      bool
	OnError func(err error, remainingAttempts int)
}

ProbeOptions configuration for the RunProbe function

Jump to

Keyboard shortcuts

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