wrtcltc

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 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 {
	BytesWritten int           // Count of written bytes
	Latency      time.Duration // Latency measured at this datapoint
}

Acknowledgement is an individual datapoint

type Adapter

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

Adapter provides a latency 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
	Pause              time.Duration // Amount of time to wait before measuring next latency datapoint
}

AdapterConfig configures the adapter

type Totals

type Totals struct {
	LatencyAverage time.Duration // Average total latency
	LatencyMin     time.Duration // Minimum mesured latency
	LatencyMax     time.Duration // Maximum measured latency
	PacketsWritten int64         // Count of written packets
}

Totals are the total statistics

Jump to

Keyboard shortcuts

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