networkmanager

package
v0.0.0-...-0000000 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2017 License: GPL-3.0, GPL-3.0 Imports: 3 Imported by: 2

Documentation

Overview

Package networkmanager wraps a couple of NetworkManager's DBus API points: the org.freedesktop.NetworkManager.state call, and listening for the StateChange signal, similarly for the primary connection and wireless enabled state.

Index

Constants

This section is empty.

Variables

View Source
var BusAddress bus.Address = bus.Address{
	Interface: "org.freedesktop.NetworkManager",
	Path:      "/org/freedesktop/NetworkManager",
	Name:      "org.freedesktop.NetworkManager",
}

NetworkManager lives on a well-knwon bus.Address

Functions

This section is empty.

Types

type NetworkManager

type NetworkManager interface {
	// GetState fetches and returns NetworkManager's current state
	GetState() State
	// WatchState listens for changes to NetworkManager's state, and sends
	// them out over the channel returned.
	WatchState() (<-chan State, bus.Cancellable, error)
	// GetPrimaryConnection fetches and returns NetworkManager's current
	// primary connection.
	GetPrimaryConnection() string
	// WatchPrimaryConnection listens for changes of NetworkManager's
	// Primary Connection, and sends them out over the channel returned.
	WatchPrimaryConnection() (<-chan string, bus.Cancellable, error)
	// GetWirelessEnabled fetches and returns NetworkManager's
	// wireless state.
	GetWirelessEnabled() bool
	// WatchWirelessEnabled listens for changes of NetworkManager's
	// wireless state, and sends them out over the channel returned.
	WatchWirelessEnabled() (<-chan bool, bus.Cancellable, error)
}

func New

func New(endp bus.Endpoint, log logger.Logger) NetworkManager

New returns a new NetworkManager that'll use the provided bus.Endpoint

type State

type State uint32
const (
	Unknown State = iota * 10
	Asleep
	Disconnected
	Disconnecting
	Connecting
	ConnectedLocal
	ConnectedSite
	ConnectedGlobal
)

the NetworkManager states, as per https://wiki.gnome.org/Projects/NetworkManager/DBusInterface/LatestDBusAPI

func (State) String

func (state State) String() string

give its state a descriptive stringification

Jump to

Keyboard shortcuts

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