cluster.go
func (c *Cluster) Host() *URI {
	c.mutex.Lock()
	var host *URI
	for i := range c.okList {
		idx := (i + c.lastHostIdx) % len(c.okList)
		ok := c.okList[idx]
		if ok {
			host = c.hosts[idx]
			break
		}
	}
	c.lastHostIdx++
	c.mutex.Unlock()
	if host != nil {
		return host
	}
	c.reset()
	return host
}
func (c *Cluster) Host() *URI {
	c.mutex.Lock()
	var host *URI
	for i := range c.okList {
		idx := (i + c.lastHostIdx) % len(c.okList)
		ok := c.okList[idx]
		if ok {
			host = c.hosts[idx]
			break
		}
	}
	c.lastHostIdx++
	c.mutex.Unlock()
	if host != nil {
		return host
	}
	c.reset()
	return host
}
func ( c * Cluster ) Host ( ) * URI { c . mutex . Lock ( ) var host * URI for i := range c . okList { idx := ( i + c . lastHostIdx ) % len ( c . okList ) ok := c . okList [ idx ] if ok { host = c . hosts [ idx ] break } } c . lastHostIdx ++ c . mutex . Unlock ( ) if host != nil { return host } c . reset ( ) return host }
// Host returns a host in the cluster.
Host returns a host in the cluster .