Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CmdMessage ¶
type CmdMessage struct {
Id string
Command string
Message string
Error bool
Cmd *exec.Cmd
Stdin *io.WriteCloser
}
CmdMessage structures command output.
type CmdRunner ¶
type CmdRunner struct {
Log bunyan.Logger
Messages chan CmdMessage
Handlers map[string]func(CmdMessage)
Commands map[string]*exec.Cmd
}
CmdRunner runs internal commands allows output handlers to be attached.
func (*CmdRunner) HandleFunc ¶
func (c *CmdRunner) HandleFunc(cmdId string, handler func(cmdMessage CmdMessage))
HandleFunc is a function that gets all channel messages for a command id
type Command ¶
Command for device network commands.
func (*Command) AddApInterface ¶
func (c *Command) AddApInterface()
AddApInterface adds the AP interface.
func (*Command) CheckApInterface ¶
func (c *Command) CheckApInterface()
CheckInterface checks the AP interface.
func (*Command) ConfigureApInterface ¶
func (c *Command) ConfigureApInterface()
ConfigureApInterface configured the AP interface.
func (*Command) RemoveApInterface ¶
func (c *Command) RemoveApInterface()
RemoveApInterface removes the AP interface.
func (*Command) StartWpaSupplicant ¶
func (c *Command) StartWpaSupplicant()
StartWpaSupplicant starts wpa_supplicant.
func (*Command) UpApInterface ¶
func (c *Command) UpApInterface()
UpApInterface ups the AP Interface.
type DnsmasqCfg ¶
type DnsmasqCfg struct {
Address string `json:"address"` // --address=/#/192.168.27.1",
DhcpRange string `json:"dhcp_range"` // "--dhcp-range=192.168.27.100,192.168.27.150,1h",
VendorClass string `json:"vendor_class"` // "--dhcp-vendorclass=set:device,IoT",
}
DnsmasqCfg configures dnsmasq and is used by SetupCfg.
type HostApdCfg ¶
type HostApdCfg struct {
Ssid string `json:"ssid"` // ssid=iotwifi2
WpaPassphrase string `json:"wpa_passphrase"` // wpa_passphrase=iotwifipass
Channel string `json:"channel"` // channel=6
Ip string `json:"ip"` // 192.168.27.1
}
HostApdCfg configures hostapd and is used by SetupCfg.
type SetupCfg ¶
type SetupCfg struct {
DnsmasqCfg DnsmasqCfg `json:"dnsmasq_cfg"`
HostApdCfg HostApdCfg `json:"host_apd_cfg"`
WpaSupplicantCfg WpaSupplicantCfg `json:"wpa_supplicant_cfg"`
}
SetupCfg is the main configuration structure.
type WpaCfg ¶
WpaCfg for configuring wpa
func (*WpaCfg) ConfiguredNetworks ¶
ConfiguredNetworks returns a list of configured wifi networks.
func (*WpaCfg) ConnectNetwork ¶
func (wpa *WpaCfg) ConnectNetwork(creds WpaCredentials) (WpaConnection, error)
ConnectNetwork connects to a wifi network
func (*WpaCfg) ScanNetworks ¶
func (wpa *WpaCfg) ScanNetworks() (map[string]WpaNetwork, error)
ScanNetworks returns a map of WpaNetwork data structures.
type WpaConnection ¶
type WpaConnection struct {
Ssid string `json:"ssid"`
State string `json:"state"`
Ip string `json:"ip"`
Message string `json:"message"`
}
WpaConnection defines a WPA connection.
type WpaCredentials ¶
WpaCredentials defines wifi network credentials.
type WpaNetwork ¶
type WpaNetwork struct {
Bssid string `json:"bssid"`
Frequency string `json:"frequency"`
SignalLevel string `json:"signal_level"`
Flags string `json:"flags"`
Ssid string `json:"ssid"`
}
WpaNetwork defines a wifi network to connect to.
type WpaSupplicantCfg ¶
type WpaSupplicantCfg struct {
CfgFile string `json:"cfg_file"` // /etc/wpa_supplicant/wpa_supplicant.conf
}
WpaSupplicantCfg configures wpa_supplicant and is used by SetupCfg