Documentation ¶
Index ¶
- Constants
- func GetAttemptsFromContext(request *http.Request) int
- func GetProxy(s ServerPool, loadBalanceFunction LoadBalanceFunc, backendURL *url.URL) *httputil.ReverseProxy
- func GetRetryFromContext(request *http.Request) int
- func SetAttemptsForContext(request *http.Request, attempts int) context.Context
- func SetRetryForContext(request *http.Request, retries int) context.Context
- type Backend
- type LoadBalanceFunc
- type RoundServerPool
- type ServerPool
- type TbConfig
Constants ¶
View Source
const ( Attempts contextKey = iota Retry )
Variables ¶
This section is empty.
Functions ¶
func GetAttemptsFromContext ¶
func GetProxy ¶
func GetProxy(s ServerPool, loadBalanceFunction LoadBalanceFunc, backendURL *url.URL) *httputil.ReverseProxy
func GetRetryFromContext ¶
func SetAttemptsForContext ¶
Types ¶
type Backend ¶
type Backend struct { URL *url.URL Alive bool ReverseProxy *httputil.ReverseProxy // contains filtered or unexported fields }
func NewBackend ¶
func (*Backend) CheckHealth ¶
func (*Backend) SetProxyErrorHandler ¶
type LoadBalanceFunc ¶
type LoadBalanceFunc http.HandlerFunc
func GetLoadBalanceFunction ¶
func GetLoadBalanceFunction(s ServerPool) LoadBalanceFunc
type RoundServerPool ¶
type RoundServerPool struct {
// contains filtered or unexported fields
}
func (*RoundServerPool) AddBackend ¶
func (s *RoundServerPool) AddBackend(backend *Backend)
func (*RoundServerPool) ChechHealth ¶
func (s *RoundServerPool) ChechHealth()
func (*RoundServerPool) GetNextPeer ¶
func (s *RoundServerPool) GetNextPeer() *Backend
func (*RoundServerPool) MarkBackendStatus ¶
func (s *RoundServerPool) MarkBackendStatus(backendUrl *url.URL, alive bool)
func (*RoundServerPool) NextIndex ¶
func (s *RoundServerPool) NextIndex() int
type ServerPool ¶
Click to show internal directories.
Click to hide internal directories.