Documentation
¶
Index ¶
- Constants
- func NewHttpServe(c ServerConfig, Logger Logger, r RouterAdapter, ...) error
- type AccessLogConfig
- type BufferConfig
- type ConfigDecoder
- type ConnConfig
- func (c *ConnConfig) GetConcurrency() int
- func (c *ConnConfig) GetDisableKeepalive() bool
- func (c *ConnConfig) GetIdleTimeout() time.Duration
- func (c *ConnConfig) GetMaxConnsPerIP() int
- func (c *ConnConfig) GetReadTimeout() time.Duration
- func (c *ConnConfig) GetSleepWhenConcurrencyLimitsExceeded() time.Duration
- func (c *ConnConfig) GetWriteTimeout() time.Duration
- type Filter
- type Group
- func (g *Group) ANY(path string, handler RequestHandler)
- func (g *Group) DELETE(path string, handler RequestHandler)
- func (g *Group) GET(path string, handler RequestHandler)
- func (g *Group) Group(path string, handlers ...RequestHandler) *Group
- func (g *Group) HEAD(path string, handler RequestHandler)
- func (g *Group) OPTIONS(path string, handler RequestHandler)
- func (g *Group) PATCH(path string, handler RequestHandler)
- func (g *Group) POST(path string, handler RequestHandler)
- func (g *Group) PUT(path string, handler RequestHandler)
- type HeaderConfig
- type Logger
- type RequestConfig
- type RequestCtx
- type RequestHandler
- type Router
- type RouterAdapter
- type Server
- type ServerConfig
- type SystemConfig
- type TcpConfig
Constants ¶
View Source
const ( StatusInternalServerError = fasthttp.StatusInternalServerError StatusNotFound = fasthttp.StatusNotFound StatusMethodNotAllowed = fasthttp.StatusMethodNotAllowed )
Variables ¶
This section is empty.
Functions ¶
func NewHttpServe ¶ added in v1.0.1
func NewHttpServe(c ServerConfig, Logger Logger, r RouterAdapter, options ...func(filter Filter) Filter) error
Types ¶
type AccessLogConfig ¶ added in v1.0.3
type AccessLogConfig struct {
Logfile string `yaml:"logfile"`
MaxSize int `yaml:"max_size"`
MaxBackups int `yaml:"max_backups"`
MaxAge int `yaml:"max_age"`
Compress bool `yaml:"compress"`
}
func (*AccessLogConfig) GetCompress ¶ added in v1.0.3
func (c *AccessLogConfig) GetCompress() bool
func (*AccessLogConfig) GetLogfile ¶ added in v1.0.3
func (c *AccessLogConfig) GetLogfile() string
func (*AccessLogConfig) GetMaxAge ¶ added in v1.0.3
func (c *AccessLogConfig) GetMaxAge() int
func (*AccessLogConfig) GetMaxBackups ¶ added in v1.0.3
func (c *AccessLogConfig) GetMaxBackups() int
func (*AccessLogConfig) GetMaxSize ¶ added in v1.0.3
func (c *AccessLogConfig) GetMaxSize() int
type BufferConfig ¶
type BufferConfig struct {
ReadBufferSize int `yaml:"read_buffer_size"`
WriteBufferSize int `yaml:"write_buffer_size"`
}
func (*BufferConfig) GetReadBufferSize ¶
func (c *BufferConfig) GetReadBufferSize() int
func (*BufferConfig) GetWriteBufferSize ¶
func (c *BufferConfig) GetWriteBufferSize() int
type ConfigDecoder ¶
type ConfigDecoder interface {
Decode(v interface{}) (err error)
}
type ConnConfig ¶
type ConnConfig struct {
Concurrency int `yaml:"concurrency"`
SleepWhenConcurrencyLimitsExceeded int `yaml:"concurrency_limits_wait"`
DisableKeepalive bool `yaml:"disable_keepalive"`
MaxConnsPerIP int `yaml:"max_connections"`
ReadTimeout int `yaml:"read_timeout"`
WriteTimeout int `yaml:"write_timeout"`
IdleTimeout int `yaml:"idle_timeout"`
}
func (*ConnConfig) GetConcurrency ¶
func (c *ConnConfig) GetConcurrency() int
func (*ConnConfig) GetDisableKeepalive ¶
func (c *ConnConfig) GetDisableKeepalive() bool
func (*ConnConfig) GetIdleTimeout ¶
func (c *ConnConfig) GetIdleTimeout() time.Duration
func (*ConnConfig) GetMaxConnsPerIP ¶
func (c *ConnConfig) GetMaxConnsPerIP() int
func (*ConnConfig) GetReadTimeout ¶
func (c *ConnConfig) GetReadTimeout() time.Duration
func (*ConnConfig) GetSleepWhenConcurrencyLimitsExceeded ¶
func (c *ConnConfig) GetSleepWhenConcurrencyLimitsExceeded() time.Duration
func (*ConnConfig) GetWriteTimeout ¶
func (c *ConnConfig) GetWriteTimeout() time.Duration
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
func (*Group) ANY ¶ added in v1.1.0
func (g *Group) ANY(path string, handler RequestHandler)
DELETE is a shortcut for group.Handle(fasthttp.MethodDelete, path, handler)
func (*Group) DELETE ¶ added in v1.1.0
func (g *Group) DELETE(path string, handler RequestHandler)
DELETE is a shortcut for group.Handle(fasthttp.MethodDelete, path, handler)
func (*Group) GET ¶ added in v1.1.0
func (g *Group) GET(path string, handler RequestHandler)
GET is a shortcut for group.Handle(fasthttp.MethodGet, path, handler)
func (*Group) Group ¶ added in v1.1.0
func (g *Group) Group(path string, handlers ...RequestHandler) *Group
func (*Group) HEAD ¶ added in v1.1.0
func (g *Group) HEAD(path string, handler RequestHandler)
HEAD is a shortcut for group.Handle(fasthttp.MethodHead, path, handler)
func (*Group) OPTIONS ¶ added in v1.1.0
func (g *Group) OPTIONS(path string, handler RequestHandler)
OPTIONS is a shortcut for group.Handle(fasthttp.MethodOptions, path, handler)
func (*Group) PATCH ¶ added in v1.1.0
func (g *Group) PATCH(path string, handler RequestHandler)
PATCH is a shortcut for group.Handle(fasthttp.MethodPatch, path, handler)
func (*Group) POST ¶ added in v1.1.0
func (g *Group) POST(path string, handler RequestHandler)
POST is a shortcut for group.Handle(fasthttp.MethodPost, path, handler)
func (*Group) PUT ¶ added in v1.1.0
func (g *Group) PUT(path string, handler RequestHandler)
PUT is a shortcut for group.Handle(fasthttp.MethodPut, path, handler)
type HeaderConfig ¶
type HeaderConfig struct {
Name string `yaml:"server"`
DisableHeaderNamesNormalizing bool `yaml:"disable_header_names_normalizing"`
NoDefaultServerHeader bool `yaml:"no_default_server_header"`
NoDefaultDate bool `yaml:"no_default_date"`
NoDefaultContentType bool `yaml:"no_default_content_type"`
}
func (*HeaderConfig) GetDisableHeaderNamesNormalizing ¶
func (c *HeaderConfig) GetDisableHeaderNamesNormalizing() bool
func (*HeaderConfig) GetNoDefaultContentType ¶
func (c *HeaderConfig) GetNoDefaultContentType() bool
func (*HeaderConfig) GetNoDefaultDate ¶
func (c *HeaderConfig) GetNoDefaultDate() bool
func (*HeaderConfig) GetNoDefaultServerHeader ¶
func (c *HeaderConfig) GetNoDefaultServerHeader() bool
func (*HeaderConfig) GetServer ¶
func (c *HeaderConfig) GetServer() string
type RequestConfig ¶
type RequestConfig struct {
MaxRequestsPerConn int `yaml:"max_requests"`
MaxRequestBodySize int `yaml:"max_request_body_size"`
}
func (*RequestConfig) GetMaxRequestBodySize ¶
func (c *RequestConfig) GetMaxRequestBodySize() int
func (*RequestConfig) GetMaxRequestsPerConn ¶
func (c *RequestConfig) GetMaxRequestsPerConn() int
type RequestCtx ¶
type RequestCtx = fasthttp.RequestCtx
type RequestHandler ¶
type RequestHandler = fasthttp.RequestHandler
type RouterAdapter ¶
type RouterAdapter interface {
Handler(*RequestCtx)
}
type ServerConfig ¶
type ServerConfig struct {
SystemConfig
Tcp TcpConfig `yaml:"tcp"`
Conn ConnConfig `yaml:"conn"`
Buffer BufferConfig `yaml:"buffer"`
Header HeaderConfig `yaml:"header"`
Request RequestConfig `yaml:"request"`
AccessLog AccessLogConfig `yaml:"access_log"`
}
func ParseConfig ¶
func ParseConfig(decoder ConfigDecoder) (*ServerConfig, error)
func (*ServerConfig) GetAccessLog ¶ added in v1.0.3
func (c *ServerConfig) GetAccessLog() *AccessLogConfig
func (*ServerConfig) GetBuffer ¶
func (c *ServerConfig) GetBuffer() *BufferConfig
func (*ServerConfig) GetConn ¶
func (c *ServerConfig) GetConn() *ConnConfig
func (*ServerConfig) GetHeader ¶
func (c *ServerConfig) GetHeader() *HeaderConfig
func (*ServerConfig) GetRequest ¶
func (c *ServerConfig) GetRequest() *RequestConfig
func (*ServerConfig) GetTcp ¶
func (c *ServerConfig) GetTcp() *TcpConfig
type SystemConfig ¶
type SystemConfig struct {
GetOnly bool `yaml:"get_only"`
DisablePreParseMultipartForm bool `yaml:"disable_multipart_parse"`
ReduceMemoryUsage bool `yaml:"reduce_memory_usage"`
LogAllErrors bool `yaml:"all_errors"`
}
func (*SystemConfig) GetDisablePreParseMultipartForm ¶
func (c *SystemConfig) GetDisablePreParseMultipartForm() bool
func (*SystemConfig) GetLogAllErrors ¶
func (c *SystemConfig) GetLogAllErrors() bool
func (*SystemConfig) GetMethodOnly ¶
func (c *SystemConfig) GetMethodOnly() bool
func (*SystemConfig) GetReduceMemoryUsage ¶
func (c *SystemConfig) GetReduceMemoryUsage() bool
type TcpConfig ¶
type TcpConfig struct {
TCPKeepalive bool `yaml:"tcp_keepalive"`
TCPKeepalivePeriod int `yaml:"tcp_keepalive_interval"`
Addr string `yaml:"addr"`
}
func (*TcpConfig) GetTCPKeepalive ¶
func (*TcpConfig) GetTCPKeepalivePeriod ¶
Click to show internal directories.
Click to hide internal directories.