nm

package
v0.0.0-...-9b34752 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeviceStateChangedInterface = gonetworkmanager.DeviceInterface + ".StateChanged"
)
View Source
const (
	DevicesObjectPath = gonetworkmanager.NetworkManagerObjectPath + "/Devices"
)

Variables

View Source
var Version string

Functions

func Connect

func Connect() (err error)

func DeleteWifi

func DeleteWifi(ssid string) error

func Device

func Device(name string) (json.RawMessage, error)

func Devices

func Devices() (map[string]json.RawMessage, error)

func Hotspot

func Hotspot(ssid string, psk string) (err error)

func Monitor

func Monitor(ctx context.Context, c chan<- interface{}) (err error)

func Wifi

func Wifi(ssid string, psk string, autoconnect bool) (err error)

Types

type AccessPoint

type AccessPoint struct {
	Flags      uint32                       `json:"flags"`
	Frequency  uint32                       `json:"freq"`
	HWAddress  string                       `json:"hwAddress"`
	MaxBitrate uint32                       `json:"maxBitrate"`
	Mode       gonetworkmanager.Nm80211Mode `json:"mode"`
	RSNFlags   uint32                       `json:"rsnFlags"`
	SSID       string                       `json:"ssid"`
	Strength   uint8                        `json:"strength"`
	WPAFlags   uint32                       `json:"wpaFlags"`
}

func ScanWifi

func ScanWifi() ([]AccessPoint, error)

type ConnectionSettings

type ConnectionSettings map[string]map[string]interface{}

func Connections

func Connections() (s []ConnectionSettings, err error)

type DeviceState

type DeviceState = gonetworkmanager.NmDeviceState

type DeviceStateReason

