utils

package
v0.0.0-...-9c86ed2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigFile = "gosint"

ConfigFile is the name of the configuration file

Variables

View Source
var (
	// ConfigFilePath defines the path where the standard configuration file will be written
	ConfigFilePath = os.Getenv("HOME") + "/.config/"
)
View Source
var DebugFlag bool

DEBUG_FLAG if true will trigger debug actions like coredump printing and more detailed errors

Functions

func AddToSMap

func AddToSMap(elem string, m map[string]bool) map[string]bool

AddToSMap put a string in a map if is not already present

func CreateDirectory

func CreateDirectory(dirname string)

CreateDirectory creates a directory in the path passed as argument

func FileExists

func FileExists(file string) bool

FileExists return true if the path exists

func GetConfigValue

func GetConfigValue(key string) string

GetConfigValue take as input a key value and will return the relative value set in the configuration file

func MapSDifference

func MapSDifference(m1 map[string]bool, m2 map[string]bool) map[string]bool

MapSDifference takes two matps [string]bool as agument and return a third map containing m1 - m2

func Panic

func Panic(err error, msg string)

Panic is a wrapper function on top of builtin panic, if DEBUG_FLAG is true it will print the core dump, otherwise it will print a message and exit with exitcode 1

func RetrieveRequestBody

func RetrieveRequestBody(domain string) []byte

RetrieveRequestBody send a GET Request to a domain and return the body casted to string

func SetToSlice

func SetToSlice(oldset mapset.Set) []string

SetToSlice convers a set in a slice of strings and then order them

func SimpleQuestion

func SimpleQuestion(question string) bool

SimpleQuestion prompt a simple Y/N question

func WriteConfigFile

func WriteConfigFile(key string, value string)

WriteConfigFile will write default values in the config file specifiend in var_os.go

func WriteOnFile

func WriteOnFile(filename string, text string)

WriteOnFile open a file with Append and write on it, if the file doesn't exist will create it

Types

This section is empty.

Jump to

Keyboard shortcuts

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