Documentation
¶
Overview ¶
HTTP location with load balancing and pluggable middlewares
Index ¶
- Constants
- type HttpLocation
- func (l *HttpLocation) GetId() string
- func (l *HttpLocation) GetLoadBalancer() loadbalance.LoadBalancer
- func (l *HttpLocation) GetMiddlewareChain() *middleware.MiddlewareChain
- func (l *HttpLocation) GetObserverChain() *middleware.ObserverChain
- func (l *HttpLocation) GetOptions() Options
- func (l *HttpLocation) GetOptionsAndTransport() (Options, *http.Transport)
- func (l *HttpLocation) RoundTrip(req request.Request) (*http.Response, error)
- func (l *HttpLocation) SetOptions(o Options) error
- type KeepAlive
- type Limits
- type Options
- type Rewriter
- type Timeouts
Constants ¶
View Source
const ( DefaultHttpReadTimeout = time.Duration(10) * time.Second DefaultHttpDialTimeout = time.Duration(10) * time.Second DefaultTlsHandshakeTimeout = time.Duration(10) * time.Second DefaultKeepAlivePeriod = time.Duration(30) * time.Second DefaultMaxIdleConnsPerHost = 2 )
Standard dial and read timeouts, can be overriden when supplying location
View Source
const ( BalancerId = "__loadBalancer" RewriterId = "__rewriter" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HttpLocation ¶
type HttpLocation struct {
// contains filtered or unexported fields
}
Location with built in failover and load balancing support
func NewLocation ¶
func NewLocation(id string, loadBalancer loadbalance.LoadBalancer) (*HttpLocation, error)
func NewLocationWithOptions ¶
func NewLocationWithOptions(id string, loadBalancer loadbalance.LoadBalancer, o Options) (*HttpLocation, error)
func (*HttpLocation) GetId ¶
func (l *HttpLocation) GetId() string
func (*HttpLocation) GetLoadBalancer ¶
func (l *HttpLocation) GetLoadBalancer() loadbalance.LoadBalancer
func (*HttpLocation) GetMiddlewareChain ¶
func (l *HttpLocation) GetMiddlewareChain() *middleware.MiddlewareChain
func (*HttpLocation) GetObserverChain ¶
func (l *HttpLocation) GetObserverChain() *middleware.ObserverChain
func (*HttpLocation) GetOptions ¶
func (l *HttpLocation) GetOptions() Options
func (*HttpLocation) GetOptionsAndTransport ¶
func (l *HttpLocation) GetOptionsAndTransport() (Options, *http.Transport)
func (*HttpLocation) RoundTrip ¶
Round trips the request to one of the endpoints and returns the response.
func (*HttpLocation) SetOptions ¶
func (l *HttpLocation) SetOptions(o Options) error
type Limits ¶
type Limits struct { MaxMemBodyBytes int64 // Maximum size to keep in memory before buffering to disk MaxBodyBytes int64 // Maximum size of a request body in bytes }
Limits contains various limits one can supply for a location.
type Options ¶
type Options struct { Timeouts Timeouts // Controls KeepAlive settins for backend servers KeepAlive KeepAlive // Limits contains various limits one can supply for a location. Limits Limits // Predicate that defines when requests are allowed to failover ShouldFailover failover.Predicate // Used in forwarding headers Hostname string // In this case appends new forward info to the existing header TrustForwardHeader bool // Time provider (useful for testing purposes) TimeProvider timetools.TimeProvider }
Additional options to control this location, such as timeouts
type Rewriter ¶
Rewriter is responsible for removing hop-by-hop headers, fixing encodings and content-length
func (*Rewriter) ProcessRequest ¶
Click to show internal directories.
Click to hide internal directories.