utils

package
v0.0.0-...-61e9e54 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2017 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FmtPrefix to be included in all log traces
	FmtPrefix = "== wifi-connect"
)

Variables

View Source
var HashFile = filepath.Join(os.Getenv("SNAP_COMMON"), "hash")

HashFile is the path to the file that stores the hash of the portals password

View Source
var SsidsFile = filepath.Join(os.Getenv("SNAP_COMMON"), "ssids")

SsidsFile path to the file filled by daemon with available ssids in csv format

Functions

func Errorf

func Errorf(format string, a ...interface{}) error

Errorf returns a new instance implementing error interface taken a formatted string and params as input

func HashIt

func HashIt(s string) ([]byte, error)

HashIt writes the hash of the passed password to the HashFile and returns the hash and error

func MatchingHash

func MatchingHash(pword string) (bool, error)

MatchingHash verifies the passed password against the saved hash, returng true if they match, else false

func PkgErrorf

func PkgErrorf(pkg string, format string, a ...interface{}) error

PkgErrorf returns a new instance implementing error interface taken a formatted string and params as input

func PkgSprintf

func PkgSprintf(pkg string, format string, a ...interface{}) string

PkgSprintf returns a formatted string with project prefix

func PrintMapSorted

func PrintMapSorted(m map[string]interface{})

PrintMapSorted prints to stdout a map sorting content by keys

func ReadSsidsFile

func ReadSsidsFile() ([]string, error)

ReadSsidsFile read the ssids file, if any

func RemoveFlagFile

func RemoveFlagFile(path string) error

RemoveFlagFile removes passed flag file

func RunningOn

func RunningOn(address string) bool

RunningOn returns true if evaluated address is listening

func SetHashFile

func SetHashFile(p string)

SetHashFile sets the HashFile var

func SetSsidsFile

func SetSsidsFile(p string)

SetSsidsFile sets the SsidsFile var

func Sprintf

func Sprintf(format string, a ...interface{}) string

Sprintf returns a formatted string with project prefix

func WriteFlagFile

func WriteFlagFile(path string) error

WriteFlagFile writes passed flag file

Types

This section is empty.

Jump to

Keyboard shortcuts

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