Documentation ¶
Index ¶
- Constants
- Variables
- func GetFsHandler(root string, stripSlashes int) fasthttp.RequestHandler
- type ContainerRegister
- type Kernel
- func (k *Kernel) FastHttpHandler(ctx *fasthttp.RequestCtx)
- func (k *Kernel) Handle(r contracts.RequestContract) (resp contracts.ResponseContract)
- func (k *Kernel) IsKeepAlive() bool
- func (k *Kernel) KeepAlive(b ...bool) *Kernel
- func (k *Kernel) SendRequestToRouter(r contracts.RequestContract) contracts.ResponseContract
- func (k *Kernel) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (k *Kernel) SetErrorHandler(handler errors.ErrorHandler)
- func (k *Kernel) SetMiddleware(ms []pipeline.RequestMiddleware)
- func (k *Kernel) SetMiddlewareGroup(middlewareGroup map[string][]pipeline.RequestMiddleware)
- func (k *Kernel) Use(m pipeline.RequestMiddleware) *Kernel
- func (k *Kernel) Wrapper() *router.Wrapper
- type KernelRequestResolver
- type RequestInjector
- type RequestResolver
- type RouterRegister
- type Server
Constants ¶
View Source
const ( HandlerFastHttp handlerType = iota HandlerNetHttp )
View Source
const DefaultConcurrency = 256 * 1024
View Source
const Version = "v1.2.3"
Variables ¶
View Source
var ( ReadTimeout = time.Second * 30 WriteTimeout = time.Second * 30 IdleTimeout = time.Second * 10 )
View Source
var RequestLogger = func(request contracts.RequestContract, statusCode int, start time.Time) { log.Printf("/ %s - [%s] %s (%d) <%s>", request.RemoteAddr(), request.GetMethod(), request.GetUri(), statusCode, time.Since(start)) }
Functions ¶
func GetFsHandler ¶
func GetFsHandler(root string, stripSlashes int) fasthttp.RequestHandler
Types ¶
type ContainerRegister ¶ added in v0.0.10
type ContainerRegister func(request contracts.RequestContract) container.Interface
type Kernel ¶
type Kernel struct { RequestCurrency int MaxRequestBodySize int OutputLog bool Handler handlerType // contains filtered or unexported fields }
func NewKernel ¶
func NewKernel(cr ContainerRegister, debug bool) *Kernel
func (*Kernel) FastHttpHandler ¶
func (k *Kernel) FastHttpHandler(ctx *fasthttp.RequestCtx)
func (*Kernel) Handle ¶
func (k *Kernel) Handle(r contracts.RequestContract) (resp contracts.ResponseContract)
func (*Kernel) IsKeepAlive ¶
func (*Kernel) SendRequestToRouter ¶
func (k *Kernel) SendRequestToRouter(r contracts.RequestContract) contracts.ResponseContract
func (*Kernel) SetErrorHandler ¶
func (k *Kernel) SetErrorHandler(handler errors.ErrorHandler)
func (*Kernel) SetMiddleware ¶
func (k *Kernel) SetMiddleware(ms []pipeline.RequestMiddleware)
func (*Kernel) SetMiddlewareGroup ¶
func (k *Kernel) SetMiddlewareGroup(middlewareGroup map[string][]pipeline.RequestMiddleware)
type KernelRequestResolver ¶
type KernelRequestResolver struct { }
func (KernelRequestResolver) ResolveRequest ¶
func (rr KernelRequestResolver) ResolveRequest(r contracts.RequestContract, runtime container.Interface)
type RequestInjector ¶
type RequestInjector struct {
// contains filtered or unexported fields
}
RequestInjector inject request object, with validation
func (*RequestInjector) When ¶
func (r *RequestInjector) When(abs interface{}) bool
type RequestResolver ¶ added in v0.0.10
type RequestResolver interface {
ResolveRequest(r contracts.RequestContract, container container.Interface)
}
type RouterRegister ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(cr ContainerRegister, debug bool) *Server
func (*Server) GetFastHttpServer ¶
func (*Server) Serve ¶
func (s *Server) Serve(addr string, register RouterRegister)
Click to show internal directories.
Click to hide internal directories.