node

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const EnvMax = 8

EnvMax is the maximum number of allowed environment variables for a Node. This must be kept in sync with the length restriction in config.cue.

View Source
const RootNodeID = "antler"

RootNodeID is the ID used for the root node in node.Do.

Variables

View Source
var ParentNode = Node{}

ParentNode defines the parent Node (the zero Node value).

Functions

func Do

func Do(ctx context.Context, rn *Run, src ExeSource, data chan any)

Do runs a Run tree in an in-process "root" node, and sends data items back on the given data channel. The item types that may be sent include StreamInfo, StreamIO, PacketInfo, PacketIO, FileData, SysInfoData, LogEntry and Error.

Do is used by the antler package and executable.

func PipeConn

func PipeConn() (conn1, conn2 io.ReadWriteCloser)

PipeConn returns a pair of ReadWriteClosers connected by two Pipes, one each direction.

func Serve

func Serve(ctx context.Context, nodeID ID, conn io.ReadWriteCloser) error

Serve runs a node whose parent is connected using the given conn. This is used by the standalone node executable.

An error is returned if there was a failure when serving the connection, or the node was explicitly canceled. Serve closes the conn when complete.

func StdioConn

func StdioConn() io.ReadWriteCloser

StdioConn is a ReadWriteCloser used for stdio. On Close, only stdout is closed.

Types

type Child

type Child struct {
	// Run is the Run to execute on Node.
	Run

	// Node is the node to execute Run on. It must be a valid, nonzero value.
	Node Node
}

Child is a Run to execute on a child Node.

type Command added in v0.4.0

type Command struct {
	// Command is the command to run. The string is split into command name and
	// arguments using space as a delimiter, with no support for escaping. If
	// spaces are needed in arguments, use the Arg field instead, or in
	// addition to Command.
	Command string

	// Arg is a slice of arguments for the command. If Command is empty, then
	// Arg[0] is the command name, otherwise the Arg slice is appended to the
	// slice obtained by splitting Command.
	Arg []string
}

Command represents the information needed to run a system command.

func (Command) Cmd added in v0.4.0

func (c Command) Cmd() *exec.Cmd

Cmd returns an exec.Cmd with name and arg obtained from param().

func (Command) CmdContext added in v0.4.0

func (c Command) CmdContext(ctx context.Context) *exec.Cmd

CmdContext returns an exec.Command using exec.CommandContext, with name and arg obtained from param().

func (Command) Text added in v0.4.0

func (c Command) Text(ctx context.Context) (txt string, err error)

Text implements Texter

type CommandError added in v0.4.0

type CommandError struct {
	Err     error
	Command string
	Out     []byte
}

CommandError wraps an error after executing a command to provide more detailed output.

func (CommandError) Error added in v0.4.0

func (c CommandError) Error() string

func (CommandError) Unwrap added in v0.4.0

func (c CommandError) Unwrap() error

Unwrap returns the inner error, for errors.Is/As.

type CommandOutput added in v0.4.0

type CommandOutput struct {
	Out    []byte // the combined output from the command
	String string // the command string per Cmd.String()
}

CommandOutput contains the result of executing a command.

func (CommandOutput) Trim added in v0.4.0

func (c CommandOutput) Trim() string

Trim returns Out as a string, with whitespace trimmed.

type Direction

type Direction string

Direction is the client to server sense for a Stream.

const (
	Up   Direction = "up"   // client to server
	Down           = "down" // server to client
)

type Download

type Download struct {
	Transfer
}

Download is a stream transfer from server to client.

func (Download) String

func (d Download) String() string

type Env

type Env struct {
	// Vars lists the environment variables. Each entry must be of the form
	// "key=value". This field is an array so Node can remain a valid map key.
	Vars [EnvMax]string

	// Inherit indicates whether to include the parent process's environment
	// (true), or not (false).
	Inherit bool
}

Env specifies the environment of the node process.

type EnvVar added in v0.4.0

type EnvVar string

EnvVar represents the name of a single environment variable.

func (EnvVar) Text added in v0.4.0

func (v EnvVar) Text(ctx context.Context) (txt string, err error)

Text implements Texter

type EnvVars added in v0.4.0

type EnvVars []string

EnvVars represents a list of patterns of environment variables to retrieve.

type Error

type Error struct {
	LogEntry
}

Error represents an unrecoverable error that occurred on a node.

func (Error) Error

func (e Error) Error() string

Error implements error

func (Error) GetLogEntry added in v0.4.0

func (e Error) GetLogEntry() LogEntry

GetLogEntry implements antler.LogEntry

type ErrorFactory

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

ErrorFactory provides methods to create and return Errors.

func (ErrorFactory) NewError

func (f ErrorFactory) NewError(message string) Error

NewError returns a new Error with the given message.

func (ErrorFactory) NewErrore

func (f ErrorFactory) NewErrore(err error) Error

NewErrore returns an Error from the given error. If the given error is already an Error, the existing error is returned.

func (ErrorFactory) NewErrorf

func (f ErrorFactory) NewErrorf(format string, a ...any) Error

NewErrorf returns an Error with its Message formatted with prinf style args.

type ExeName

type ExeName string

ExeName represents an antler node executable name.

func PlatformExeName

func PlatformExeName(platform string) ExeName

PlatformExeName returns an ExeName for the given platform (e.g. linux-amd64).

func (ExeName) Platform

func (n ExeName) Platform() string

Platform returns the platform for the name (e.g. linux-amd64).

func (ExeName) String

func (n ExeName) String() string

func (ExeName) Valid

func (n ExeName) Valid() bool

Valid returns true if this is an executable name for a standalone node.

type ExeSource

type ExeSource interface {
	// Reader returns a ReadCloser for the given platform's node executable.
	Reader(platform string) (io.ReadCloser, error)

	// Size returns the size of the given platform's node executable.
	Size(platform string) (int64, error)

	// Platforms returns the platforms for which executables are available.
	Platforms() ([]string, error)
}

An ExeSource provides contents and metadata for node executables.

type Feedback

type Feedback map[string]any

Feedback contains key/value pairs, which are returned by runners for use by subsequent runners, and are stored in the result Data. Values must be supported by gob.

type File added in v0.4.0

type File string

File represents a file name, and implements Texter to retrieve its data as text.

func (File) Data added in v0.4.0

func (f File) Data() (data []byte, err error)

Data returns the file data as a byte slice.

func (File) Name added in v0.4.0

func (f File) Name() string

Name returns the file name.

func (File) Text added in v0.4.0

func (f File) Text(ctx context.Context) (txt string, err error)

Text implements Texter

type FileData

type FileData struct {
	Name string // the name of the file
	Data []byte // the data
}

FileData contains a chunk of binary data to be saved in a file.

func (FileData) String

func (f FileData) String() string

func (FileData) Trim added in v0.4.0

func (f FileData) Trim() string

Trim returns Data as a string, with whitespace trimmed.

type Flow

type Flow string

Flow is a string name identifying a flow.

type Flower

type Flower interface {
	Flow() Flow
}

Flower wraps the Flow method, to return a Flow associated with the implementation.

type ID added in v0.4.0

type ID string

ID represents a node identifier. The empty string indicates the parent node.

func (ID) String added in v0.4.0

func (n ID) String() string

String returns the node ID, or "parent" for the parent node.

type Local

type Local struct {
}

Local is a launcher used to start a node as a locally executed process.

type Location

type Location string

Location represents a position on a path.

const (
	Client Location = "client"
	Server          = "server"
)

type LogEntry

type LogEntry struct {
	Time   time.Time // the time the entry was logged, per the node's clock
	NodeID ID        // the ID of the node that created the entry
	Tag    string    // tags the entry for categorization
	Text   string    // the entry's text
}

LogEntry represents one log entry.

func (LogEntry) GetLogEntry added in v0.4.0

func (l LogEntry) GetLogEntry() LogEntry

GetLogEntry implements antler.LogEntry

func (LogEntry) String

func (l LogEntry) String() string

type LogFactory added in v0.4.0

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

LogFactory provides methods to create and return LogEntry's.

func (LogFactory) NewLogEntry added in v0.4.0

func (f LogFactory) NewLogEntry(message string) LogEntry

NewLogEntry returns a new LogEntry with the given message.

func (LogFactory) NewLogEntryf added in v0.4.0

func (f LogFactory) NewLogEntryf(format string, a ...any) LogEntry

NewLogEntryf returns a LogEntry with its Message formatted with printf style args.

type MessageFilter

type MessageFilter struct {
	// File is a valid glob pattern of FileData names to accept. Use '*' to
	// select all files. The pattern format is documented here:
	// https://pkg.go.dev/path/filepath#Match
	File []string

	// Log indicates whether to accept (true) or reject (false) LogEntry's.
	Log bool

	// Flows to accept.
	Flow []Flow

	// All indicates whether to accept all messages (true) or not (false).
	All bool
}

