wrtcthr

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Acknowledgement

type Acknowledgement struct {
	ThroughputMB float64 // Average throughput in megabyte/s at this datapoint
	ThroughputMb float64 // Average throughput in megabit/s at this datapoint

	TransferredMB       int           // Transfered amount in megabyte at this datapoint
	TransferredDuration time.Duration // Duration of transfer at this datapoint
}

Acknowledgement is an individual datapoint

type Adapter

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

Adapter provides a throughput measurement service

func NewAdapter

func NewAdapter(
	signaler string,
	key string,
	ice []string,
	config *AdapterConfig,
	ctx context.Context,
) *Adapter

NewAdapter creates the adapter

func (*Adapter) Acknowledgements

func (a *Adapter) Acknowledgements() chan Acknowledgement

Acknowledgements returns a channel on which all individual datapoints will be sent

func (*Adapter) Close

func (a *Adapter) Close() error

Close disconnects the adapter from the signaler and stops all measurements, resulting in the totals being yielded

func (*Adapter) GatherTotals

func (a *Adapter) GatherTotals()

GatherTotals yields the total statistics

func (*Adapter) Open

func (a *Adapter) Open() error

Open connects the adapter to the signaler

func (*Adapter) Totals

func (a *Adapter) Totals() chan Totals

Totals returns a channel on which all total statistics will be sent

func (*Adapter) Wait

func (a *Adapter) Wait() error

Wait starts the transmission and measurement loop

type AdapterConfig

type AdapterConfig struct {
	*wrtcconn.AdapterConfig
	OnSignalerConnect  func(string) // Handler to be called when the adapter has connected to the signaler
	OnPeerConnect      func(string) // Handler to be called when the adapter has connected to a peer
	OnPeerDisconnected func(string) // Handler to be called when the adapter has received a message
	Server             bool         // Whether to act as the server
	PacketLength       int          // Length of the packet to measure latency with
	PacketCount        int          // Amount of packets to send before measuring
}

AdapterConfig configures the adapter

type Totals

type Totals struct {
	ThroughputAverageMB float64 // Average total throughput in megabyte/s
	ThroughputAverageMb float64 // Average total throughput in megabit/s

	TransferredMB       int           // Total transfered amount in megabyte
	TransferredDuration time.Duration // Total duration of transfer

	ThroughputMin float64 // Minimum measured throughput
	ThroughputMax float64 // Maximum measured throughput
}

Totals are the total statistics

Jump to

Keyboard shortcuts

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