You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
753 B
45 lines
753 B
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()) |
|
|
|
} |
|
}
|
|
|