Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // MaximumRefreshInterval decides the maximum sleep time between SRV Lookups, otherwise controlled by TTL of records. MaximumRefreshInterval = 5 * time.Second // ExpirationMargin, the margin before the TTL expiration on which we should re-resolve. ExpirationMargin = 50 * time.Millisecond )
Functions ¶
func New ¶
func New(targetAddr string, parent http.RoundTripper, resolver naming.Resolver, policy LBPolicy) (*tripper, error)
New creates a new load-balanced Round Tripper for a single backend.
This RoundTripper is meant to only dial a single backend, and will throw errors if the req.URL.Host doesn't match the targetAddr.
For resolving backend addresses it uses a grpc.naming.Resolver, allowing for generic use.
Types ¶
type LBPolicy ¶
type LBPolicy interface { // Pick decides on which target to use for the request out of the provided ones. Pick(req *http.Request, currentTargets []*Target) (*Target, error) }
LBPolicy decides which target to pick for a given call.
func RoundRobinPolicy ¶
func RoundRobinPolicyFromFlags ¶
func RoundRobinPolicyFromFlags() LBPolicy
Click to show internal directories.
Click to hide internal directories.