throughput1

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Upgrade

func Upgrade(w http.ResponseWriter, r *http.Request) (*websocket.Conn, error)

Upgrade takes a HTTP request and upgrades the connection to WebSocket. Returns a websocket Conn if the upgrade succeeded, and an error otherwise.

Types

type Measurer

type Measurer interface {
	Start(context.Context, net.Conn) <-chan model.Measurement
	Measure(ctx context.Context) model.Measurement
}

Measurer is an interface for collecting connection metrics.

type Protocol

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

Protocol is the implementation of the throughput1 protocol.

func New

func New(conn *websocket.Conn) *Protocol

New returns a new Protocol with the specified connection and every other option set to default.

func (*Protocol) ReceiverLoop

func (p *Protocol) ReceiverLoop(ctx context.Context) (<-chan model.WireMeasurement,
	<-chan model.WireMeasurement, <-chan error)

ReceiverLoop starts the receiver loop of the throughput1 protocol. The context's lifetime determines how long to run for. It returns one channel for sender-side measurements, one channel for receiver-side measurements and one channel for errors. While the measurements channels could be ignored, the errors channel MUST be drained by the caller.

func (*Protocol) ScaleMessage added in v0.4.0

func (p *Protocol) ScaleMessage(msgSize int, bytesSent int) int

ScaleMessage sets the binary message size taking into consideration byte limits.

func (*Protocol) SenderLoop

func (p *Protocol) SenderLoop(ctx context.Context) (<-chan model.WireMeasurement,
	<-chan model.WireMeasurement, <-chan error)

SenderLoop starts the send loop of the throughput1 protocol. The context's lifetime determines how long to run for. It returns one channel for sender-side measurements, one channel for receiver-side measurements and one channel for errors. While the measurements channels could be ignored, the errors channel MUST be drained by the caller.

func (*Protocol) SetByteLimit added in v0.4.0

func (p *Protocol) SetByteLimit(value int)

SetByteLimit sets the number of bytes sent after which a test (either download or upload) will stop. Set the value to zero to disable the byte limit.

Directories

Path Synopsis
Package spec contains constants for the throughput1 protocol.
Package spec contains constants for the throughput1 protocol.

Jump to

Keyboard shortcuts

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