nettest

package
v1.30.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 19 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CmdNettest = &cobra.Command{
	Use:   "nettest",
	Short: "Starts a tiny web server for checking networking connectivity",
	Long: `Starts a web server for checking networking connectivity on the given "--port".

Will dial out to, and expect to hear from, every pod that is a member of the service
passed in the flag "--service".

The web server will have the following endpoints:

- "/read": to see the current state, or "/quit" to shut down.

- "/status": to see "pass/running/fail" determination. (literally, it will return
one of those words.)

- "/write": is used by other network test pods to register connectivity.`,
	Args: cobra.MaximumNArgs(0),
	Run:  main,
}

CmdNettest is used by agnhost Cobra.

Functions

This section is empty.

Types

type State

type State struct {
	// Hostname is set once and never changed-- it's always safe to read.
	Hostname string

	// The below fields require that lock is held before reading or writing.
	Sent                 map[string]int
	Received             map[string]int
	Errors               []string
	Log                  []string
	StillContactingPeers bool
	// contains filtered or unexported fields
}

State tracks the internal state of our little http server. It's returned verbatim over the /read endpoint.

func (*State) Logf

func (s *State) Logf(format string, args ...interface{})

Logf writes to the log message list. s must not be locked. s's Log member will drop an old message if it would otherwise become longer than 500 messages.

type WritePost

type WritePost struct {
	Source string
	Dest   string
}

WritePost is the format that (json encoded) requests to the /write handler should take.

type WriteResp

type WriteResp struct {
	Hostname string
}

WriteResp is returned by /write

Jump to

Keyboard shortcuts

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