v0.0.0-...-87682d9 Latest Latest

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 9 Imported by: 7



Package netspeed provides an i3bar module to display network utilisation.



This section is empty.


This section is empty.


This section is empty.


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