Created
March 24, 2019 19:08
-
-
Save lotusirous/941fe0c3543fc9ec75b51d4ca60d54e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "flag" | |
| "fmt" | |
| "net" | |
| "os" | |
| ) | |
| var host string | |
| func init() { | |
| flag.StringVar(&host, "host", "kubernetes.default", "target host") | |
| flag.Parse() | |
| } | |
| func main() { | |
| ips, err := net.LookupIP(host) | |
| if err != nil { | |
| fmt.Fprintf(os.Stderr, "Could not get IPs: %v\n", err) | |
| os.Exit(1) | |
| } | |
| for _, ip := range ips { | |
| fmt.Printf("%s. IN A %s\n", host, ip.String()) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment