Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultHTTPPingOpts = &HTTPPingOpts{ PingTimeout: 3 * time.Second, PingCount: 10, Method: http.MethodGet, Body: nil, Headers: nil, Interval: func() time.Duration { return time.Duration(rand.Int63n(200)) * time.Millisecond }, MaxConcurrency: 10, FailOver: 5, }
DefaultHTTPPingOpts will be used if PingOpts is nil with the HTTPPing function.
View Source
var DefaultICMPPingOpts = &ICMPPingOpts{ PingTimeout: 3 * time.Second, PingCount: 10, MaxConcurrency: 10, FailOver: 5, Interval: func() time.Duration { return time.Duration(rand.Int63n(200)) * time.Millisecond }, Bind4: "0.0.0.0", ResolverTimeout: 1500 * time.Millisecond, PayloadSize: 56, }
DefaultICMPPingOpts will be used if PingOpts is nil with the ICMPPing function.
View Source
var DefaultTCPPingOpts = &TCPPingOpts{ PingTimeout: 3 * time.Second, PingCount: 10, Interval: func() time.Duration { return time.Duration(rand.Int63n(200)) * time.Millisecond }, MaxConcurrency: 10, FailOver: 5, }
DefaultTCPPingOpts will be used if PingOpts is nil with the TCPPing function.
Functions ¶
This section is empty.
Types ¶
type HTTPPingOpts ¶
type HTTPPingOpts struct { // PingTimeout is the timeout for a ping request. PingTimeout time.Duration // PingCount is the number of requests that will be sent to compute the ping quality of a host. PingCount int // MaxConcurrency sets the maximum goroutine used. MaxConcurrency int // FailOver is the per host maximum failed allowed. FailOver int // Interval returns a time.Duration as the delay. Interval func() time.Duration // Method represents the HTTP Method(GET/POST/PUT/...). Method string // Body represents the HTTP Request body. Body io.Reader // Headers represents for the HTTP Headers. Headers map[string]string }
HTTPPingOpts is the option set for the HTTP Ping.
type ICMPPingOpts ¶
type ICMPPingOpts struct { // PingTimeout is the timeout for a ping request. PingTimeout time.Duration // PingCount counting requests for calculating ping quality of host. PingCount int // MaxConcurrency sets the maximum goroutine used. MaxConcurrency int // FailOver is the per host maximum failed allowed. FailOver int // Interval returns a time.Duration as the delay. Interval func() time.Duration // ResolverTimeout is the timeout for the net.ResolveIPAddr request. ResolverTimeout time.Duration // Bind4 is the ipv4 bind to start a raw socket. Bind4 string // PayloadSize represents the request body size for a ping request. PayloadSize uint16 }
ICMPPingOpts is the option set for the ICMP Ping.
type PingStat ¶
type PingStat struct { Host string PktSent int PktLossRate float64 Mean time.Duration Last time.Duration Best time.Duration Worst time.Duration }
PingStat struct is used to record the ping result.
type TCPPingOpts ¶
type TCPPingOpts struct { // PingTimeout is the timeout for a ping request. PingTimeout time.Duration // PingCount counting requests for calculating ping quality of host. PingCount int // MaxConcurrency sets the maximum goroutine used. MaxConcurrency int // FailOver is the per host maximum failed allowed. FailOver int // Interval returns a time.Duration as the delay. Interval func() time.Duration }
TCPPingOpts is the option set for the TCP Ping.
Click to show internal directories.
Click to hide internal directories.