Documentation ¶
Index ¶
- Constants
- func FormatIP(IP string) (string, error)
- func ParseAddress(addr string) (*url.URL, error)
- func ParseDuration(t string) (time.Duration, error)
- func Register(protocol Protocol, factory Factory)
- type Factory
- type Option
- type Ping
- type Pinger
- type Protocol
- type Result
- type Statistics
- type Stats
- type Target
Constants ¶
View Source
const ( DefaultCounter = 4 DefaultInterval = time.Second DefaultTimeout = time.Second * 5 )
Variables ¶
This section is empty.
Functions ¶
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 Pinger ¶
type Pinger struct {
// contains filtered or unexported fields
}
func (*Pinger) Statistics ¶
func (p *Pinger) Statistics() *Statistics
type Protocol ¶
type Protocol int
Protocol ...
func NewProtocol ¶
NewProtocol convert protocol string to Protocol
type Result ¶
type Result struct { Counter int SuccessCounter int Target *Target MinDuration time.Duration MaxDuration time.Duration TotalDuration time.Duration }
Result ...
type Statistics ¶
type Stats ¶
type Stats struct { Connected bool `json:"connected"` Error error `json:"error"` Duration time.Duration `json:"duration"` DNSDuration time.Duration `json:"DNSDuration"` Address string `json:"address"` Meta map[string]fmt.Stringer `json:"meta"` Extra fmt.Stringer `json:"extra"` }
func (*Stats) FormatMeta ¶
Click to show internal directories.
Click to hide internal directories.