speedtest

package module
v0.0.0-...-c5cc252 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2018 License: MIT Imports: 6 Imported by: 0

README

gospeedtest

Build Status Maintainability

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunSpeedTest

func RunSpeedTest()

Types

type BytesPerTime

type BytesPerTime struct {
	Bytes uint
	Time  time.Duration
}

type Direction

type Direction int
const (
	DirectionDown Direction = iota
	DirectionUp
)

type SpeedTest

type SpeedTest struct {
	Result         SpeedTestResult
	ReportChan     chan BytesPerTime
	Connection     net.Conn
	StatusChan     chan SpeedTestStatus
	DataStreamChan chan BytesPerTime // The raw stream used to report bytes per time on each send of bytes.
	ControlChan    chan SpeedTestControl
	TestComplete   bool
	Direction      Direction
	Duration       int
}

func NewSpeedTest

func NewSpeedTest(connection net.Conn, direction Direction) *SpeedTest

func (*SpeedTest) ReceiveData

func (sp *SpeedTest) ReceiveData() error

func (*SpeedTest) SendData

func (sp *SpeedTest) SendData()

func (*SpeedTest) SpeedAggregator

func (sp *SpeedTest) SpeedAggregator()

type SpeedTestControl

type SpeedTestControl int
const (
	ControlStart SpeedTestControl = iota
	ControlStop
	ControlAbort
)

type SpeedTestResult

type SpeedTestResult struct {
	Duration         time.Duration
	BytesTransferred uint
	AverageSpeed     uint
	PeakSpeed        uint
	InitialPing      *ping.Statistics
	DuringPing       *ping.Statistics
	AfterPing        *ping.Statistics
	BufferBloat      uint // Buffer bloat in ms
}

type SpeedTestStatus

type SpeedTestStatus struct {
	Error  error
	Status Status
}

type Status

type Status int
const (
	StatusReady Status = iota
	StatusStarted
	StatusRunningInitialPings
	StatusRunningFinalPings
	StatusFinished
	StatusAborted
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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