Skip to content

Instantly share code, notes, and snippets.

@lotusirous
Created March 24, 2019 19:08
Show Gist options
  • Select an option

  • Save lotusirous/941fe0c3543fc9ec75b51d4ca60d54e3 to your computer and use it in GitHub Desktop.

Select an option

Save lotusirous/941fe0c3543fc9ec75b51d4ca60d54e3 to your computer and use it in GitHub Desktop.
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