The Barista Logo

barista

An i3status alternative in golang

Download sample-bar Download i3status example View on GitHub

Network Information

godoc
import "barista.run/modules/netinfo"

Display network information for the “best” interface: netinfo.New().
Display network information for the “best” interface with a prefix: netinfo.Prefix("wl").
Display network information for a specific interface: netinfo.Interface("eno1").

The “best” network interface is selected by the state. A connected interface is preferred, going down through various states (Dormant, Down, NotPresent), until Unknown, which is only used if nothing else is available.

Configuration

Example

eno1: 10.2.0.1

Show the most relevant IP from any interface:

netinfo.New().Output(func(s netinfo.State) bar.Output) {
	if len(s.IPs) < 1 {
		return outputs.Text("No network").Color(colors.Scheme("bad"))
	}
	return outputs.Textf("%s: %v", s.Name, s.IPs[0])
})

Data: type State struct

Fields

Methods

Documentation for net.IP and net.HardwareAddr