Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Host ¶
type Host struct { // Unique ID ID string // Address of the Host. If URL provided, Host name will be extracted. Address string }
Host represents a input address to NetSelector
type HostStats ¶
type HostStats struct { Host *Host Success bool Error error // PacketsRecv is the number of packets received. PacketsRecv int // PacketsSent is the number of packets sent. PacketsSent int // PacketLoss is the percentage of packets lost. PacketLoss float64 // IPAddr is the address of the host being pinged. IPAddr *net.IPAddr // Addr is the string address of the host being pinged. Addr string // Rtts is all of the round-trip times sent via this pinger. Rtts []time.Duration // MinRtt is the minimum round-trip time sent via this pinger. MinRtt time.Duration // MaxRtt is the maximum round-trip time sent via this pinger. MaxRtt time.Duration // AvgRtt is the average round-trip time sent via this pinger. AvgRtt time.Duration // StdDevRtt is the standard deviation of the round-trip times sent via // this pinger. StdDevRtt time.Duration }
HostStats represents the results of one particular host
type NetSelector ¶
type NetSelector struct { Hosts []*Host Debug bool Attempts int Timeout time.Duration Privileged bool Threads int }
NetSelector represents the instance of a NetSelector
func NewNetSelector ¶
func NewNetSelector(hosts []*Host) (*NetSelector, error)
NewNetSelector instantiate new instance of NetSelector
func (*NetSelector) Select ¶
func (s *NetSelector) Select() ([]*HostStats, error)
Select finds the faster hosts among the provided inputs, and sort the resulted host in ASC order
Click to show internal directories.
Click to hide internal directories.