Documentation ¶
Index ¶
- Variables
- func GetArgs(ctx *fasthttp.RequestCtx, key string) []byte
- func GetResponseAge(ctx *fasthttp.RequestCtx, def time.Duration) (age time.Duration, cache bool)
- func IsFresh(ctx *fasthttp.RequestCtx) bool
- func JSON(ctx *fasthttp.RequestCtx, v interface{}) error
- func Ok(ctx *fasthttp.RequestCtx)
- func ResponseDate(ctx *fasthttp.RequestCtx) (date time.Time, err error)
- func StripPrefix(prefix string, h fasthttp.RequestHandler) fasthttp.RequestHandler
- type CacheControl
- type HostSwitch
- type Proxy
- type Target
Constants ¶
This section is empty.
Variables ¶
View Source
var ( XForwardedFor = http.CanonicalHeaderKey("X-Forwarded-For") XForwardedHost = http.CanonicalHeaderKey("X-Forwarded-Host") XRealIP = http.CanonicalHeaderKey("X-Real-IP") )
Functions ¶
func GetArgs ¶
func GetArgs(ctx *fasthttp.RequestCtx, key string) []byte
GetArgs Post->Get->Header->Cookie
func GetResponseAge ¶
func IsFresh ¶
func IsFresh(ctx *fasthttp.RequestCtx) bool
IsFresh check whether cache can be used in this fasthttp RequestCtx
func JSON ¶
func JSON(ctx *fasthttp.RequestCtx, v interface{}) error
func Ok ¶
func Ok(ctx *fasthttp.RequestCtx)
func ResponseDate ¶
func ResponseDate(ctx *fasthttp.RequestCtx) (date time.Time, err error)
Date parses and returns the value of the Date header.
func StripPrefix ¶
func StripPrefix(prefix string, h fasthttp.RequestHandler) fasthttp.RequestHandler
StripPrefix returns a handler that serves HTTP requests by removing the given prefix from the request URL's Path and invoking the handler h. StripPrefix handles a request for a path that doesn't begin with prefix by replying with an HTTP 404 not found error.
Types ¶
type CacheControl ¶
func ParseCacheControl ¶
func ParseCacheControl(headers string) CacheControl
type HostSwitch ¶
type HostSwitch map[string]fasthttp.RequestHandler
HostSwitch is the host-handler map
func (HostSwitch) Add ¶
func (p HostSwitch) Add(host string, h fasthttp.RequestHandler)
Add add host Handler
func (HostSwitch) Handler ¶
func (p HostSwitch) Handler(ctx *fasthttp.RequestCtx)
Handler for processing incoming requests.
type Proxy ¶
type Proxy struct { MaxConns int32 Conns int32 Name string Host []byte Fails int32 // contains filtered or unexported fields }
func NewProxyClient ¶
func (*Proxy) HealthCheck ¶
func (p *Proxy) HealthCheck()
Click to show internal directories.
Click to hide internal directories.