Documentation
¶
Overview ¶
Package netmon reports whether NetworkManager considers the machine online and the connection metered, and when either of those changes. Policy (skip, fetch, log) is the caller's: this package only reports.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor reads NetworkManager's verdict on one system bus connection and reports its relevant changes. It is safe for concurrent use.
func Absent ¶
func Absent() *Monitor
Absent returns a Monitor for a process with no system bus: Allowed always reports NMAbsent and Changed never fires.
func New ¶
New subscribes to NetworkManager's property changes on sys, a private system bus connection the caller keeps open and closes. NetworkManager need not be running: the match rule names its well-known name, which the bus resolves when a signal is sent, so a NetworkManager that starts later is heard. A failed subscription is logged at WARN and leaves Changed silent; Allowed still works. A nil log discards.
func (*Monitor) Allowed ¶
Allowed reads NetworkManager's Connectivity and Metered properties. Connectivity none, portal or limited is offline; unknown (checking disabled) and full are online. Metered yes or guess-yes is metered. NetworkManager not on the bus is a Verdict with NMAbsent, not an error.