payload

package
v10.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PrefixDelimiter for message prefix
	PrefixDelimiter = "-"
)

Variables

This section is empty.

Functions

func AllMsgPayloads

func AllMsgPayloads(prefix string, payloadSizes []string, numOfMsg int) ([][]byte, int)

AllMsgPayloads generates a series of payloads based on specified payload sizes or the number of messages

func GenPayload

func GenPayload(prefix, size string) ([]byte, int)

GenPayload generates an array of bytes with prefix string and payload size. If the specified payload size is less than the prefix size, the payload will just be the prefix.

func GetMessageID

func GetMessageID(prefix, str string) int

GetMessageID returns the message index by parsing the template payload string with a prefix.

func NumOfBytes

func NumOfBytes(size string) int

NumOfBytes returns a number of bytes with specified size in MB or KB

Types

type Payload

type Payload struct {
	Ceiling        int
	Floor          int
	DefaultPayload []byte // to save time for large payload size generation
}

Payload defines the payload size

func NewPayload

func NewPayload(size int) Payload

NewPayload returns a new Payload object with a fixed payload size

func (*Payload) GenDefaultPayload

func (p *Payload) GenDefaultPayload() []byte

GenDefaultPayload generates default payload size

func (Payload) PrefixDefaultPayload

func (p Payload) PrefixDefaultPayload(prefix string) []byte

PrefixDefaultPayload creates string prefix in the payload

func (Payload) PrefixPayload

func (p Payload) PrefixPayload(prefix string) []byte

PrefixPayload creates string prefix in the payload

Jump to

Keyboard shortcuts

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