orca

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: MIT Imports: 12 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 AccessLogFilter

func AccessLogFilter(ctx *RequestCtx)

func NewHttpServe added in v1.0.1

func NewHttpServe(c ServerConfig, Logger Logger, r RouterAdapter, options ...func(filter Filter) Filter) error

func NewLogger

func NewLogger(config *AccessLogConfig)

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 AccessLogger

type AccessLogger = zap.Logger

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 Field

type Field = zap.Field

type Filter

type Filter = fasthttp.RequestHandler

func AfterFilter

func AfterFilter(handler Filter, filters ...Filter) Filter

func BeforeFilter

func BeforeFilter(handler Filter, filters ...Filter) Filter

type Group

type Group = router.Group

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 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 Rotater

type Rotater = lumberjack.Logger

type Router

type Router = router.Router

func NewRouter

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

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 {
	DisableAccessLog             bool `yaml:"disable_access_log"`
	GetOnly                      bool `yaml:"get_only"`
	DisablePreParseMultipartForm bool `yaml:"disable_multipart_parse"`
	ReduceMemoryUsage            bool `yaml:"reduce_memory_usage"`
	LogAllErrors                 bool `yaml:"all_errors"`
}

func (*SystemConfig) GetDisableAccessLog

func (c *SystemConfig) GetDisableAccessLog() bool

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