udprunner

package
v1.68.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// UDPURLPrefix is the URL prefix for triggering UDP load.
	UDPURLPrefix = "udp://"
	// UDPStatusOK is the map key on success.
	UDPStatusOK = "OK"
)
View Source
var UDPTimeOutDefaultValue = 750 * time.Millisecond

Functions

This section is empty.

Types

type RunnerOptions

type RunnerOptions struct {
	periodic.RunnerOptions
	UDPOptions // Need to call Init() to initialize
}

RunnerOptions includes the base RunnerOptions plus UDP specific options.

type RunnerResults

type RunnerResults struct {
	periodic.RunnerResults
	UDPOptions
	RetCodes      UDPResultMap
	SocketCount   int
	BytesSent     int64
	BytesReceived int64
	// contains filtered or unexported fields
}

RunnerResults is the aggregated result of an UDPRunner. Also is the internal type used per thread/goroutine.

func RunUDPTest

func RunUDPTest(o *RunnerOptions) (*RunnerResults, error)

RunUDPTest runs a UDP test and returns the aggregated stats. Some refactoring to avoid copy-pasta between the now 3 runners would be good.

func (*RunnerResults) Run

func (udpstate *RunnerResults) Run(_ context.Context, t periodic.ThreadID) (bool, string)

Run tests UDP request fetching. Main call being run at the target QPS. To be set as the Function in RunnerOptions.

type UDPClient

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

UDPClient is the client used for UDP echo testing.

func NewUDPClient

func NewUDPClient(o *UDPOptions) (*UDPClient, error)

NewUDPClient creates and initialize and returns a client based on the UDPOptions.

func (*UDPClient) Close

func (c *UDPClient) Close() int

Close closes the last connection and returns the total number of sockets used for the run.

func (*UDPClient) Fetch

func (c *UDPClient) Fetch() ([]byte, error)

type UDPOptions

type UDPOptions struct {
	Destination string
	Payload     []byte // what to send (and check)
	ReqTimeout  time.Duration
}

UDPOptions are options to the UDPClient.

type UDPResultMap

type UDPResultMap map[string]int64

Jump to

Keyboard shortcuts

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