Documentation
¶
Index ¶
- Variables
- func SetJSONCodec(marshal jsonMarshalFunc, unmarshal jsonUnmarshalFunc)
- type Accept
- type Ctx
- func (c *Ctx) Abort()
- func (c *Ctx) AbortWithStatus(code int)
- func (c *Ctx) AbortWithStatusJSON(code int, v any)
- func (c *Ctx) Bind(v any) error
- func (c *Ctx) BindForm(v any) error
- func (c *Ctx) BindJSON(v any) error
- func (c *Ctx) ClientIP() string
- func (c *Ctx) GetHeader(key string) string
- func (c *Ctx) IsAborted() bool
- func (c *Ctx) JSON(code int, v any)
- func (c *Ctx) Negotiate(code int, a Accept)
- func (c *Ctx) Next()
- func (c *Ctx) Param(key string) string
- func (c *Ctx) ParamInt(key string) (int, error)
- func (c *Ctx) Query(key string) string
- type Engine
- func (e *Engine) DELETE(path string, h ...Handler)
- func (e *Engine) GET(path string, h ...Handler)
- func (e *Engine) Group(prefix string, mws ...Handler) *Router
- func (e *Engine) HEAD(path string, h ...Handler)
- func (e *Engine) Handler() fasthttp.RequestHandler
- func (e *Engine) Listen(addr string) error
- func (e *Engine) NoMethod(h ...Handler)
- func (e *Engine) NoRoute(h ...Handler)
- func (e *Engine) OPTIONS(path string, h ...Handler)
- func (e *Engine) PATCH(path string, h ...Handler)
- func (e *Engine) POST(path string, h ...Handler)
- func (e *Engine) PUT(path string, h ...Handler)
- func (e *Engine) SetRemoteIPHeaders(headers ...string)
- func (e *Engine) SetTrustedProxies(proxies ...string) error
- func (e *Engine) Static(prefix, rootDir string)
- func (e *Engine) Use(mws ...Handler)
- type Handler
- type Router
- func (r *Router) DELETE(path string, h ...Handler)
- func (r *Router) GET(path string, h ...Handler)
- func (r *Router) Group(prefix string, mws ...Handler) *Router
- func (r *Router) HEAD(path string, h ...Handler)
- func (r *Router) PATCH(path string, h ...Handler)
- func (r *Router) POST(path string, h ...Handler)
- func (r *Router) PUT(path string, h ...Handler)
- func (r *Router) Static(prefix, rootDir string)
- func (r *Router) Use(mws ...Handler)
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedMediaType = errors.New("flare: unsupported media type")
Functions ¶
func SetJSONCodec ¶
func SetJSONCodec(marshal jsonMarshalFunc, unmarshal jsonUnmarshalFunc)
swaps json encode/decode
Types ¶
type Ctx ¶
type Ctx struct {
*fasthttp.RequestCtx
// contains filtered or unexported fields
}
func (*Ctx) AbortWithStatus ¶
func (*Ctx) AbortWithStatusJSON ¶
func (*Ctx) Bind ¶
Bind decodes the body from content-type (json or form-urlencoded) call from handlers only, not from router hot path
func (*Ctx) BindForm ¶
fills exported string/int fields from post args (form, else join, else name) reflect-based, also keep off hot path
func (*Ctx) ClientIP ¶
returns client address if socket peer is listed in SetTrustedProxies, headers from SetRemoteIPHeaders are consulted w/o anything configured headers are ignored and the peer address is returned
type Engine ¶
type Engine struct {
// holds fasthttp limits/timeouts
Server fasthttp.Server
// contains filtered or unexported fields
}
this is a fasthttp router trailing slashes are significant and never redirected/stripped
func (*Engine) Handler ¶
func (e *Engine) Handler() fasthttp.RequestHandler
func (*Engine) SetRemoteIPHeaders ¶
overrides header list used when peer is trusted defaults restored with nothing passed
func (*Engine) SetTrustedProxies ¶
set cidrs/bare ips allowed to supply forwarded-client headers empty means clientip always returns sock peer