Documentation ¶
Index ¶
- Constants
- func FormatError(err error) string
- func FormatIP(IP string) (string, error)
- func ParseAddress(addr string) (*url.URL, error)
- func ParseDuration(t string) (time.Duration, error)
- func Register(p SProtocol, factory Factory)
- type Factory
- type IPing
- type SProtocol
- type TData
- type TOption
- type TPinger
- type TResult
- type TStats
- type TTarget
Constants ¶
View Source
const ( DefaultCounter = 4 DefaultInterval = time.Second DefaultTimeout = time.Second * 5 )
Variables ¶
This section is empty.
Functions ¶
func FormatError ¶
func FormatIP ¶
FormatIP - trim spaces and format IP.
IP - the provided IP ¶
string - return "" if the input is neither valid IPv4 nor valid IPv6
return IPv4 in format like "192.168.9.1" return IPv6 in format like "[2002:ac1f:91c5:1::bd59]"
func ParseAddress ¶
ParseAddress will try to parse addr as url.URL.
func ParseDuration ¶
ParseDuration parse the t as time.Duration, it will parse t as mills when missing unit.
Types ¶
type SProtocol ¶
type SProtocol int
Protocol ...
func NewProtocol ¶
NewProtocol convert protocol string to Protocol
type TPinger ¶
type TPinger struct {
// contains filtered or unexported fields
}
func (*TPinger) PingServer ¶
func (p *TPinger) PingServer()
type TResult ¶
type TStats ¶
type TStats struct { Connected bool `json:"connected"` Duration time.Duration `json:"ping_duration"` DNSDuration time.Duration `json:"dns_Duration"` Address string `json:"address"` Meta map[string]fmt.Stringer `json:"meta"` Extra fmt.Stringer `json:"extra"` Error error `json:"error"` }
func (*TStats) FormatMeta ¶
Click to show internal directories.
Click to hide internal directories.