Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultTypes = []string{"text/plain", "text/html", "application/json", "text/xml"}
Functions ¶
Types ¶
type CompressionFilter ¶
type CompressionFilter struct {
// contains filtered or unexported fields
}
func NewCompressionFilter ¶
func NewCompressionFilter(types []string) *CompressionFilter
func (*CompressionFilter) FilterResponse ¶
func (c *CompressionFilter) FilterResponse(request *falcore.Request, res *http.Response)
type DateFilter ¶
type DateFilter struct { }
If Date header is non-existent in the response, this filter will automatically set it to the current date
func (*DateFilter) FilterResponse ¶
func (f *DateFilter) FilterResponse(request *falcore.Request, res *http.Response)
type EtagFilter ¶
type EtagFilter struct { }
falcore/etag.Filter is a falcore.ResponseFilter that matches the response's Etag header against the request's If-None-Match header. If they match, the filter will return a '304 Not Modifed' status and no body.
Ideally, Etag filtering is performed as soon as possible as you may be able to skip generating the response body at all. Even as a last step, you will see a significant benefit if clients are well behaved.
func (*EtagFilter) FilterResponse ¶
func (f *EtagFilter) FilterResponse(request *falcore.Request, res *http.Response)
type FileFilter ¶
type FileFilter struct { // File system base path for serving files BasePath string // Prefix in URL path PathPrefix string // File to look for if path is a directory DirectoryIndex string }
A falcore RequestFilter for serving static files from the filesystem.
func (*FileFilter) FilterRequest ¶
func (f *FileFilter) FilterRequest(req *falcore.Request) (res *http.Response)
type HandlerFilter ¶
type HandlerFilter struct {
// contains filtered or unexported fields
}
Implements a RequestFilter using a http.Handler to produce the response This will always return a response due to the requirements of the http.Handler interface so it should be placed at the end of the Upstream pipeline.
func NewHandlerFilter ¶
func NewHandlerFilter(handler http.Handler) *HandlerFilter
func (*HandlerFilter) FilterRequest ¶
func (h *HandlerFilter) FilterRequest(req *falcore.Request) *http.Response
type StringBody ¶
func (*StringBody) Close ¶
func (sb *StringBody) Close() error
type StringBodyFilter ¶
type StringBodyFilter struct {
// contains filtered or unexported fields
}
func NewStringBodyFilter ¶
func NewStringBodyFilter() *StringBodyFilter
func (*StringBodyFilter) FilterRequest ¶
func (sbf *StringBodyFilter) FilterRequest(request *falcore.Request) *http.Response
func (*StringBodyFilter) FilterResponse ¶
func (sbf *StringBodyFilter) FilterResponse(request *falcore.Request, res *http.Response)
Insert this in the response pipeline to return the buffer pool for the request body If there is an appropriate place in your flow, you can call ReturnBuffer explicitly
func (*StringBodyFilter) ReturnBuffer ¶
func (sbf *StringBodyFilter) ReturnBuffer(request *falcore.Request)
Returns a buffer used in the FilterRequest stage to a buffer pool this speeds up this filter significantly by reusing buffers
type Throttler ¶
type Throttler struct { Condition func(req *falcore.Request) bool // If this is set, and returns false, the request will not be throttled // contains filtered or unexported fields }
Throttles incomming requests at a maximum number of requests per second.
func NewThrottler ¶
func (*Throttler) FilterRequest ¶
type Upstream ¶
type Upstream struct { // Name, if set, is used in logging and request stats Name string Transport *UpstreamTransport // Will ignore https on the incoming request and always upstream http ForceHttp bool // Ping URL Path-only for checking upness PingPath string // contains filtered or unexported fields }
func NewUpstream ¶
func NewUpstream(transport *UpstreamTransport) *Upstream
func (*Upstream) FilterRequest ¶
func (*Upstream) MaxConcurrent ¶
func (*Upstream) QueueLength ¶
func (*Upstream) SetMaxConcurrent ¶
type UpstreamEntry ¶
type UpstreamPool ¶
type UpstreamPool struct { Name string // contains filtered or unexported fields }
An UpstreamPool is a list of upstream servers which are considered functionally equivalent. The pool will round-robin the requests to the servers.
func NewUpstreamPool ¶
func NewUpstreamPool(name string, upstreams []*UpstreamEntry) *UpstreamPool
The config consists of a map of the servers in the pool in the format host_or_ip:port where port is optional and defaults to 80. The map value is an int with the weight only 0 and 1 are supported weights (0 disables a server and 1 enables it)
func (UpstreamPool) FilterRequest ¶
func (up UpstreamPool) FilterRequest(req *falcore.Request) (res *http.Response)
func (UpstreamPool) LogStatus ¶
func (up UpstreamPool) LogStatus()
func (UpstreamPool) Next ¶
func (up UpstreamPool) Next() *UpstreamEntry
func (UpstreamPool) Shutdown ¶
func (up UpstreamPool) Shutdown()
This should only be called if the upstream pool is no longer active or this may deadlock
type UpstreamTransport ¶
type UpstreamTransport struct { DNSCacheDuration time.Duration // contains filtered or unexported fields }
func NewUpstreamTransport ¶
func NewUpstreamTransport(host string, port int, timeout time.Duration, transport *http.Transport) *UpstreamTransport
transport is optional. We will override Dial