http

package
v0.0.0-...-7c51b95 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = map[string]interface{}{
	`host`:                                   `0.0.0.0:80`,
	`read-timeout`:                           time.Minute,
	`write-timeout`:                          time.Minute,
	`read-header-timeout`:                    time.Second * 50,
	`idle-timeout`:                           time.Minute * 3,
	`max-header-bytes`:                       1024 * 1024 * 10,
	`cert-file`:                              ``,
	`key-file`:                               ``,
	`http2`:                                  false,
	`http2-max-handlers`:                     0,
	`http2-max-concurrent-streams`:           0,
	`http2-max-read-frame-size`:              0,
	`http2-permit-prohibited-cipher-suites`:  false,
	`http2-idle-timeout`:                     time.Minute * 3,
	`http2-max-upload-buffer-per-connection`: 65535,
	`http2-max-upload-buffer-per-stream`:     0,
}

Functions

func Auth

func Auth(ctx contract.Context)

func NewHttp

func NewHttp(application contract.Application, request *http.Request, responseWriter contract.HttpWrapResponseWriter) contract.HttpProtocol

func NewServer

func NewServer(app contract.Application, srvConfig map[string]interface{}) contract.Server

func NewSession

func NewSession(store sessions.Store, request *http.Request, response http.ResponseWriter) contract.Session

func NewWrapResponseWriter

func NewWrapResponseWriter(responseWriter http.ResponseWriter) contract.HttpWrapResponseWriter

func Recovery

func Recovery(ctx contract.Context)

func Session

func Session(ctx contract.Context)

Types

type Command

type Command struct {
}

func (*Command) CobraCmd

func (c *Command) CobraCmd() *cobra.Command

func (*Command) Run

func (c *Command) Run(root contract.BaseCommand, cmd *cobra.Command, args []string)

type Group

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

func (*Group) DELETE

func (g *Group) DELETE(path string, handler contract.ContextHandler) contract.HttpRoute

func (*Group) GET

func (g *Group) GET(path string, handler contract.ContextHandler) contract.HttpRoute

func (*Group) Group

func (g *Group) Group(prefix string) contract.HttpRouteGroup

func (*Group) Handler

func (g *Group) Handler(method, path string, handler http.HandlerFunc)

func (*Group) OPTIONS

func (g *Group) OPTIONS(path string, handler contract.ContextHandler) contract.HttpRoute

func (*Group) PATCH

func (g *Group) PATCH(path string, handler contract.ContextHandler) contract.HttpRoute

func (*Group) POST

func (g *Group) POST(path string, handler contract.ContextHandler) contract.HttpRoute

func (*Group) PUT

func (g *Group) PUT(path string, handler contract.ContextHandler) contract.HttpRoute

func (*Group) Prefix

func (g *Group) Prefix(prefix string) contract.HttpRouteGroup

func (*Group) Use

func (g *Group) Use(handlers ...contract.ContextHandler) contract.HttpRouteGroup

type Http

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

func (*Http) Accept

func (h *Http) Accept() []string

func (*Http) Application

func (h *Http) Application() contract.Application

func (*Http) ClientIP

func (h *Http) ClientIP() string

func (*Http) Clone

func (h *Http) Clone() contract.Protocol

func (*Http) ContentType

func (h *Http) ContentType() string

func (*Http) Cookie

func (h *Http) Cookie(name string) (string, error)

func (*Http) Header

func (h *Http) Header(key string) string

func (*Http) IsAccept

func (h *Http) IsAccept(key string) bool

func (*Http) IsContentType

func (h *Http) IsContentType(key string) bool

func (*Http) IsMethod

func (h *Http) IsMethod(key string) bool

func (*Http) Message

func (h *Http) Message() ([]byte, error)

func (*Http) Metadata

func (h *Http) Metadata() map[string][]string

func (*Http) Name

func (*Http) Name() string

func (*Http) Param

func (h *Http) Param(key string) httprouter.Param

func (*Http) Params

func (h *Http) Params() []httprouter.Param

func (*Http) Read

func (h *Http) Read(p []byte) (n int, err error)

func (*Http) Redirect

func (h *Http) Redirect(status int, location string)

func (*Http) Request

func (h *Http) Request() *http.Request

func (*Http) ResponseWriter

func (h *Http) ResponseWriter() contract.HttpWrapResponseWriter

func (*Http) Route

func (h *Http) Route() contract.HttpRoute

func (*Http) Session

func (h *Http) Session() contract.Session

func (*Http) SessionValue

func (h *Http) SessionValue(key string) interface{}

func (*Http) SetCookie

func (h *Http) SetCookie(cookie *http.Cookie)

func (*Http) SetHeader

func (h *Http) SetHeader(key, value string)

func (*Http) SetParams

func (h *Http) SetParams(params []httprouter.Param)

func (*Http) SetRoute

func (h *Http) SetRoute(route contract.HttpRoute)

func (*Http) SetSession

func (h *Http) SetSession(session contract.Session)

func (*Http) SetStatus

func (h *Http) SetStatus(status int)

func (*Http) Values

func (h *Http) Values() map[string][]string

func (*Http) Write

func (h *Http) Write(bytes []byte) (int, error)

type Provider

type Provider struct {
	kernel.BaseProvider
}

func (*Provider) Boot

func (p *Provider) Boot()

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) Register

func (p *Provider) Register()

type Route

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

func (*Route) Handlers

func (r *Route) Handlers() []contract.ContextHandler

func (*Route) Name

func (r *Route) Name(name string) contract.HttpRoute

func (*Route) Use

func (r *Route) Use(handlers ...contract.ContextHandler) contract.HttpRoute

type Router

type Router struct {
	Application contract.Application
	// contains filtered or unexported fields
}

func (*Router) DELETE

func (r *Router) DELETE(path string, handler contract.ContextHandler) contract.HttpRoute

func (*Router) GET

func (r *Router) GET(path string, handler contract.ContextHandler) contract.HttpRoute

func (*Router) Group

func (r *Router) Group(prefix string) contract.HttpRouteGroup

func (*Router) Handler

func (r *Router) Handler(method, path string, handler http.HandlerFunc)

func (*Router) HttpRouter

func (r *Router) HttpRouter() *httprouter.Router

func (*Router) NotFound

func (r *Router) NotFound(handler contract.ContextHandler) contract.HttpRouter

func (*Router) OPTIONS

func (r *Router) OPTIONS(path string, handler contract.ContextHandler) contract.HttpRoute

func (*Router) PATCH

func (r *Router) PATCH(path string, handler contract.ContextHandler) contract.HttpRoute

func (*Router) POST

func (r *Router) POST(path string, handler contract.ContextHandler) contract.HttpRoute

func (*Router) PUT

func (r *Router) PUT(path string, handler contract.ContextHandler) contract.HttpRoute

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Router) Static

func (r *Router) Static(path string, root string) contract.HttpRouter

serve static files

type Server

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

func (*Server) New

func (s *Server) New() contract.Server

func (*Server) Restart

func (s *Server) Restart(ctx context.Context) error

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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