type DeviceStateReason uint32
const (
	DeviceStateReasonNone                        DeviceStateReason = iota // No reason given
	DeviceStateReasonUnknown                                              // Unknown error
	DeviceStateReasonNowManaged                                           // Device is now managed
	DeviceStateReasonNowUnmanaged                                         // Device is now unmanaged
	DeviceStateReasonConfigFailed                                         // The device could not be readied for configuration
	DeviceStateReasonIpConfigUnavailable                                  // IP configuration could not be reserved (no available address, timeout, etc)
	DeviceStateReasonIpConfigExpired                                      // The IP config is no longer valid
	DeviceStateReasonNoSecrets                                            // Secrets were required, but not provided
	DeviceStateReasonSupplicantDisconnect                                 // 802.1x supplicant disconnected
	DeviceStateReasonSupplicantConfigFailed                               // 802.1x supplicant configuration failed
	DeviceStateReasonSupplicantFailed                                     // 802.1x supplicant failed
	DeviceStateReasonSupplicantTimeout                                    // 802.1x supplicant took too long to authenticate
	DeviceStateReasonPppStartFailed                                       // PPP service failed to start
	DeviceStateReasonPppDisconnect                                        // PPP service disconnected
	DeviceStateReasonPppFailed                                            // PPP failed
	DeviceStateReasonDhcpStartFailed                                      // DHCP client failed to start
	DeviceStateReasonDhcpError                                            // DHCP client error
	DeviceStateReasonDhcpFailed                                           // DHCP client failed
	DeviceStateReasonSharedStartFailed                                    // Shared connection service failed to start
	DeviceStateReasonSharedFailed                                         // Shared connection service failed
	DeviceStateReasonAutoipStartFailed                                    // AutoIP service failed to start
	DeviceStateReasonAutoipError                                          // AutoIP service error
	DeviceStateReasonAutoipFailed                                         // AutoIP service failed
	DeviceStateReasonModemBusy                                            // The line is busy
	DeviceStateReasonModemNoDialTone                                      // No dial tone
	DeviceStateReasonModemNoCarrier                                       // No carrier could be established
	DeviceStateReasonModemDialTimeout                                     // The dialing request timed out
	DeviceStateReasonModemDialFailed                                      // The dialing attempt failed
	DeviceStateReasonModemInitFailed                                      // Modem initialization failed
	DeviceStateReasonGsmApnFailed                                         // Failed to select the specified APN
	DeviceStateReasonGsmRegistrationNotSearching                          // Not searching for networks
	DeviceStateReasonGsmRegistrationDenied                                // Network registration denied
	DeviceStateReasonGsmRegistrationTimeout                               // Network registration timed out
	DeviceStateReasonGsmRegistrationFailed                                // Failed to register with the requested network
	DeviceStateReasonGsmPinCheckFailed                                    // PIN check failed
	DeviceStateReasonFirmwareMissing                                      // Necessary firmware for the device may be missing
	DeviceStateReasonRemoved                                              // The device was removed
	DeviceStateReasonSleeping                                             // NetworkManager went to sleep
	DeviceStateReasonConnectionRemoved                                    // The device's active connection disappeared
	DeviceStateReasonUserRequested                                        // Device disconnected by user or client
	DeviceStateReasonCarrier                                              // Carrier/link changed
	DeviceStateReasonConnectionAssumed                                    // The device's existing connection was assumed
	DeviceStateReasonSupplicantAvailable                                  // The supplicant is now available
	DeviceStateReasonModemNotFound                                        // The modem could not be found
	DeviceStateReasonBtFailed                                             // The Bluetooth connection failed or timed out
	DeviceStateReasonGsmSimNotInserted                                    // GSM Modem's SIM Card not inserted
	DeviceStateReasonGsmSimPinRequired                                    // GSM Modem's SIM Pin required
	DeviceStateReasonGsmSimPukRequired                                    // GSM Modem's SIM Puk required
	DeviceStateReasonGsmSimWrong                                          // GSM Modem's SIM wrong
	DeviceStateReasonInfinibandMode                                       // InfiniBand device does not support connected mode
	DeviceStateReasonDependencyFailed                                     // A dependency of the connection failed
	DeviceStateReasonBr2684Failed                                         // Problem with the RFC 2684 Ethernet over ADSL bridge
	DeviceStateReasonModemManagerUnavailable                              // ModemManager not running
	DeviceStateReasonSsidNotFound                                         // The Wi-Fi network could not be found
	DeviceStateReasonSecondaryConnectionFailed                            // A secondary connection of the base connection failed
	DeviceStateReasonDcbFcoeFailed                                        // DCB or FCoE setup failed
	DeviceStateReasonTeamdControlFailed                                   // teamd control failed
	DeviceStateReasonModemFailed                                          // Modem failed or no longer available
	DeviceStateReasonModemAvailable                                       // Modem now ready and available
	DeviceStateReasonSimPinIncorrect                                      // SIM PIN was incorrect
	DeviceStateReasonNewActivation                                        // New connection activation was enqueued
	DeviceStateReasonParentChanged                                        // the device's parent changed
	DeviceStateReasonParentManagedChanged                                 // the device parent's management changed
	DeviceStateReasonOvsdbFailed                                          // problem communicating with Open vSwitch database
	DeviceStateReasonIpAddressDuplicate                                   // a duplicate IP address was detected
	DeviceStateReasonIpMethodUnsupported                                  // The selected IP method is not supported
	DeviceStateReasonSriovConfigurationFailed                             // configuration of SR-IOV parameters failed
	DeviceStateReasonPeerNotFound                                         // The Wi-Fi P2P peer could not be found
)

func (DeviceStateReason) String

func (i DeviceStateReason) String() string

type EventDeviceStateChanged

type EventDeviceStateChanged struct {
	Device               string `json:"device"`
	OldState             string `json:"oldState"`
	NewState             string `json:"newState"`
	Reason               string `json:"reason"`
	ActiveConnectionId   string `json:"activeConnectionId,omitempty"`
	ActiveConnectionUUID string `json:"activeConnectionUUID,omitempty"`
}

Jump to

Keyboard shortcuts

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