Documentation ¶
Overview ¶
Package cmd contains command implementations
Index ¶
- Constants
- Variables
- func GetVersion(print bool) (txt string)
- func HasFlag() bool
- func InitFlag()
- func InitLog()
- func IsFlagPassed(name string) bool
- func IsPrivateIPv4(s string) bool
- func IsPrivateIPv6(s string) bool
- func IsValidIP(s string) bool
- func LogHttping(stats httping.Stats, err error, address string)
- func LogMtr(hops []mtr.Hops)
- func LogPing(dst *net.IPAddr, dur time.Duration, err error)
- func LogQuery(info IPInfo)
- func LogTcping(code int, address string)
- func LookupIP(s string) string
- func ParseInput(s string) string
- type IPInfo
Constants ¶
View Source
const ( // API is the URL of ifconfig network info API API string = "https://ifconfig.is/json/" )
Variables ¶
View Source
var ( // Name is the name of the program Name = "tcping" // Version is the version of the program Version = "- not set -" // Commit is the commit of the build Commit = "snapshot" // Date is the date of the build Date = "" )
View Source
var CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError)
CommandLine is the flag command line
View Source
var HTTPingDst string
HTTPingDst is the HTTP Ping URL
View Source
var Logger = logrus.New()
Logger is the global logger
View Source
var MtrDst string
MtrDst is the MTR Trace Address
View Source
var PingDst string
PingDst is the ICMP Ping Address
View Source
var Query string
Query is the Query IP Address
View Source
var TCPingDst string
TCPingDst is the TCP Ping Address
View Source
var Usage = func() { _, _ = fmt.Fprintf(CommandLine.Output(), "Usage:\n") flag.PrintDefaults() }
Usage prints the usage
View Source
var VersionFlg bool
VersionFlg is the version flag
Functions ¶
func IsFlagPassed ¶
IsFlagPassed checks if a specific flag is passed
func IsPrivateIPv4 ¶
IsPrivateIPv4 checks if the input string is a private IPv4 address
func IsPrivateIPv6 ¶
IsPrivateIPv6 checks if the input string is a private IPv6 address
func LogHttping ¶
LogHttping logs the httping results
Types ¶
type IPInfo ¶
type IPInfo struct { Continent string `json:"Continent"` Country string `json:"Country"` City string `json:"City"` Latitude float64 `json:"Latitude"` Longitude float64 `json:"Longitude"` TimeZone string `json:"TimeZone"` ASN uint `json:"ASN"` ORG string `json:"Organization"` }
IPInfo is the struct of IP information
Click to show internal directories.
Click to hide internal directories.