MessageFilter selects messages based on some simple type and field criteria.

type Netns

type Netns struct {
	// Name is the name of the namespace. If set, this namespace will either be
	// created or used, depending on the value of the Create field.
	Name string

	// Create indicates whether to create a namespace (true) or use an existing
	// one (false). If Create is true with no Name set, the Node ID will be used
	// as the network namespace name.
	Create bool
}

Netns represents the Linux network namespace configuration to use when launching a Node (man ip-netns(8)).

type Node

type Node struct {
	ID       ID        // identifies the Node
	Platform string    // the Node's platform (e.g. linux-amd64)
	Launcher launchers // union of available launchers
	Netns    Netns     // parameters for Linux network namespaces
	Env      Env       // process environment
}

Node represents the information needed to launch a node. This struct must remain a valid map key (see https://go.dev/blog/maps#key-types). A zero Node value represents the parent node.

func (Node) String

func (n Node) String() string

type Packet

type Packet struct {
	PacketHeader

	// Len is the total length of the packet, in bytes, including the header.
	Len int
	// contains filtered or unexported fields
}

Packet represents a Packet sent in either direction between a PacketClient and PacketServer. Only the header is included in the body of the Packet. Padding is added to reach the Packet Length.

type PacketClient

type PacketClient struct {
	// Addr is the dial address, as specified to the address parameter in
	// net.Dial (e.g. "addr:port").
	Addr string

	// Protocol is the protocol to use (udp, udp4 or udp6).
	Protocol string

	// Flow is the flow identifier for traffic between the client and server.
	Flow Flow

	// MaxPacketSize is the maximum size of a received packet.
	MaxPacketSize int

	Sender []PacketSenders

	// Sockopts provides support for socket options.
	Sockopts
}

PacketClient is the client used for packet oriented protocols.

func (*PacketClient) Run

func (c *PacketClient) Run(ctx context.Context, arg runArg) (ofb Feedback,
	err error)

Run implements runner

type PacketFlag

type PacketFlag byte

PacketFlag represents the flag bits on a packet.

const (
	// FlagEcho indicates that the packet requests an echo.
	FlagEcho PacketFlag = 1 << iota

	// FlagReply indicates that the packet is a reply to an echo request.
	FlagReply
)

type PacketHeader

type PacketHeader struct {
	// Flag contains the packet flags.
	Flag PacketFlag

	// Seq is the sequence number assigned by the client.
	Seq Seq

	// Flow is the flow identifier, and corresponds to a client and server pair.
	Flow Flow
}

PacketHeader represents the header of the packet.

func (*PacketHeader) Len

func (p *PacketHeader) Len() int

Len returns the length of the header, in bytes.

func (*PacketHeader) Read

func (p *PacketHeader) Read(b []byte) (n int, err error)

Read implements io.Reader to "read" from the packet to bytes.

func (*PacketHeader) Write

func (p *PacketHeader) Write(b []byte) (n int, err error)

Write implements io.Writer to "write" from bytes to the packet.

type PacketIO

type PacketIO struct {
	// Packet is the packet.
	Packet

	// T is the node-relative time this PacketIO was recorded.
	T metric.RelativeTime

	// Sent is true for a sent packet, and false for received.
	Sent bool
}

PacketIO is a time series data point that records packet send and receive times.

func (PacketIO) String

func (p PacketIO) String() string

type PacketInfo

type PacketInfo struct {
	// Tinit is the base time for the flow's RelativeTime values.
	Tinit time.Time

	// Flow is the flow identifier.
	Flow Flow

	// Server indicates if this is from the server (true) or client (false).
	Server bool
}

PacketInfo contains information for a packet flow.

func (PacketInfo) String

func (p PacketInfo) String() string

func (PacketInfo) Time

Time returns an absolute from a node-relative time.

type PacketSenders

type PacketSenders struct {
	Unresponsive *Unresponsive
}

PacketSenders is the union of available packetSender implementations.

type PacketServer

type PacketServer struct {
	// ListenAddr is the listen address, as specified to the address parameter
	// in net.ListenPacket (e.g. ":port" or "addr:port").
	ListenAddr string

	// Protocol is the protocol to use (udp, udp4 or udp6).
	Protocol string

	// MaxPacketSize is the maximum size of a received packet.
	MaxPacketSize int
	// contains filtered or unexported fields
}

PacketServer is the server used for packet oriented protocols.

func (*PacketServer) Cancel

func (s *PacketServer) Cancel() error

Cancel implements canceler

func (*PacketServer) Run

func (s *PacketServer) Run(ctx context.Context, arg runArg) (ofb Feedback,
	err error)

Run implements runner

type Parallel

type Parallel []Run

Parallel is a list of Runs executed concurrently.

type ResultStream

type ResultStream struct {
	// Include accepts messages to stream.
	Include *MessageFilter

	// Exclude rejects messages to stream, and buffers them instead.
	Exclude *MessageFilter
}

ResultStream selects messages for either streaming or buffering.

func (*ResultStream) Run

func (s *ResultStream) Run(ctx context.Context, arg runArg) (ofb Feedback,
	err error)

Run implements runner

type Run

type Run struct {
	// Serial lists Runs to be executed sequentially
	Serial Serial

	// Parallel lists Runs to be executed concurrently
	Parallel Parallel

	// Schedule lists Runs to be executed on a schedule.
	Schedule *Schedule

	// Child is a Run to be executed on a child Node
	Child *Child

	// Runners is a union of the available runner implementations.
	//
	// NOTE: In the future, this may be an interface field, if CUE can be made
	// to choose a concrete type without using a field for each runner.
	Runners
}

Run represents the information needed to coordinate the execution of runners. Using the Serial, Parallel and Child fields, Runs may be arranged in a tree for sequential, concurrent and child node execution.

Run must be created with valid constraints, i.e. each Run must have exactly one of Serial, Parallel, Child or a Runners field set. Run is not safe for concurrent use, though Parallel Runs execute safely, concurrently.

type Runners

type Runners struct {
	ResultStream *ResultStream
	Setup        *setup
	Sleep        *Sleep
	SysInfo      *SysInfo
	System       *System
	StreamClient *StreamClient
	StreamServer *StreamServer
	PacketServer *PacketServer
	PacketClient *PacketClient
}

Runners is a union of the available runner implementations. Only one of the runners may be non-nil.

type SSH

type SSH struct {
	Destination string // ssh destination (man ssh(1))
}

SSH is a launcher used to start an Antler node remotely via ssh.

type Schedule

type Schedule struct {
	// Wait lists the wait Durations to use. If Random is false, the chosen
	// Durations cycle repeatedly through Wait.
	Wait []metric.Duration

	// WaitFirst, if true, indicates to wait before the first Run as well.
	WaitFirst bool

	// Random, if true, indicates to select wait times from Wait randomly.
	// Otherwise, wait times are taken from Wait sequentially.
	Random bool

	// Sequential, if true, indicates to run the Runs in serial.
	Sequential bool

	// Run lists the Runs.
	Run []Run
	// contains filtered or unexported fields
}

Schedule lists Runs to be executed with wait times between each Run.

type Seq

type Seq uint64

Seq is a packet sequence number.

type Serial

type Serial []Run

Serial is a list of Runs executed sequentially.

type Sleep

type Sleep metric.Duration

Sleep is a runner that sleeps for the given Duration, or until canceled.

func (*Sleep) Run

func (s *Sleep) Run(ctx context.Context, arg runArg) (ofb Feedback, err error)

Run implements runner

func (*Sleep) UnmarshalText

func (s *Sleep) UnmarshalText(text []byte) (err error)

UnmarshalText implements encoding.TextUnmarshaler.

type Sockopt added in v0.4.0

type Sockopt struct {
	// Type identifies the type of the option, and may be one of "string",
	// "int" or "byte".
	Type string

	// Level is the level argument passed to setsockopt().
	Level int

	// Opt is the option argument passed to setsockopt().
	Opt int

	// Name is a label for the socket option, used only for debugging purposes.
	Name string

	// Value is the value to set. For Type string, this must be a string. For
	// Type int or byte, this must be an int.
	Value any
}

Sockopt represents the information needed to set a socket option.

type Sockopts added in v0.4.0

type Sockopts struct {
	// Sockopt lists the generic socket options to set.
	Sockopt []Sockopt

	// DS is the value to set for the DS (ToS/Traffic Class) byte.
	DS int

	// CCA is the sender's Congestion Control Algorithm (TCP only).
	CCA string
}

Sockopts contains the socket option fields used by streams and packets.

type Stream

type Stream struct {
	// Flow is the Stream's flow identifier.
	Flow Flow

	// Direction is the client to server sense.
	Direction Direction

	// Sockopts provides support for socket options.
	Sockopts
}

Stream represents one direction of a stream oriented flow.

func (Stream) Info

func (s Stream) Info(server bool) StreamInfo

Info returns StreamInfo for this Stream.

func (Stream) String

func (s Stream) String() string

type StreamClient

type StreamClient struct {
	// Addr is the dial address, as specified to the address parameter in
	// net.Dial (e.g. "addr:port").
	Addr string

	// AddrKey is a key used to obtain the dial address from the incoming
	// Feedback, if Addr is not specified.
	AddrKey string

	// Protocol is the protocol to use (tcp, tcp4 or tcp6).
	Protocol string

	Streamers
}

StreamClient is the client used for stream oriented protocols.

func (*StreamClient) Run

func (s *StreamClient) Run(ctx context.Context, arg runArg) (ofb Feedback,
	err error)

Run implements runner

type StreamIO

type StreamIO struct {
	// Flow is the flow that this StreamIO is for.
	Flow Flow

	// T is the relative time this StreamIO was recorded.
	T metric.RelativeTime

	// Total is the total number of sent or received bytes.
	Total metric.Bytes

	// Sent is true for sent bytes, and false for received.
	Sent bool
}

StreamIO is a time series data point that records the progress of a stream as measured after read or write calls.

func (StreamIO) String

func (s StreamIO) String() string

type StreamInfo

type StreamInfo struct {
	// Tinit is the base time for the flow's RelativeTime values.
	Tinit time.Time

	Stream

	// Server indicates if this is from the server (true) or client (false).
	Server bool
}

StreamInfo contains information for a stream flow.

func (StreamInfo) String

func (s StreamInfo) String() string

func (StreamInfo) Time

Time returns an absolute from a node-relative time.

type StreamServer

type StreamServer struct {
	// ListenAddr is the listen address, as specified to the address parameter
	// in net.Listen (e.g. ":port" or "addr:port").
	ListenAddr string

	// ListenAddrKey is the key used in the returned Feedback for the listen
	// address, obtained using Listen.Addr.String(). If empty, the listen
	// address will not be included in the Feedback.
	ListenAddrKey string

	// Protocol is the protocol to use (tcp, tcp4 or tcp6).
	Protocol string
	// contains filtered or unexported fields
}

StreamServer is the server used for stream oriented protocols.

func (*StreamServer) Cancel

func (s *StreamServer) Cancel() error

Cancel implements canceler

func (*StreamServer) Run

func (s *StreamServer) Run(ctx context.Context, arg runArg) (ofb Feedback,
	err error)

Run implements runner

type Streamers

type Streamers struct {
	Upload   *Upload
	Download *Download
}

Streamers is the union of available streamer implementations.

type SysInfo added in v0.4.0

type SysInfo struct {
	// OS is a source that returns the operating system name / version.
	OS Texters

	// KernSrcInfo returns info on the kernel source code.
	KernSrcInfo Texters

	// KernSrcVer returns a version number or tag for the kernel source code.
	KernSrcVer Texters

	// Command lists the system commands to run.
	Command []Command

	// File lists the files to read.
	File []File

	// Env lists regex patterns of environment variables to retrieve.
	Env EnvVars

	// Sysctl lists regex pattern of sysctl parameters to retrieve.
	Sysctl Sysctls
}

SysInfo gathers system information.

func (SysInfo) Run added in v0.4.0

func (s SysInfo) Run(ctx context.Context, arg runArg) (ofb Feedback, err error)

Run implements runner

type SysInfoData added in v0.4.0

type SysInfoData struct {
	NodeID         ID                       // the ID of the Node the data comes from
	Hostname       string                   // hostname from os.Hostname()
	GoVersion      string                   // Go version from runtime.Version()
	GoOS           string                   // Go OS from runtime.GOOS
	GoArch         string                   // Go Arch from runtime.GOARCH
	NumCPU         int                      // number of CPUs from runtime.NumCPU()
	GoBuildVersion string                   // BuildInfo.GoVersion
	BuildSetting   map[string]string        // BuildInfo.Setting
	AntlerVersion  string                   // Antler version from version.Version
	OS             string                   // OS name / version
	KernSrcInfo    string                   // kernel source info
	KernSrcVer     string                   // kernel source version
	Command        map[string]CommandOutput // map of command key to output
	File           map[string]FileData      // map of file key to data
	Env            map[string]string        // map of environment var name to value
	Sysctl         map[string]string        // map of sysctl params name to value
}

SysInfoData is a data object containing system information.

type Sysctl added in v0.4.0

type Sysctl string

Sysctl represents the key of a sysctl kernel parameter.

func (Sysctl) Text added in v0.4.0

func (s Sysctl) Text(ctx context.Context) (txt string, err error)

Text implements Texter

type Sysctls added in v0.4.0

type Sysctls []string

Sysctls represents a list of patterns of sysctls to retrieve.

type System

type System struct {
	// Command is the embedded system command.
	Command

	// Background indicates whether to run this command in the background (true)
	// or foreground (false). If true, Run will return as soon as the command is
	// started, and with an error if it could not be started and IgnoreErrors is
	// false. The Context will be cancelled after the rest of the Run tree is
	// complete, at which time the process will be interrupted or killed
	// (according to Kill), and the node will wait for it to complete.
	Background bool

	// IgnoreErrors indicates whether to discard any errors (true) or not
	// (false).
	IgnoreErrors bool

	// Stdout selects the treatment for stdout. If empty, stdout is gathered and
	// emitted to the log as a single line when the command completes. If
	// "stream", stdout is emitted to the log a line at a time. If "quiet",
	// stdout is discarded. Otherwise, stdout is written to a file of the given
	// name.
	Stdout string

	// Stderr selects the treatment for stderr, with the same semantics as for
	// Stdout.
	Stderr string

	// Kill indicates whether to kill the process on cancellation (true) or
	// signal it with an interrupt (false).
	Kill bool
	// contains filtered or unexported fields
}

System executes a system command.

func (*System) Run

func (s *System) Run(ctx context.Context, arg runArg) (ofb Feedback, err error)

Run implements runner

type Texter added in v0.4.0

type Texter interface {
	Text(context.Context) (string, error)
}

A Texter can return a string from a source that may return an error.

type Texters added in v0.4.0

type Texters struct {
	Command *Command
	File    *File
	Env     *EnvVar
	Sysctl  *Sysctl
}

Texters is a union of the available Texter implementations. Only one of the fields may be non-nil.

type Transfer

type Transfer struct {
	// Duration is the length of time after which the sender stops writing.
	Duration metric.Duration

	// Length is the number of bytes after which the sender stops writing.
	Length metric.Bytes

	// IOSampleInterval is the minimum time between IO samples. Zero means a
	// sample will be recorded for every read and write.
	IOSampleInterval metric.Duration

	// BufLen is the size of the buffer used to read and write from the conn.
	BufLen int

	Stream
}

Transfer contains the parameters for an Upload or Download.

type Tree

type Tree map[Node]Tree

Tree is a self-referencing type that maps Nodes to a child Tree, creating a tree of Nodes.

func NewTree

func NewTree(run *Run) (t Tree)

NewTree returns a tree of Nodes used in the given Run hierarchy.

func (Tree) Platforms

func (t Tree) Platforms() (platform []string)

Platforms returns a list of unique platforms for each Node in the Tree.

func (Tree) Walk

func (t Tree) Walk(visitor func(Node) bool) bool

Walk calls the given visitor func for each Node in the Tree. If visitor returns false, the walk is terminated and false is returned.

type Unresponsive

type Unresponsive struct {
	// Wait lists the wait times between packets, which are cycled through
	// either sequentially or randomly (according to RandomWait) until all
	// packets are sent.
	Wait []metric.Duration

	// WaitFirst, if true, indicates to wait before sending the first packet as
	// well.
	WaitFirst bool

	// RandomWait, if true, indicates to use random wait times from the list.
	// Otherwise, the wait times are taken from Wait sequentially.
	RandomWait bool

	// Length lists the lengths of the packets, which are cycled through either
	// sequentially or randomly (according to RandomLength) until all packets
	// are sent.
	Length []int

	// RandomLength, if true, indicates to use random lengths from the list.
	// Otherwise, the lengths are taken from Length sequentially.
	RandomLength bool

	// Duration is how long to send packets.
	Duration metric.Duration

	// Echo, if true, requests mirrored replies from the server.
	Echo bool
	// contains filtered or unexported fields
}

Unresponsive sends packets on a schedule without regard to any congestion signals.

type Upload

type Upload struct {
	Transfer
}

Upload is a stream transfer from client to server.

func (Upload) String

func (u Upload) String() string

Directories

Path Synopsis
Package metric provides base types for units, measurement and statistics.
Package metric provides base types for units, measurement and statistics.

Jump to

Keyboard shortcuts

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