bwtestlib

package
v0.0.0-...-1cb94bb Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Maximum duration of a bandwidth test
	MaxDuration time.Duration = time.Second * 10
	// Maximum amount of time to wait for straggler packets
	StragglerWaitPeriod time.Duration = time.Second
	// Allow sending beyond the finish time by this amount
	GracePeriodSend time.Duration = time.Millisecond * 10
	// Min packet size is 4 bytes, so that 32-bit integer fits in
	// Ideally packet size > 4 bytes, so that part of the PRG is also in packet
	MinPacketSize int64 = 4
	// Max packet size to avoid allocation of too large a buffer, make it large enough for jumbo frames++
	MaxPacketSize int64 = 66000
	// Make sure the port number is a port the server application can connect to
	MinPort uint16 = 1024

	MaxTries int64         = 5 // Number of times to try to reach server
	Timeout  time.Duration = time.Millisecond * 500
	MaxRTT   time.Duration = time.Millisecond * 1000
)

Variables

This section is empty.

Functions

func Check

func Check(e error)

func ChoosePath

func ChoosePath(interactive bool, pathAlgo string, local snet.Addr, remote snet.Addr) *sciond.PathReplyEntry

func EncodeBwtestParameters

func EncodeBwtestParameters(bwtp *BwtestParameters, buf []byte) int

Encode BwtestParameters into a sufficiently large byte buffer that is passed in, return the number of bytes written

func EncodeBwtestResult

func EncodeBwtestResult(res *BwtestResult, buf []byte) int

Encode BwtestResult into a sufficiently large byte buffer that is passed in, return the number of bytes written

func HandleDCConnReceive

func HandleDCConnReceive(bwp *BwtestParameters, udpConnection *snet.Conn, res *BwtestResult, resLock *sync.Mutex, done *sync.Mutex)

func HandleDCConnSend

func HandleDCConnSend(bwp *BwtestParameters, udpConnection *snet.Conn)

func LogFatal

func LogFatal(msg string, a ...interface{})

func LogPanicAndRestart

func LogPanicAndRestart(f func(a *snet.Conn, b string, c []byte, d []byte), CCConn *snet.Conn, serverISDASIP string, receivePacketBuffer []byte, sendPacketBuffer []byte)

TODO: make it more generic: func LogPanicAndRestart(f func(a ...interface{}), a ...interface{}) {

func PrgFill

func PrgFill(key []byte, iv int, data []byte)

Fill buffer with AES PRG in counter mode The value of the ith 16-byte block is simply an encryption of i under the key

Types

type BwtestParameters

type BwtestParameters struct {
	BwtestDuration time.Duration
	PacketSize     int64
	NumPackets     int64
	PrgKey         []byte
	Port           uint16
}

func DecodeBwtestParameters

func DecodeBwtestParameters(buf []byte) (*BwtestParameters, int, error)

Decode BwtestParameters from byte buffer that is passed in, returns BwtestParameters structure and number of bytes consumed

type BwtestResult

type BwtestResult struct {
	NumPacketsReceived int64
	CorrectlyReceived  int64
	IPAvar             int64
	IPAmin             int64
	IPAavg             int64
	IPAmax             int64
	// Contains the client's sending PRG key, so that the result can be uniquely identified
	// Only requests that contain the correct key can obtain the result
	PrgKey             []byte
	ExpectedFinishTime time.Time
}

func DecodeBwtestResult

func DecodeBwtestResult(buf []byte) (*BwtestResult, int, error)

Decode BwtestResult from byte buffer that is passed in, returns BwtestResult structure and number of bytes consumed

Jump to

Keyboard shortcuts

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