Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "host <domain>", Short: "Get IP from domain", Args: cobra.ExactArgs(1), Run: func(c *cobra.Command, args []string) { var ipsStr []string ips, err := net.LookupIP(args[0]) if err != nil { log.Fatalln(err) } for _, ip := range ips { ipStr := ip.String() if FlagIPv4Only { if strings.Contains(ipStr, ":") { continue } } if FlagIPv6Only { if strings.Contains(ipStr, ".") { continue } } ipsStr = append(ipsStr, ipStr) if FlagOneAddress { break } } if FlagJson { outJson, err := json.Marshal(ipsStr) if err != nil { panic(err) } fmt.Println(string(outJson)) } else { for _, ip := range ipsStr { fmt.Println(ip) } } }, }
View Source
var FlagIPv4Only bool
View Source
var FlagIPv6Only bool
View Source
var FlagJson bool
View Source
var FlagOneAddress bool
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.