Documentation ¶
Overview ¶
Package wpasupplicant provides an interface for talking to the wpa_supplicant daemon.
At the moment, this simply provides an interface for fetching wifi scan results. More functionality is (probably) coming soon.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cipher ¶
type Cipher int
Cipher is one of the WPA_CIPHER constants from the wpa_supplicant source.
type ConfiguredNetwork ¶
type ConfiguredNetwork interface { NetworkID() string SSID() string BSSID() string Flags() []string }
ConfiguredNetwork is a configured network (from LIST_NETWORKS)
type Conn ¶
type Conn interface { // Close closes the unixgram connection Close() error // Ping tests the connection. It returns nil if wpa_supplicant is // responding. Ping() error // AddNetwork creates an empty network configuration. Returns the network // ID. AddNetwork() (int, error) // SetNetwork configures a network property. Returns error if the property // configuration failed. SetNetwork(int, string, string) error // EnableNetwork enables a network. Returns error if the command fails. EnableNetwork(int) error // EnableAllNetworks enables all configured networks. Returns error if the command fails. EnableAllNetworks() error // SelectNetwork selects a network (and disables the others). SelectNetwork(int) error // DisableNetwork disables a network. DisableNetwork(int) error // RemoveNetwork removes a network from the configuration. RemoveNetwork(int) error // RemoveAllNetworks removes all networks (basically running `REMOVE_NETWORK all`). // Returns error if command fails. RemoveAllNetworks() error // SaveConfig stores the current network configuration to disk. SaveConfig() error // Reconfigure sends a RECONFIGURE command to the wpa_supplicant. Returns error when // command fails. Reconfigure() error // Reassociate sends a REASSOCIATE command to the wpa_supplicant. Returns error when // command fails. Reassociate() error // Reconnect sends a RECONNECT command to the wpa_supplicant. Returns error when // command fails. Reconnect() error // ListNetworks returns the currently configured networks. ListNetworks() ([]ConfiguredNetwork, error) // Status returns current wpa_supplicant status Status() (StatusResult, error) // Scan triggers a new scan. Returns error if the wpa_supplicant does not // return OK. Scan() error // ScanResult returns the latest scanning results. It returns a slice // of scanned BSSs, and/or a slice of errors representing problems // communicating with wpa_supplicant or parsing its output. ScanResults() ([]ScanResult, []error) EventQueue() chan WPAEvent // Timeout returns the current timeout value for waiting for command responses // from WPS Supplicant Timeout() time.Duration // SetTimeout defines the timeout value of how long to wait for WPA Supplicant // command responses SetTimeout(time.Duration) }
Conn is a connection to wpa_supplicant over one of its communication channels.
type KeyMgmt ¶
type KeyMgmt int
KeyMgmt is one of the WPA_KEY_MGMT constants from the wpa_supplicant source.
type ParseError ¶
type ParseError struct { // Line is the line of output from wpa_supplicant which we couldn't // parse. Line string // Err is any nested error. Err error }
ParseError is returned when we can't parse the wpa_supplicant response. Some functions may return multiple ParseErrors.
func (*ParseError) Error ¶
func (err *ParseError) Error() string
type ScanResult ¶
type ScanResult interface { // BSSID is the MAC address of the BSS. BSSID() net.HardwareAddr // SSID is the SSID of the BSS. SSID() string // Frequency is the frequency, in Mhz, of the BSS. Frequency() int // RSSI is the received signal strength, in dB, of the BSS. RSSI() int // Flags is an array of flags, in string format, returned by the // wpa_supplicant SCAN_RESULTS command. Future versions of this code // will parse these into something more meaningful. Flags() []string }
ScanResult is a scanned BSS.