Documentation ¶
Index ¶
- func HttpClientIP(ctx *fasthttp.RequestCtx) string
- func NewGracefulListener(ln net.Listener, maxWaitTime time.Duration) net.Listener
- type FastHTTPServer
- func (f *FastHTTPServer) Engine() interface{}
- func (f *FastHTTPServer) Event(event revel.Event, args interface{}) revel.EventResponse
- func (f *FastHTTPServer) Init(init *revel.EngineInit)
- func (f *FastHTTPServer) Name() string
- func (f *FastHTTPServer) RequestHandler(ctx *fasthttp.RequestCtx)
- func (f *FastHTTPServer) Start()
- func (g *FastHTTPServer) Stats() map[string]interface{}
- type FastHttpContext
- type FastHttpCookie
- type FastHttpHeader
- func (r *FastHttpHeader) Add(key string, value string)
- func (r *FastHttpHeader) Del(key string)
- func (r *FastHttpHeader) Get(key string) (value []string)
- func (r *FastHttpHeader) GetCookie(key string) (value revel.ServerCookie, err error)
- func (r *FastHttpHeader) GetKeys() (value []string)
- func (r *FastHttpHeader) Set(key string, value string)
- func (r *FastHttpHeader) SetCookie(cookie string)
- func (r *FastHttpHeader) SetStatus(statusCode int)
- type FastHttpMultipartForm
- type FastHttpRequest
- func (r *FastHttpRequest) Destroy()
- func (r *FastHttpRequest) Get(key int) (value interface{}, err error)
- func (r *FastHttpRequest) GetForm() (url.Values, error)
- func (r *FastHttpRequest) GetHeader() revel.ServerHeader
- func (r *FastHttpRequest) GetMultipartForm() (revel.ServerMultipartForm, error)
- func (r *FastHttpRequest) GetQuery() url.Values
- func (r *FastHttpRequest) GetRaw() interface{}
- func (r *FastHttpRequest) Set(key int, value interface{}) bool
- func (r *FastHttpRequest) SetContext(req *fasthttp.RequestCtx)
- type FastHttpResponse
- func (r *FastHttpResponse) Destroy()
- func (r *FastHttpResponse) Get(key int) (value interface{}, err error)
- func (r *FastHttpResponse) GetRaw() interface{}
- func (r *FastHttpResponse) GetWriter() io.Writer
- func (r *FastHttpResponse) Header() revel.ServerHeader
- func (r *FastHttpResponse) Set(key int, value interface{}) (set bool)
- func (r *FastHttpResponse) SetContext(w *fasthttp.RequestCtx)
- func (r *FastHttpResponse) SetWriter(writer io.Writer)
- func (r *FastHttpResponse) WriteStream(name string, contentlen int64, modtime time.Time, reader io.Reader) error
- type GracefulListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HttpClientIP ¶
func HttpClientIP(ctx *fasthttp.RequestCtx) string
ClientIP method returns client IP address from HTTP request.
Note: Set property "app.behind.proxy" to true only if Revel is running behind proxy like nginx, haproxy, apache, etc. Otherwise you may get inaccurate Client IP address. Revel parses the IP address in the order of X-Forwarded-For, X-Real-IP.
By default revel will get http.Request's RemoteAddr
Types ¶
type FastHTTPServer ¶
type FastHTTPServer struct { Server *fasthttp.Server // The server ServerInit *revel.EngineInit // The server initialization data MaxMultipartSize int64 // The max form size HttpMuxList revel.ServerMuxList // The list of muxers HasAppMux bool // True if has a mux // contains filtered or unexported fields }
The engine
func (*FastHTTPServer) Event ¶
func (f *FastHTTPServer) Event(event revel.Event, args interface{}) revel.EventResponse
Handle an event generated from Revel
func (*FastHTTPServer) Init ¶
func (f *FastHTTPServer) Init(init *revel.EngineInit)
Called to initialize the FastHttpServer
func (*FastHTTPServer) RequestHandler ¶
func (f *FastHTTPServer) RequestHandler(ctx *fasthttp.RequestCtx)
The root handler
func (*FastHTTPServer) Stats ¶
func (g *FastHTTPServer) Stats() map[string]interface{}
Returns stats for the engine
type FastHttpContext ¶
type FastHttpContext struct { Request *FastHttpRequest // The request Response *FastHttpResponse // The respnse }
The context
func NewFastHttpContext ¶
func NewFastHttpContext(instance *FastHTTPServer) *FastHttpContext
Create a new context
func (*FastHttpContext) GetRequest ¶
func (c *FastHttpContext) GetRequest() revel.ServerRequest
Called to get the request
func (*FastHttpContext) GetResponse ¶
func (c *FastHttpContext) GetResponse() revel.ServerResponse
Called to get the response
func (*FastHttpContext) SetContext ¶
func (c *FastHttpContext) SetContext(context *fasthttp.RequestCtx)
Called to set the context
type FastHttpHeader ¶
type FastHttpHeader struct { Source interface{} // The source // contains filtered or unexported fields }
The header
func (*FastHttpHeader) Add ¶
func (r *FastHttpHeader) Add(key string, value string)
Adds a header key
func (*FastHttpHeader) Get ¶
func (r *FastHttpHeader) Get(key string) (value []string)
returns the header value
func (*FastHttpHeader) GetCookie ¶
func (r *FastHttpHeader) GetCookie(key string) (value revel.ServerCookie, err error)
Returns a cookie
func (*FastHttpHeader) GetKeys ¶
func (r *FastHttpHeader) GetKeys() (value []string)
Returns the header keys
func (*FastHttpHeader) Set ¶
func (r *FastHttpHeader) Set(key string, value string)
Sets (replaces) a header key
func (*FastHttpHeader) SetStatus ¶
func (r *FastHttpHeader) SetStatus(statusCode int)
Sets the header status
type FastHttpMultipartForm ¶
The form
func (*FastHttpMultipartForm) GetFiles ¶
func (f *FastHttpMultipartForm) GetFiles() map[string][]*multipart.FileHeader
Returns the files for a form
func (*FastHttpMultipartForm) GetValues ¶
func (f *FastHttpMultipartForm) GetValues() url.Values
Returns the values for a form
func (*FastHttpMultipartForm) RemoveAll ¶
func (f *FastHttpMultipartForm) RemoveAll() error
Remove all the vlaues from a form
type FastHttpRequest ¶
type FastHttpRequest struct { Original *fasthttp.RequestCtx // The original FormParsed bool // True if the form was parsed MultiFormParsed bool // True if multipart form // WebSocket *websocket.Conn // No websocket ParsedForm *FastHttpMultipartForm // The parsed form Engine *FastHTTPServer // The response header // contains filtered or unexported fields }
The request
func (*FastHttpRequest) Get ¶
func (r *FastHttpRequest) Get(key int) (value interface{}, err error)
Gets the value from the request
func (*FastHttpRequest) GetForm ¶
func (r *FastHttpRequest) GetForm() (url.Values, error)
Returns the form
func (*FastHttpRequest) GetHeader ¶
func (r *FastHttpRequest) GetHeader() revel.ServerHeader
Returns the request header
func (*FastHttpRequest) GetMultipartForm ¶
func (r *FastHttpRequest) GetMultipartForm() (revel.ServerMultipartForm, error)
Returns the form
func (*FastHttpRequest) GetQuery ¶
func (r *FastHttpRequest) GetQuery() url.Values
Returns the query string
func (*FastHttpRequest) GetRaw ¶
func (r *FastHttpRequest) GetRaw() interface{}
Returns the raw request
func (*FastHttpRequest) Set ¶
func (r *FastHttpRequest) Set(key int, value interface{}) bool
Sets the request with the value
func (*FastHttpRequest) SetContext ¶
func (r *FastHttpRequest) SetContext(req *fasthttp.RequestCtx)
Sets the context
type FastHttpResponse ¶
type FastHttpResponse struct { Original *fasthttp.RequestCtx // The original Writer io.Writer // The writer Engine *FastHTTPServer // The engine // contains filtered or unexported fields }
The response
func (*FastHttpResponse) Destroy ¶
func (r *FastHttpResponse) Destroy()
Called to reset this response
func (*FastHttpResponse) Get ¶
func (r *FastHttpResponse) Get(key int) (value interface{}, err error)
gets the key from the response
func (*FastHttpResponse) GetRaw ¶
func (r *FastHttpResponse) GetRaw() interface{}
Returns the raw response
func (*FastHttpResponse) GetWriter ¶
func (r *FastHttpResponse) GetWriter() io.Writer
Return the response writer
func (*FastHttpResponse) Header ¶
func (r *FastHttpResponse) Header() revel.ServerHeader
Return the header
func (*FastHttpResponse) Set ¶
func (r *FastHttpResponse) Set(key int, value interface{}) (set bool)
Sets the key with the value
func (*FastHttpResponse) SetContext ¶
func (r *FastHttpResponse) SetContext(w *fasthttp.RequestCtx)
Sets the context
func (*FastHttpResponse) SetWriter ¶
func (r *FastHttpResponse) SetWriter(writer io.Writer)
Sets the writer
func (*FastHttpResponse) WriteStream ¶
func (r *FastHttpResponse) WriteStream(name string, contentlen int64, modtime time.Time, reader io.Reader) error
Writes a stream to the response
type GracefulListener ¶
type GracefulListener struct {
// contains filtered or unexported fields
}
func (*GracefulListener) Addr ¶
func (ln *GracefulListener) Addr() net.Addr
func (*GracefulListener) Close ¶
func (ln *GracefulListener) Close() error
Close closes the inner listener and waits until all the pending open connections are closed before returning.