Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ASNCmd *cobra.Command = &cobra.Command{ Use: "asn", Short: "Look up an ASN", Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { cmd.Help() os.Exit(0) } s := style.NewSpinner(cmd) for _, arg := range args { if util.IsASN(arg) { p, _ := s.Start() r, err := addr.QueryASN(arg) p.Stop() if err != nil { cmd.PrintErr(err.Error() + "\n") os.Exit(1) } cmd.Println(style.ASNBox(r)) } else { cmd.PrintErrf("invalid argument '%s'\n", arg) os.Exit(1) } } }, }
View Source
var IPCmd *cobra.Command = &cobra.Command{ Use: "ip", Short: "Look up an IP address or prefix", Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { cmd.Help() os.Exit(0) } s := style.NewSpinner(cmd) for _, arg := range args { if util.IsIP(arg) { p, _ := s.Start() r, err := addr.QueryIPPrefix(arg) if err != nil { p.Stop() cmd.PrintErr(err.Error() + "\n") os.Exit(1) } ptrs, _ := addr.DNSReverseLookup(r.IP) p.Stop() cmd.Println(style.IPBox(r, ptrs)) } else { cmd.PrintErrf("invalid argument '%s'\n", arg) os.Exit(1) } } }, }
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.