Detects the running OS

stable
Justin Reichardt 2021-12-01 14:25:47 -06:00
parent 2a4c78c152
commit 66ab1732bc
1 changed files with 31 additions and 1 deletions

View File

@ -18,4 +18,34 @@
*/
/* rhosts - Program used to maintain a blocklist within a hostfile */
// rhosts - Program used to maintain a blocklist within a hostfile
package main
import (
"runtime"
"fmt"
"os"
)
func main() {
// Detect which OS is running
switch runtime.GOOS {
case "windows":
fmt.Println("Windows is currently unsupported")
os.Exit(1)
//tmpdir := "C:\\tmp"
//hostsloc := "C:\\Windows\\System32\\drivers\\etc\\hosts"
case "linux":
tmpdir := "/tmp/"
hostsloc := "/etc/hosts"
cfgloc :="/etc/rhosts/rhosts.cfg"
fmt.Println("linux:",tmpdir,hostsloc,cfgloc)
case "ios":
fmt.Println("ios")
default:
fmt.Println(runtime.GOOS," is not supported")
os.Exit(1)
}
// Parse Config
}