Documentation ¶
Index ¶
- func WithHTTP() plugins.Plugin
- func WithHTTPClient() plugins.Plugin
- func WithHTTPDebug() plugins.Plugin
- func WithWebsocketClient() plugins.Plugin
- func WithWebsocketServer(options ...WebsocketServerOption) plugins.Plugin
- func WithWebsocketServerPool(options ...WebsocketServerOption) plugins.Plugin
- type ClientHttp
- type ConfigDebug
- type ConfigHttp
- type Context
- type Cookie
- type ErrCtx
- type Header
- type Middleware
- type Param
- type RouteCollector
- type Router
- type RouterPool
- type WebsocketClient
- type WebsocketClientConn
- type WebsocketClientHandler
- type WebsocketClientOption
- type WebsocketClientProcessor
- type WebsocketEventer
- type WebsocketServer
- type WebsocketServerHandler
- type WebsocketServerOption
- type WebsocketServerPool
- type WebsocketServerProcessor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithHTTPDebug ¶
WithHTTPDebug debug service over HTTP protocol with pprof enabled
func WithWebsocketClient ¶
func WithWebsocketServer ¶
func WithWebsocketServer(options ...WebsocketServerOption) plugins.Plugin
func WithWebsocketServerPool ¶ added in v0.12.4
func WithWebsocketServerPool(options ...WebsocketServerOption) plugins.Plugin
Types ¶
type ClientHttp ¶
type ClientHttp interface {
Create(opts ...webutil.ClientHttpOption) *webutil.ClientHttp
}
type ConfigDebug ¶
type ConfigDebug struct {
Config webutil.ConfigHttp `yaml:"debug"`
}
ConfigDebug config to initialize HTTP debug service
func (*ConfigDebug) Default ¶
func (v *ConfigDebug) Default()
type ConfigHttp ¶
type ConfigHttp struct {
Config map[string]webutil.ConfigHttp `yaml:"http"`
}
ConfigHttp config to initialize HTTP service
func (*ConfigHttp) Default ¶
func (v *ConfigHttp) Default()
type Context ¶
type Context interface { URL() *url.URL Redirect(uri string) Param(key string) Param Header() Header Cookie() Cookie BindBytes(in *[]byte) error BindJSON(in interface{}) error BindXML(in interface{}) error Error(code int, err error) ErrorJSON(code int, err error, ctx ErrCtx) Bytes(code int, b []byte) String(code int, b string, args ...interface{}) JSON(code int, in interface{}) Stream(code int, in []byte, filename string) Context() context.Context Log() log.WriterContext Request() *http.Request Response() http.ResponseWriter }
Context request and response interface
type ErrCtx ¶
type ErrCtx map[string]interface{}
func (ErrCtx) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (ErrCtx) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*ErrCtx) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ErrCtx) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type Middleware ¶
type Middleware func(func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request)
Middleware type of middleware
func ThrottlingMiddleware ¶
func ThrottlingMiddleware(max int64) Middleware
ThrottlingMiddleware limits active requests
type RouteCollector ¶
type RouteCollector interface { Get(path string, call func(ctx Context)) Head(path string, call func(ctx Context)) Post(path string, call func(ctx Context)) Put(path string, call func(ctx Context)) Delete(path string, call func(ctx Context)) Options(path string, call func(ctx Context)) Patch(path string, call func(ctx Context)) Match(path string, call func(ctx Context), methods ...string) }
RouteCollector interface of the router collection
type Router ¶
type Router interface { Use(args ...Middleware) Collection(prefix string, args ...Middleware) RouteCollector NotFoundHandler(call func(ctx Context)) RouteCollector }
Router router handler interface
type RouterPool ¶
type RouterPool interface { //All method to get all route handlers All(call func(name string, router Router)) //Main method to get Main route handler Main() Router //Get method to get route handler by key Get(name string) Router }
RouterPool router pool handler
type WebsocketClient ¶
type WebsocketClient interface {
Create(ctx context.Context, url string, opts ...func(WebsocketClientOption)) (WebsocketClientConn, error)
}
type WebsocketClientConn ¶
type WebsocketClientConn interface { ConnectID() string Event(call WebsocketClientHandler, eid ...uint) Encode(id uint, in interface{}) Close() Run() error }
type WebsocketClientHandler ¶
type WebsocketClientHandler func(d WebsocketEventer, c WebsocketClientProcessor) error
type WebsocketClientOption ¶
type WebsocketClientProcessor ¶
type WebsocketClientProcessor interface { ConnectID() string OnClose(cb func(cid string)) Encode(eventID uint, in interface{}) EncodeEvent(event WebsocketEventer, in interface{}) }
type WebsocketEventer ¶
type WebsocketServer ¶
type WebsocketServerHandler ¶
type WebsocketServerHandler func(d WebsocketEventer, c WebsocketServerProcessor) error
type WebsocketServerOption ¶
func WebsocketServerOptionBuffer ¶
func WebsocketServerOptionBuffer(read, write int) WebsocketServerOption
func WebsocketServerOptionCompression ¶
func WebsocketServerOptionCompression(enable bool) WebsocketServerOption
type WebsocketServerPool ¶ added in v0.12.4
type WebsocketServerPool interface {
Create(name string) WebsocketServer
}
type WebsocketServerProcessor ¶
type WebsocketServerProcessor interface { ConnectID() string OnClose(cb func(cid string)) OnOpen(cb func(cid string)) Encode(eventID uint, in interface{}) EncodeEvent(event WebsocketEventer, in interface{}) }
Source Files ¶
- common.go
- debug_server.go
- http_client.go
- http_server.go
- http_server_context.go
- http_server_context_easyjson.go
- http_server_middlewares.go
- http_server_router.go
- http_server_router_easyjson.go
- ws_client.go
- ws_common.go
- ws_event.go
- ws_event_easyjson.go
- ws_server.go
- ws_server_easyjson.go
- ws_server_pool.go
Click to show internal directories.
Click to hide internal directories.