netspeed

package
v0.0.0-...-c936f35 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 9 Imported by: 17

Documentation

Overview

Package netspeed provides an i3bar module to display network utilisation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

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

Module represents a netspeed bar module. It supports setting the output format, click handler, and update frequency.

func New

func New(iface string) *Module

New constructs an instance of the netspeed module for the given interface.

func (*Module) Output

func (m *Module) Output(outputFunc func(Speeds) bar.Output) *Module

Output configures a module to display the output of a user-defined function.

func (*Module) RefreshInterval

func (m *Module) RefreshInterval(interval time.Duration) *Module

RefreshInterval configures the polling frequency for network speed. Since there is no concept of an instantaneous network speed, the speeds will be averaged over this interval before being displayed.

func (*Module) Stream

func (m *Module) Stream(s bar.Sink)

Stream starts the module.

type Speeds

type Speeds struct {
	Rx, Tx unit.Datarate
	// contains filtered or unexported fields
}

Speeds represents bidirectional network traffic.

func (Speeds) Connected

func (s Speeds) Connected() bool

Connected returns true if the network is connected.

func (Speeds) Total

func (s Speeds) Total() unit.Datarate

Total gets the total speed (both up and down).

Jump to

Keyboard shortcuts

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