package main import ( "flag" "fmt" "git.jpi.io/karasz/gip/giplib" "os" ) var ( //Version contains the git hashtag injected by make Version = "N/A" //BuildTime contains the build timestamp injected by make BuildTime = "N/A" ) func main() { var all bool ptr4 := flag.Bool("4", false, "return only IPv4") ptr6 := flag.Bool("6", false, "return only IPv6") version := flag.Bool("v", false, "return version") flag.Parse() if *version { fmt.Println(Version, " built on ", BuildTime) os.Exit(0) } if *ptr4 == *ptr6 { all = true } if all { fmt.Println(giplib.GetOpenDNS4()) fmt.Println(giplib.GetGoogle6()) os.Exit(0) } if *ptr4 { fmt.Println(giplib.GetOpenDNS4()) } if *ptr6 { fmt.Println(giplib.GetOpenDNS6()) } }