Documentation
¶
Index ¶
- Variables
- func BoolPointer(b bool) *bool
- func CheckDirAndCreate(dir string, name string) (string, error)
- func CreateOrPurgeDir(dir string, callingFunction string)
- func Debugf(s string)
- func DetectBrowserOrCLI(request *http.Request) string
- func Fatalf(s string)
- func FileExists(file string) bool
- func FuncName() string
- func GetRequestClientIp(request *http.Request, proxyNetworks []net.IPNet) (net.IP, error)
- func GetSha256sumFile(file string) string
- func InBetween(i, min, max int) bool
- func Infof(s string)
- func IsDir(dir string) bool
- func KeysString(m map[string]struct{}) []string
- func NormalizeDir(dir string) string
- func ParseNetworks(networkStrings []string, contextMessage string) ([]net.IPNet, error)
- func PurgeDir(dir string, callingFunction string)
- func RandSeq() string
- func StringSliceContains(slice []string, element string) bool
- func TimeTrack(start time.Time, name string)
- func Verbosef(s string)
- func Warnf(s string)
- func WriteStructJSONFile(file string, v interface{})
- type ExecResult
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func BoolPointer ¶
func CheckDirAndCreate ¶
checkDirAndCreate tests if the given directory exists and tries to create it
func CreateOrPurgeDir ¶
func Debugf ¶
func Debugf(s string)
Debugf is a helper function for Debug logging if global variable Debug is set to true
func DetectBrowserOrCLI ¶
DetectBrowserOrCLI checks for the existance of a User-Agent request header and primitivly tries to check if the request was made from a browser or from a CLI, like wget or curl and returns either "plain" if a CLI was detected or "html" if a browser was detected
func FileExists ¶
FileExists checks if the given file exists and returns a bool
func GetRequestClientIp ¶
GetRequestClientIp extract the client IP address from the request with support for X-Forwarded-For header when the request is originating from proxied networks
func GetSha256sumFile ¶
getSha256sumFile return the SHA256 hash sum of the given file
func Infof ¶
func Infof(s string)
Infof is a helper function for Info logging if global variable Info is set to true
func KeysString ¶
func NormalizeDir ¶
NormalizeDir removes from the given directory path multiple redundant slashes and adds a trailing slash
func ParseNetworks ¶
func RandSeq ¶
func RandSeq() string
randSeq returns a fixed length random string to identify each request in the log http://stackoverflow.com/a/22892986/682847
func StringSliceContains ¶
func Verbosef ¶
func Verbosef(s string)
Verbosef is a helper function for Verbose logging if global variable Verbose is set to true
func WriteStructJSONFile ¶
func WriteStructJSONFile(file string, v interface{})
Types ¶
type ExecResult ¶
ExecResult contains the exit code and output of an external command (e.g. git)
func ExecuteCommand ¶
func ExecuteCommand(command string, timeout int, allowFail bool) ExecResult