32 lines
738 B
Go
32 lines
738 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
)
|
|
|
|
// Settings - Configuration file structure
|
|
type Settings struct {
|
|
Crawl bool
|
|
LogLevel int
|
|
Hostname string
|
|
}
|
|
|
|
var settings Settings
|
|
|
|
/* Test: TestStringexists */
|
|
func stringexists(needle string, haystack []string) bool {
|
|
for _, check := range haystack {
|
|
if check == needle {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func getSettings() {
|
|
flag.BoolVar(&settings.Crawl, "c", true, "Crawl mode (default is yes)")
|
|
flag.StringVar(&settings.Hostname, "h", "myhostname", "Set your hostname")
|
|
flag.IntVar(&settings.LogLevel, "l", 1, "Logging Level:\n 0) No logs\n 1) Reports every 30 seconds\n 2) Errors\n 3) Warnings\n 4) New Connections\n 5) Debugging\n")
|
|
flag.Parse()
|
|
}
|