throughput1

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 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 DefaultMeasurer

type DefaultMeasurer struct{}

DefaultMeasurer is the default throughput1 measurer that wraps the measurer package's Start function.

func (*DefaultMeasurer) Start

func (*DefaultMeasurer) Start(ctx context.Context,
	c net.Conn) <-chan model.Measurement

type Measurer

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

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) 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.

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