Documentation
¶
Overview ¶
This is a simple mechanism to provide HA without relying on external components. It doesn't provide load balancing or any other advanced features, if a connection fails it just simple try with the next server in the pool. The retry logic is kept on the clients.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewResolver ¶
func NewResolver(alternateHosts []string) *resolver
NewResolver returns a hosts pool to control the dialer destination
Types ¶
type Dialer ¶
type Dialer struct {
// contains filtered or unexported fields
}
Dialer opens connections through Dial. It iterates over a list of hosts that can be updated externally until it succeeds.
func NewDialerWithAlternateHosts ¶
NewDialerWithAlternateHosts creates a new Dialer instance. If dial is not nil, it will be used to create new underlying connections. Otherwise net.DialContext is used. If alternateHosts is not nil, it will be used to retry failed connections.
func (*Dialer) DialContext ¶
DialContext creates a new connection trying to connect serially over the list of ready hosts in the pool