wifi

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B  = 1
	KB = 1024 * B
	MB = 1024 * KB
	GB = 1024 * MB
)

Variables

View Source
var TimeLimit = 10 * time.Second

Functions

func CheckConnection

func CheckConnection(timeout time.Duration) error

func CheckHotspotSupported

func CheckHotspotSupported(ctx context.Context) (supported bool, err error)

func CheckIfIsConnected

func CheckIfIsConnected(ctx context.Context) error

func ConnectToSavedWifi

func ConnectToSavedWifi(ctx context.Context) error

func ConnectWifi

func ConnectWifi(ctx context.Context, creds Credentials) error

func DeleteConnection

func DeleteConnection(ctx context.Context, connectionName string)

func DisconnectWifi

func DisconnectWifi(ctx context.Context) error

func GeneratePrivateKeyFromSeed

func GeneratePrivateKeyFromSeed(seed string) (string, error)

func GenerateRandomString

func GenerateRandomString(length int) (string, error)

func GetHardwareID

func GetHardwareID() (string, error)

func RunCommand

func RunCommand(ctx context.Context, commands string) (stdout, stderr string, err error)

exported

func StartHotspot

func StartHotspot(ctx context.Context, forceReload bool) error

startHotspot can be used to get the list of available wifis and their strength If forceReload is set to true it resets the network adapter to make sure it fetches the latest list, otherwise it reads from cache wifiInterface is the name of interface that it should look for in Linux. Default is wlan0

func StopHotspot

func StopHotspot(ctx context.Context) error

Types

type BloxFreeSpaceResponse

type BloxFreeSpaceResponse struct {
	DeviceCount    int     `json:"device_count"`
	Size           float32 `json:"size"`
	Used           float32 `json:"used"`
	Avail          float32 `json:"avail"`
	UsedPercentage float32 `json:"used_percentage"`
}

func GetBloxFreeSpace

func GetBloxFreeSpace() (BloxFreeSpaceResponse, error)

type Config

type Config struct {
	StoreDir string `yaml:"storeDir"`
}

type Credentials

type Credentials struct {
	SSID        string
	Password    string
	CountryCode string
}

type DockerInfo

type DockerInfo struct {
	Image       string            `json:"image"`
	Version     string            `json:"version"`
	ID          string            `json:"id"`
	Labels      map[string]string `json:"labels"`
	Created     string            `json:"created"`
	RepoDigests []string          `json:"repo_digests"`
}

func GetContainerInfo

func GetContainerInfo(containerName string) (DockerInfo, error)

type Wifi

type Wifi struct {
	ESSID string `json:"essid"`
	SSID  string `json:"ssid"`
	RSSI  int    `json:"rssi"`
}

Wifi is the data structure containing the basic elements

func Scan

func Scan(forceReload bool, wifiInterface ...string) (wifilist []Wifi, err error)

Scan can be used to get the list of available wifis and their strength If forceReload is set to true it resets the network adapter to make sure it fetches the latest list, otherwise it reads from cache wifiInterface is the name of interface that it should look for in Linux. Default is wlan0

Jump to

Keyboard shortcuts

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