dbus

package
v0.0.0-...-f1366d8 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Timezones = []string{}/* 426 elements not displayed */

Timezones is the system time zones

Functions

This section is empty.

Types

type DBus

type DBus struct {
	// contains filtered or unexported fields
}

DBus implements a wrapper for the dbus service

func NewDBus

func NewDBus() (*DBus, error)

NewDBus creates a dbus wrapper service

func (*DBus) NMDevices

func (db *DBus) NMDevices() (map[string]string, error)

NMDevices gets the paths of the network interfaces

func (*DBus) NMInterfaceConfig

func (db *DBus) NMInterfaceConfig(p string) *NMDeviceSettings

NMInterfaceConfig gets the details of the active interfaces

func (*DBus) NMInterfaceConfigUpdate

func (db *DBus) NMInterfaceConfigUpdate(p string, eth NMDeviceSettings) error

NMInterfaceConfigUpdate stores the updated configuration for a hardware interface

func (*DBus) NMIsRunning

func (db *DBus) NMIsRunning() error

NMIsRunning checks if the network manager service is running

func (*DBus) NetplanApply

func (db *DBus) NetplanApply() error

NetplanApply applies the current netplan configuration

func (*DBus) SetNTP

func (db *DBus) SetNTP(value bool) error

SetNTP sets whether the time should be synced

func (*DBus) SetTime

func (db *DBus) SetTime(setTime string) error

SetTime sets the current time

func (*DBus) SetTimezone

func (db *DBus) SetTimezone(timezone string) error

SetTimezone sets the device time zone

func (*DBus) TimeDateStatus

func (db *DBus) TimeDateStatus() *Time

TimeDateStatus gets the current time settings on the device

type MockDbus

type MockDbus struct{}

MockDbus mocks dbus

func (*MockDbus) NMDevices

func (m *MockDbus) NMDevices() (map[string]string, error)

NMDevices mocks fetching the configured devices

func (*MockDbus) NMInterfaceConfig

func (m *MockDbus) NMInterfaceConfig(p string) *NMDeviceSettings

NMInterfaceConfig mocks the network manager config

func (*MockDbus) NMInterfaceConfigUpdate

func (m *MockDbus) NMInterfaceConfigUpdate(p string, eth NMDeviceSettings) error

NMInterfaceConfigUpdate updates network settings

func (*MockDbus) NMIsRunning

func (m *MockDbus) NMIsRunning() error

NMIsRunning mocks checking network manager

func (*MockDbus) NetplanApply

func (m *MockDbus) NetplanApply() error

NetplanApply mocks applying netplan config

func (*MockDbus) SetNTP

func (m *MockDbus) SetNTP(value bool) error

SetNTP mocks the ntp server usages

func (*MockDbus) SetTime

func (m *MockDbus) SetTime(setTime string) error

SetTime mocks setting time

func (*MockDbus) SetTimezone

func (m *MockDbus) SetTimezone(timezone string) error

SetTimezone mocks setting the time zone

func (*MockDbus) TimeDateStatus

func (m *MockDbus) TimeDateStatus() *Time

TimeDateStatus mocks the time/date config

type NMDeviceAddress

type NMDeviceAddress struct {
	Address string
	Prefix  uint32
}

NMDeviceAddress holds the details of a network address

type NMDeviceSettings

type NMDeviceSettings struct {
	DHCP4       bool
	State       uint32
	AddressData []NMDeviceAddress
	NameServers []string
	Gateway     string
	IsWifi      bool
	SSID        string
	Password    string
}

NMDeviceSettings holds the configuration for a NM device

type Service

type Service interface {
	TimeDateStatus() *Time
	SetNTP(value bool) error
	SetTimezone(timezone string) error
	SetTime(setTime string) error
	NetplanApply() error

	// Network Manager
	NMIsRunning() error
	NMDevices() (map[string]string, error)
	NMInterfaceConfig(p string) *NMDeviceSettings
	NMInterfaceConfigUpdate(p string, eth NMDeviceSettings) error
}

Service is the interface to abstract dbus

type Time

type Time struct {
	Timezone string
	NTP      bool
	Time     time.Time
}

Time holds the dbus time settings

Jump to

Keyboard shortcuts

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