orca

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2020 License: MIT Imports: 5 Imported by: 0

README

Orca

golang http Framework base on fasthttp

Documentation

Index

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 Handler) Handler) 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, middleware ...MiddlewareHandler) *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 Handler added in v1.2.0

type Handler = fasthttp.RequestHandler

func AfterHandler added in v1.2.0

func AfterHandler(handler Handler, handlers ...Handler) Handler

func BeforeHandler added in v1.2.0

func BeforeHandler(handler Handler, handlers ...Handler) Handler

func Middleware added in v1.2.0

func Middleware(middleware MiddlewareHandler, handler Handler) 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 Logger

type Logger = fasthttp.Logger

type MiddlewareHandler added in v1.2.0

type MiddlewareHandler func(*RequestCtx) error

func LambdaMiddleware added in v1.2.0

func LambdaMiddleware(handler MiddlewareHandler, h ...MiddlewareHandler) MiddlewareHandler

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 Router

type Router struct {
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(options ...func(*Router)) *Router

func (*Router) Group added in v1.1.0

func (r *Router) Group(path string, middleware ...MiddlewareHandler) *Group

type RouterAdapter

type RouterAdapter interface {
	Handler(*RequestCtx)
}

type Server

type Server = fasthttp.Server

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) GetAddr added in v1.0.1

func (c *TcpConfig) GetAddr() string

func (*TcpConfig) GetTCPKeepalive

func (c *TcpConfig) GetTCPKeepalive() bool

func (*TcpConfig) GetTCPKeepalivePeriod

func (c *TcpConfig) GetTCPKeepalivePeriod() time.Duration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL