Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultEjectThreshold = 2 DefaultRecoverThreshold = 2 DefaultCheckInterval = 5 * time.Second DefaultCheckTimeout = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckFunc ¶
func NewHTTPCheckFunc ¶
NewHTTPCheckFunc makes CheckFunc for HTTP server. This func send request to server and check HTTP status code. A status code over 400 makes failure.
func NewMySQLCheckFunc ¶
NewMySQLCheckFunc makes CheckFunc for MySQL server
func NewTCPCheckFunc ¶
func NewTCPCheckFunc() CheckFunc
NewMySQLCheckFunc makes CheckFunc for general TCP server This func tries connect and close simply.
type Dialer ¶
type Dialer struct {
// contains filtered or unexported fields
}
func (*Dialer) DialContext ¶
DialContext dials to an available address in Dialer via network with context.
func (*Dialer) DialTimeout ¶
DialContext dials to an available address in Dialer via network with timeout.
type Logger ¶
type Logger interface { Println(v ...interface{}) Printf(format string, v ...interface{}) }
Logger is an interface for rrdialer
type Option ¶
type Option struct { EjectThreshold int // When health check failed count reached EjectThreshold, upstream is marked as down until pass health check RecoverThreshold int // When health check succeeded count reached RecoverThreshold, upstream is marked as alive CheckInterval time.Duration // health check interval CheckTimeout time.Duration // health check timeout Logger Logger CheckFunc CheckFunc NextUpstream bool // Try next upstream when dial failed }
Click to show internal directories.
Click to hide internal directories.