barista-contrib

Community modules and extensions for barista.

View barista-contrib on GitHub View barista on GitHub View official barista docs

IP

godoc
import "github.com/martinohmann/barista-contrib/modules/ip"

Show public IP address: ip.New(someProvider).

IP supports displaying currently available updates using pluggable providers, with the ability to add custom providers fairly easily. Provider is just

type Provider interface {
	// GetIP retrieves the current public client IP. Must return nil for both
	// return values if there is no internet connection.
	GetIP() (net.IP, error)
}

The following IP providers are available in barista-contrib:

Configuration

Examples

online: 1.2.3.4

Show online status:

ip.New(ipify.Provider).Output(func(info ip.Info) bar.Output {
    if info.Connected() {
        return outputs.Textf("online: %s", info.IP)
    }

    return outputs.Text("offline")
})

Data: type Info struct

Fields

Methods