zerostick

package
v0.0.0-...-fd7ae8a Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScanNetworks

func ScanNetworks() (map[string]WpaNetwork, error)

ScanNetworks returns a map of WpaNetwork data structures.

Types

type NabtoClient

type NabtoClient struct {
	DeviceID  string `json:"deviceid"`
	DeviceKey string `json:"devicekey"`
}

NabtoClient has Nabto config

func (*NabtoClient) ApplyConfig

func (nc *NabtoClient) ApplyConfig()

ApplyConfig configures systemd to load the variables needed to run the unabto tunnel

func (*NabtoClient) DeleteACL

func (nc *NabtoClient) DeleteACL()

DeleteACL removes the ACL files, so the client need to reconfigure

func (*NabtoClient) SetConfig

func (nc *NabtoClient) SetConfig()

SetConfig saves the config

type PushbulletClient

type PushbulletClient struct {
	AccessToken string `json:"access_token"`
	Enabled     bool   `json:"enabled"`
}

PushbulletClient has the struct for the pushbullet config

func (*PushbulletClient) DeleteConfig

func (pb *PushbulletClient) DeleteConfig()

DeleteConfig the PushBullet Config

func (*PushbulletClient) LoadConfig

func (pb *PushbulletClient) LoadConfig()

LoadConfig pulls config from viper

func (*PushbulletClient) SaveConfig

func (pb *PushbulletClient) SaveConfig()

SaveConfig saves the config

func (*PushbulletClient) SendMessage

func (pb *PushbulletClient) SendMessage(message string)

SendMessage sends a message via PushBullet

type PushoverClient

type PushoverClient struct {
	UserKey string `json:"user_key"`
	AppKey  string `json:"app_key"`
	Enabled bool   `json:"enabled"`
}

PushoverClient has the struct for the pushbullet config

func (*PushoverClient) DeleteConfig

func (po *PushoverClient) DeleteConfig()

DeleteConfig the PushBullet Config

func (*PushoverClient) LoadConfig

func (po *PushoverClient) LoadConfig()

LoadConfig pulls config from viper

func (*PushoverClient) SaveConfig

func (po *PushoverClient) SaveConfig()

SaveConfig saves the config

func (*PushoverClient) SendMessage

func (po *PushoverClient) SendMessage(message string)

SendMessage sends a message via PushBullet

func (*PushoverClient) SendMessageWithImage

func (po *PushoverClient) SendMessageWithImage(message, imagePath string)

SendMessageWithImage sends a message via PushBullet with a image attached

type Wifi

type Wifi struct {
	SSID              string `json:"ssid"`
	Password          string `json:",omitempty" yaml:",omitempty"`
	EncryptedPassword string `json:"encrypted_password"`
	Priority          int    `json:"priority"`
	UseForSync        bool   `json:"use_for_sync"`
}

Wifi properties struct

func (*Wifi) EncryptPassword

func (w *Wifi) EncryptPassword()

EncryptPassword encrypts the password in the Wifi struct and removes the unencrypted password

func (Wifi) String

func (w Wifi) String() string

GetWifiConfig returns the Wifi as wpa_supplicant.conf block

type Wifis

type Wifis struct {
	List []Wifi `json:"wifis"`
}

Wifis is a slice of Wifi

func (*Wifis) AddWifiToList

func (ws *Wifis) AddWifiToList(w Wifi)

AddWifiToList appends the given Wifi to the list

func (*Wifis) DeleteWifiFromList

func (ws *Wifis) DeleteWifiFromList(SSID string)

DeleteWifiFromList will remove a wifi (given the SSID string) from the list if it's there

func (Wifis) GetWpaSupplicantConf

func (ws Wifis) GetWpaSupplicantConf() string

GetWpaSupplicantConf generates a wpa_supplicant.conf file

func (*Wifis) ParseViperWifi

func (ws *Wifis) ParseViperWifi()

ParseViperWifi parses the wifis from viper

func (Wifis) WriteConfig

func (ws Wifis) WriteConfig(wpaSupplicantFile string) error

WriteConfig writes the config to disk

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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