Documentation ¶
Index ¶
- Constants
- func SetHttpGlobalAfter(after ...HttpServerAfter)
- func SetHttpGlobalBefore(before ...HttpServerBefore)
- func SetSocketClientAfter(after ...SocketClientAfter)
- func SetSocketClientBefore(before ...SocketClientBefore)
- func SetSocketServerAfter(after ...SocketServerAfter)
- func SetSocketServerBefore(before ...SocketServerBefore)
- func SetWebSocketClientAfter(after ...WebSocketClientAfter)
- func SetWebSocketClientBefore(before ...WebSocketClientBefore)
- func SetWebSocketServerAfter(after ...WebSocketServerAfter)
- func SetWebSocketServerBefore(before ...WebSocketServerBefore)
- func Udp()
- type A
- type Array
- type Context
- type Files
- type HttpServer
- func (h *HttpServer) GetRouter() *HttpServerRouter
- func (h *HttpServer) Ready()
- func (h *HttpServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *HttpServer) SetRouter(router *HttpServerRouter) *HttpServer
- func (h *HttpServer) Shutdown()
- func (h *HttpServer) Start()
- func (h *HttpServer) Use(middle ...func(next HttpServerMiddle) HttpServerMiddle)
- type HttpServerAfter
- type HttpServerBefore
- type HttpServerFunction
- type HttpServerGroup
- type HttpServerGroupFunction
- type HttpServerMiddle
- type HttpServerRoute
- func (route *HttpServerRoute) After(after ...HttpServerAfter) *HttpServerRoute
- func (route *HttpServerRoute) Before(before ...HttpServerBefore) *HttpServerRoute
- func (route *HttpServerRoute) ForceAfter() *HttpServerRoute
- func (route *HttpServerRoute) ForceBefore() *HttpServerRoute
- func (route *HttpServerRoute) Handler(fn HttpServerFunction)
- func (route *HttpServerRoute) PassAfter() *HttpServerRoute
- func (route *HttpServerRoute) PassBefore() *HttpServerRoute
- type HttpServerRouteHandler
- func (handler *HttpServerRouteHandler) Delete(path string) *HttpServerRoute
- func (handler *HttpServerRouteHandler) Get(path string) *HttpServerRoute
- func (handler *HttpServerRouteHandler) Option(path string) *HttpServerRoute
- func (handler *HttpServerRouteHandler) Patch(path string) *HttpServerRoute
- func (handler *HttpServerRouteHandler) Post(path string) *HttpServerRoute
- func (handler *HttpServerRouteHandler) Put(path string) *HttpServerRoute
- func (handler *HttpServerRouteHandler) Route(method string, path string) *HttpServerRoute
- type HttpServerRouter
- func (router *HttpServerRouter) GetAllRouters() []*httpServerNode
- func (router *HttpServerRouter) Group(path string) *HttpServerGroup
- func (router *HttpServerRouter) Route(method string, path string) *HttpServerRoute
- func (router *HttpServerRouter) SetDefaultIndex(index string)
- func (router *HttpServerRouter) SetStaticPath(prefixPath string, staticPath string)
- type Json
- func (j Json) Array(path ...interface{}) Array
- func (j Json) Bytes() []byte
- func (j Json) Empty(key string) bool
- func (j Json) Get(path ...interface{}) Value
- func (j Json) Has(key string) bool
- func (j Json) Iter() jsoniter.Any
- func (j Json) Path(path ...interface{}) jsoniter.Any
- func (j Json) Reset(data interface{}) jsoniter.Any
- func (j Json) String() string
- type JsonFormat
- type JsonMessage
- type JsonPackage
- type M
- type Params
- type ProtoBufPackage
- type PushInfo
- type Receive
- type ReceivePackage
- type Socket
- func (conn *Socket) ClientIP() string
- func (conn *Socket) Close() error
- func (conn *Socket) Json(msg interface{}) error
- func (conn *Socket) JsonEmit(msg JsonPackage) error
- func (conn *Socket) ProtoBuf(msg proto.Message) error
- func (conn *Socket) ProtoBufEmit(msg ProtoBufPackage) error
- func (conn *Socket) Push(msg []byte) error
- type SocketClient
- func (client *SocketClient) Close() error
- func (client *SocketClient) Connect()
- func (client *SocketClient) GetRouter() *SocketClientRouter
- func (client *SocketClient) Json(msg interface{}) error
- func (client *SocketClient) JsonEmit(msg JsonPackage) error
- func (client *SocketClient) ProtoBuf(msg proto.Message) error
- func (client *SocketClient) ProtoBufEmit(msg ProtoBufPackage) error
- func (client *SocketClient) Push(message []byte) error
- func (client *SocketClient) SetRouter(router *SocketClientRouter) *SocketClient
- func (client *SocketClient) Use(middle ...func(SocketClientMiddle) SocketClientMiddle)
- type SocketClientAfter
- type SocketClientBefore
- type SocketClientFunction
- type SocketClientGroup
- func (group *SocketClientGroup) After(after ...SocketClientAfter) *SocketClientGroup
- func (group *SocketClientGroup) Before(before ...SocketClientBefore) *SocketClientGroup
- func (group *SocketClientGroup) Handler(fn SocketClientGroupFunction)
- func (group *SocketClientGroup) Route(path string) *SocketClientGroup
- type SocketClientGroupFunction
- type SocketClientMiddle
- type SocketClientNode
- type SocketClientRoute
- func (route *SocketClientRoute) After(after ...SocketClientAfter) *SocketClientRoute
- func (route *SocketClientRoute) Before(before ...SocketClientBefore) *SocketClientRoute
- func (route *SocketClientRoute) ForceAfter() *SocketClientRoute
- func (route *SocketClientRoute) ForceBefore() *SocketClientRoute
- func (route *SocketClientRoute) Handler(fn SocketClientFunction)
- func (route *SocketClientRoute) PassAfter() *SocketClientRoute
- func (route *SocketClientRoute) PassBefore() *SocketClientRoute
- type SocketClientRouteHandler
- type SocketClientRouter
- type SocketServer
- func (socket *SocketServer) Close(fd uint32) error
- func (socket *SocketServer) GetConnection(fd uint32) (*Socket, bool)
- func (socket *SocketServer) GetConnections() chan *Socket
- func (socket *SocketServer) GetConnectionsCount() uint32
- func (socket *SocketServer) GetRouter() *SocketServerRouter
- func (socket *SocketServer) Json(fd uint32, msg interface{}) error
- func (socket *SocketServer) JsonEmit(fd uint32, msg JsonPackage) error
- func (socket *SocketServer) JsonEmitAll(msg JsonPackage) (int, int)
- func (socket *SocketServer) ProtoBuf(fd uint32, msg proto.Message) error
- func (socket *SocketServer) ProtoBufEmit(fd uint32, msg ProtoBufPackage) error
- func (socket *SocketServer) ProtoBufEmitAll(msg ProtoBufPackage) (int, int)
- func (socket *SocketServer) Push(fd uint32, msg []byte) error
- func (socket *SocketServer) Ready()
- func (socket *SocketServer) SetRouter(router *SocketServerRouter) *SocketServer
- func (socket *SocketServer) Shutdown()
- func (socket *SocketServer) Start()
- func (socket *SocketServer) Use(middle ...func(SocketServerMiddle) SocketServerMiddle)
- type SocketServerAfter
- type SocketServerBefore
- type SocketServerFunction
- type SocketServerGroup
- func (group *SocketServerGroup) After(after ...SocketServerAfter) *SocketServerGroup
- func (group *SocketServerGroup) Before(before ...SocketServerBefore) *SocketServerGroup
- func (group *SocketServerGroup) Handler(fn SocketServerGroupFunction)
- func (group *SocketServerGroup) Route(path string) *SocketServerGroup
- type SocketServerGroupFunction
- type SocketServerMiddle
- type SocketServerNode
- type SocketServerRoute
- func (route *SocketServerRoute) After(after ...SocketServerAfter) *SocketServerRoute
- func (route *SocketServerRoute) Before(before ...SocketServerBefore) *SocketServerRoute
- func (route *SocketServerRoute) ForceAfter() *SocketServerRoute
- func (route *SocketServerRoute) ForceBefore() *SocketServerRoute
- func (route *SocketServerRoute) Handler(fn SocketServerFunction)
- func (route *SocketServerRoute) PassAfter() *SocketServerRoute
- func (route *SocketServerRoute) PassBefore() *SocketServerRoute
- type SocketServerRouteHandler
- type SocketServerRouter
- type Store
- func (store Store) Add(key string, value string)
- func (store Store) AllValues() [][]string
- func (store Store) Empty(key string) bool
- func (store Store) Get(key string) Value
- func (store Store) GetAll(key string) []string
- func (store Store) Has(key string) bool
- func (store Store) Keys() []string
- func (store Store) Remove(key string)
- func (store Store) String() string
- func (store Store) Values() []string
- type Stream
- func (stream *Stream) AutoGet(key string) Value
- func (stream *Stream) AutoParse()
- func (stream *Stream) ClientIP() string
- func (stream *Stream) End(data interface{}) error
- func (stream *Stream) EndBytes(data []byte) error
- func (stream *Stream) EndFile(fileName string, content interface{}) error
- func (stream *Stream) EndJson(data interface{}) error
- func (stream *Stream) EndString(data string) error
- func (stream *Stream) Forward(fn HttpServerFunction) exception.Error
- func (stream *Stream) Host() string
- func (stream *Stream) JsonFormat(status string, code int, msg interface{}) exception.Error
- func (stream *Stream) LastError() interface{}
- func (stream *Stream) Match() bool
- func (stream *Stream) ParseFiles() Files
- func (stream *Stream) ParseForm() Store
- func (stream *Stream) ParseJson() Json
- func (stream *Stream) ParseMultipart() Store
- func (stream *Stream) ParseQuery() Store
- func (stream *Stream) Scheme() string
- func (stream *Stream) SetHeader(header string, content string)
- func (stream *Stream) SetMaxMemory(maxMemory int64)
- func (stream *Stream) String() string
- func (stream *Stream) Url() string
- type Value
- type WebSocket
- func (conn *WebSocket) ClientIP() string
- func (conn *WebSocket) Close() error
- func (conn *WebSocket) Host() string
- func (conn *WebSocket) Json(msg interface{}) error
- func (conn *WebSocket) JsonEmit(msg JsonPackage) error
- func (conn *WebSocket) JsonFormat(msg JsonPackage) exception.Error
- func (conn *WebSocket) ProtoBuf(msg proto.Message) error
- func (conn *WebSocket) ProtoBufEmit(msg ProtoBufPackage) error
- func (conn *WebSocket) Push(messageType int, msg []byte) error
- type WebSocketClient
- func (client *WebSocketClient) Close() error
- func (client *WebSocketClient) Connect()
- func (client *WebSocketClient) GetRouter() *WebSocketClientRouter
- func (client *WebSocketClient) Json(msg interface{}) error
- func (client *WebSocketClient) JsonEmit(msg JsonPackage) error
- func (client *WebSocketClient) JsonFormat(msg JsonPackage) exception.Error
- func (client *WebSocketClient) ProtoBuf(msg proto.Message) error
- func (client *WebSocketClient) ProtoBufEmit(msg ProtoBufPackage) error
- func (client *WebSocketClient) Push(messageType int, message []byte) error
- func (client *WebSocketClient) SetRouter(router *WebSocketClientRouter) *WebSocketClient
- func (client *WebSocketClient) Use(middle ...func(WebSocketClientMiddle) WebSocketClientMiddle)
- type WebSocketClientAfter
- type WebSocketClientBefore
- type WebSocketClientFunction
- type WebSocketClientGroup
- func (group *WebSocketClientGroup) After(after ...WebSocketClientAfter) *WebSocketClientGroup
- func (group *WebSocketClientGroup) Before(before ...WebSocketClientBefore) *WebSocketClientGroup
- func (group *WebSocketClientGroup) Handler(fn WebSocketClientGroupFunction)
- func (group *WebSocketClientGroup) Route(path string) *WebSocketClientGroup
- type WebSocketClientGroupFunction
- type WebSocketClientMiddle
- type WebSocketClientNode
- type WebSocketClientRoute
- func (route *WebSocketClientRoute) After(after ...WebSocketClientAfter) *WebSocketClientRoute
- func (route *WebSocketClientRoute) Before(before ...WebSocketClientBefore) *WebSocketClientRoute
- func (route *WebSocketClientRoute) ForceAfter() *WebSocketClientRoute
- func (route *WebSocketClientRoute) ForceBefore() *WebSocketClientRoute
- func (route *WebSocketClientRoute) Handler(fn WebSocketClientFunction)
- func (route *WebSocketClientRoute) PassAfter() *WebSocketClientRoute
- func (route *WebSocketClientRoute) PassBefore() *WebSocketClientRoute
- type WebSocketClientRouteHandler
- type WebSocketClientRouter
- type WebSocketServer
- func (socket *WebSocketServer) CheckPath(p1 string, p2 string) bool
- func (socket *WebSocketServer) Close(fd uint32) error
- func (socket *WebSocketServer) GetConnection(fd uint32) (*WebSocket, bool)
- func (socket *WebSocketServer) GetConnections() chan *WebSocket
- func (socket *WebSocketServer) GetConnectionsCount() uint32
- func (socket *WebSocketServer) GetRouter() *WebSocketServerRouter
- func (socket *WebSocketServer) Json(fd uint32, msg interface{}) error
- func (socket *WebSocketServer) JsonEmit(fd uint32, msg JsonPackage) error
- func (socket *WebSocketServer) JsonEmitAll(msg JsonPackage) (int, int)
- func (socket *WebSocketServer) JsonFormat(fd uint32, msg JsonPackage) exception.Error
- func (socket *WebSocketServer) JsonFormatAll(msg JsonPackage) (int, int)
- func (socket *WebSocketServer) ProtoBuf(fd uint32, msg proto.Message) error
- func (socket *WebSocketServer) ProtoBufEmit(fd uint32, msg ProtoBufPackage) error
- func (socket *WebSocketServer) ProtoBufEmitAll(msg ProtoBufPackage) (int, int)
- func (socket *WebSocketServer) Push(fd uint32, messageType int, msg []byte) error
- func (socket *WebSocketServer) Ready()
- func (socket *WebSocketServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (socket *WebSocketServer) SetRouter(router *WebSocketServerRouter) *WebSocketServer
- func (socket *WebSocketServer) Shutdown()
- func (socket *WebSocketServer) Start()
- func (socket *WebSocketServer) Use(middle ...func(next WebSocketServerMiddle) WebSocketServerMiddle)
- type WebSocketServerAfter
- type WebSocketServerBefore
- type WebSocketServerFunction
- type WebSocketServerGroup
- func (group *WebSocketServerGroup) After(after ...WebSocketServerAfter) *WebSocketServerGroup
- func (group *WebSocketServerGroup) Before(before ...WebSocketServerBefore) *WebSocketServerGroup
- func (group *WebSocketServerGroup) Handler(fn WebSocketServerGroupFunction)
- func (group *WebSocketServerGroup) Route(path string) *WebSocketServerGroup
- type WebSocketServerGroupFunction
- type WebSocketServerMiddle
- type WebSocketServerNode
- type WebSocketServerRoute
- func (route *WebSocketServerRoute) After(after ...WebSocketServerAfter) *WebSocketServerRoute
- func (route *WebSocketServerRoute) Before(before ...WebSocketServerBefore) *WebSocketServerRoute
- func (route *WebSocketServerRoute) ForceAfter() *WebSocketServerRoute
- func (route *WebSocketServerRoute) ForceBefore() *WebSocketServerRoute
- func (route *WebSocketServerRoute) Handler(fn WebSocketServerFunction)
- func (route *WebSocketServerRoute) PassAfter() *WebSocketServerRoute
- func (route *WebSocketServerRoute) PassBefore() *WebSocketServerRoute
- type WebSocketServerRouteHandler
- type WebSocketServerRouter
Constants ¶
View Source
const ( XForwardedFor = "X-Forwarded-For" XRealIP = "X-Real-IP" Host = "Host" )
Variables ¶
This section is empty.
Functions ¶
func SetHttpGlobalAfter ¶
func SetHttpGlobalAfter(after ...HttpServerAfter)
func SetHttpGlobalBefore ¶
func SetHttpGlobalBefore(before ...HttpServerBefore)
func SetSocketClientAfter ¶
func SetSocketClientAfter(after ...SocketClientAfter)
func SetSocketClientBefore ¶
func SetSocketClientBefore(before ...SocketClientBefore)
func SetSocketServerAfter ¶
func SetSocketServerAfter(after ...SocketServerAfter)
func SetSocketServerBefore ¶
func SetSocketServerBefore(before ...SocketServerBefore)
func SetWebSocketClientAfter ¶
func SetWebSocketClientAfter(after ...WebSocketClientAfter)
func SetWebSocketClientBefore ¶
func SetWebSocketClientBefore(before ...WebSocketClientBefore)
func SetWebSocketServerAfter ¶
func SetWebSocketServerAfter(after ...WebSocketServerAfter)
func SetWebSocketServerBefore ¶
func SetWebSocketServerBefore(before ...WebSocketServerBefore)
Types ¶
type HttpServer ¶
type HttpServer struct { // Host 服务Host Host string // Port 服务端口 Port int // Protocol 协议 Protocol string // TLS FILE CertFile string // TLS KEY KeyFile string // AutoBind AutoBind bool OnOpen func(stream *Stream) OnMessage func(stream *Stream) OnClose func(stream *Stream) OnError func(stream *Stream) // contains filtered or unexported fields }
func (*HttpServer) GetRouter ¶
func (h *HttpServer) GetRouter() *HttpServerRouter
func (*HttpServer) Ready ¶
func (h *HttpServer) Ready()
func (*HttpServer) ServeHTTP ¶
func (h *HttpServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*HttpServer) SetRouter ¶
func (h *HttpServer) SetRouter(router *HttpServerRouter) *HttpServer
func (*HttpServer) Shutdown ¶
func (h *HttpServer) Shutdown()
func (*HttpServer) Use ¶
func (h *HttpServer) Use(middle ...func(next HttpServerMiddle) HttpServerMiddle)
type HttpServerAfter ¶
type HttpServerFunction ¶
type HttpServerGroup ¶
type HttpServerGroup struct {
// contains filtered or unexported fields
}
func (*HttpServerGroup) After ¶
func (group *HttpServerGroup) After(after ...HttpServerAfter) *HttpServerGroup
func (*HttpServerGroup) Before ¶
func (group *HttpServerGroup) Before(before ...HttpServerBefore) *HttpServerGroup
func (*HttpServerGroup) Handler ¶
func (group *HttpServerGroup) Handler(fn HttpServerGroupFunction)
func (*HttpServerGroup) Route ¶
func (group *HttpServerGroup) Route(path string) *HttpServerGroup
type HttpServerGroupFunction ¶
type HttpServerGroupFunction func(handler *HttpServerRouteHandler)
type HttpServerMiddle ¶
type HttpServerMiddle func(*Stream)
type HttpServerRoute ¶
type HttpServerRoute struct {
// contains filtered or unexported fields
}
func (*HttpServerRoute) After ¶
func (route *HttpServerRoute) After(after ...HttpServerAfter) *HttpServerRoute
func (*HttpServerRoute) Before ¶
func (route *HttpServerRoute) Before(before ...HttpServerBefore) *HttpServerRoute
func (*HttpServerRoute) ForceAfter ¶
func (route *HttpServerRoute) ForceAfter() *HttpServerRoute
func (*HttpServerRoute) ForceBefore ¶
func (route *HttpServerRoute) ForceBefore() *HttpServerRoute
func (*HttpServerRoute) Handler ¶
func (route *HttpServerRoute) Handler(fn HttpServerFunction)
func (*HttpServerRoute) PassAfter ¶
func (route *HttpServerRoute) PassAfter() *HttpServerRoute
func (*HttpServerRoute) PassBefore ¶
func (route *HttpServerRoute) PassBefore() *HttpServerRoute
type HttpServerRouteHandler ¶
type HttpServerRouteHandler struct {
// contains filtered or unexported fields
}
func (*HttpServerRouteHandler) Delete ¶
func (handler *HttpServerRouteHandler) Delete(path string) *HttpServerRoute
func (*HttpServerRouteHandler) Get ¶
func (handler *HttpServerRouteHandler) Get(path string) *HttpServerRoute
func (*HttpServerRouteHandler) Option ¶
func (handler *HttpServerRouteHandler) Option(path string) *HttpServerRoute
func (*HttpServerRouteHandler) Patch ¶
func (handler *HttpServerRouteHandler) Patch(path string) *HttpServerRoute
func (*HttpServerRouteHandler) Post ¶
func (handler *HttpServerRouteHandler) Post(path string) *HttpServerRoute
func (*HttpServerRouteHandler) Put ¶
func (handler *HttpServerRouteHandler) Put(path string) *HttpServerRoute
func (*HttpServerRouteHandler) Route ¶
func (handler *HttpServerRouteHandler) Route(method string, path string) *HttpServerRoute
type HttpServerRouter ¶
type HttpServerRouter struct { IgnoreCase bool // contains filtered or unexported fields }
func (*HttpServerRouter) GetAllRouters ¶
func (router *HttpServerRouter) GetAllRouters() []*httpServerNode
func (*HttpServerRouter) Group ¶
func (router *HttpServerRouter) Group(path string) *HttpServerGroup
func (*HttpServerRouter) Route ¶
func (router *HttpServerRouter) Route(method string, path string) *HttpServerRoute
func (*HttpServerRouter) SetDefaultIndex ¶
func (router *HttpServerRouter) SetDefaultIndex(index string)
func (*HttpServerRouter) SetStaticPath ¶
func (router *HttpServerRouter) SetStaticPath(prefixPath string, staticPath string)
type JsonFormat ¶
type JsonFormat struct { Status string `json:"status"` Code int `json:"code"` Msg interface{} `json:"msg"` }
func JM ¶
func JM(status string, code int, msg interface{}) *JsonFormat
type JsonMessage ¶
type JsonMessage struct { Event string `json:"event"` Data interface{} `json:"data"` }
func EM ¶
func EM(event string, data interface{}) *JsonMessage
type JsonPackage ¶
type JsonPackage struct { Event string Message interface{} }
type ProtoBufPackage ¶
type Receive ¶
type Receive struct { Context Context Params Params Body *ReceivePackage }
type ReceivePackage ¶
type Socket ¶
type Socket struct { FD uint32 Conn net.Conn Server *SocketServer Context Context }
func (*Socket) JsonEmit ¶
func (conn *Socket) JsonEmit(msg JsonPackage) error
func (*Socket) ProtoBufEmit ¶
func (conn *Socket) ProtoBufEmit(msg ProtoBufPackage) error
type SocketClient ¶
type SocketClient struct { Host string Port int Conn net.Conn AutoHeartBeat bool HeartBeatTimeout int HeartBeatInterval int HeartBeat func(c *SocketClient) error Reconnect bool ReconnectInterval int ReadBufferSize int WriteBufferSize int HandshakeTimeout int // 消息处理 OnOpen func(c *SocketClient) OnClose func(c *SocketClient) OnMessage func(c *SocketClient, messageType int, msg []byte) OnError func(err exception.Error) Status bool Context Context PingHandler func(c *SocketClient) func(appData string) error PongHandler func(c *SocketClient) func(appData string) error // contains filtered or unexported fields }
func (*SocketClient) Close ¶
func (client *SocketClient) Close() error
func (*SocketClient) Connect ¶
func (client *SocketClient) Connect()
func (*SocketClient) GetRouter ¶
func (client *SocketClient) GetRouter() *SocketClientRouter
func (*SocketClient) JsonEmit ¶
func (client *SocketClient) JsonEmit(msg JsonPackage) error
func (*SocketClient) ProtoBufEmit ¶
func (client *SocketClient) ProtoBufEmit(msg ProtoBufPackage) error
func (*SocketClient) SetRouter ¶
func (client *SocketClient) SetRouter(router *SocketClientRouter) *SocketClient
func (*SocketClient) Use ¶
func (client *SocketClient) Use(middle ...func(SocketClientMiddle) SocketClientMiddle)
type SocketClientAfter ¶
type SocketClientAfter func(c *SocketClient, receive *Receive) exception.Error
type SocketClientBefore ¶
type SocketClientBefore func(c *SocketClient, receive *Receive) (Context, exception.Error)
type SocketClientFunction ¶
type SocketClientFunction func(c *SocketClient, receive *Receive) exception.Error
type SocketClientGroup ¶
type SocketClientGroup struct {
// contains filtered or unexported fields
}
func (*SocketClientGroup) After ¶
func (group *SocketClientGroup) After(after ...SocketClientAfter) *SocketClientGroup
func (*SocketClientGroup) Before ¶
func (group *SocketClientGroup) Before(before ...SocketClientBefore) *SocketClientGroup
func (*SocketClientGroup) Handler ¶
func (group *SocketClientGroup) Handler(fn SocketClientGroupFunction)
func (*SocketClientGroup) Route ¶
func (group *SocketClientGroup) Route(path string) *SocketClientGroup
type SocketClientGroupFunction ¶
type SocketClientGroupFunction func(handler *SocketClientRouteHandler)
type SocketClientMiddle ¶
type SocketClientMiddle func(c *SocketClient, receive *ReceivePackage)
type SocketClientNode ¶
type SocketClientNode struct { Info string Route []byte SocketClientFunction SocketClientFunction Before []SocketClientBefore After []SocketClientAfter }
type SocketClientRoute ¶
type SocketClientRoute struct {
// contains filtered or unexported fields
}
func (*SocketClientRoute) After ¶
func (route *SocketClientRoute) After(after ...SocketClientAfter) *SocketClientRoute
func (*SocketClientRoute) Before ¶
func (route *SocketClientRoute) Before(before ...SocketClientBefore) *SocketClientRoute
func (*SocketClientRoute) ForceAfter ¶
func (route *SocketClientRoute) ForceAfter() *SocketClientRoute
func (*SocketClientRoute) ForceBefore ¶
func (route *SocketClientRoute) ForceBefore() *SocketClientRoute
func (*SocketClientRoute) Handler ¶
func (route *SocketClientRoute) Handler(fn SocketClientFunction)
func (*SocketClientRoute) PassAfter ¶
func (route *SocketClientRoute) PassAfter() *SocketClientRoute
func (*SocketClientRoute) PassBefore ¶
func (route *SocketClientRoute) PassBefore() *SocketClientRoute
type SocketClientRouteHandler ¶
type SocketClientRouteHandler struct {
// contains filtered or unexported fields
}
func (*SocketClientRouteHandler) Route ¶
func (handler *SocketClientRouteHandler) Route(path string) *SocketClientRoute
type SocketClientRouter ¶
type SocketClientRouter struct { IgnoreCase bool // contains filtered or unexported fields }
func (*SocketClientRouter) GetAllRouters ¶
func (router *SocketClientRouter) GetAllRouters() []*SocketClientNode
func (*SocketClientRouter) Group ¶
func (router *SocketClientRouter) Group(path string) *SocketClientGroup
func (*SocketClientRouter) Route ¶
func (router *SocketClientRouter) Route(path string) *SocketClientRoute
type SocketServer ¶
type SocketServer struct { Host string Port int AutoBind bool OnClose func(conn *Socket) OnMessage func(conn *Socket, messageType int, msg []byte) OnOpen func(conn *Socket) OnError func(err exception.Error) HeartBeatTimeout int HeartBeatInterval int ReadBufferSize int WriteBufferSize int WaitQueueSize int HandshakeTimeout int PingHandler func(connection *Socket) func(appData string) error PongHandler func(connection *Socket) func(appData string) error // contains filtered or unexported fields }
func (*SocketServer) Close ¶
func (socket *SocketServer) Close(fd uint32) error
func (*SocketServer) GetConnection ¶
func (socket *SocketServer) GetConnection(fd uint32) (*Socket, bool)
func (*SocketServer) GetConnections ¶
func (socket *SocketServer) GetConnections() chan *Socket
func (*SocketServer) GetConnectionsCount ¶
func (socket *SocketServer) GetConnectionsCount() uint32
func (*SocketServer) GetRouter ¶
func (socket *SocketServer) GetRouter() *SocketServerRouter
func (*SocketServer) Json ¶
func (socket *SocketServer) Json(fd uint32, msg interface{}) error
Push Json 发送消息
func (*SocketServer) JsonEmit ¶
func (socket *SocketServer) JsonEmit(fd uint32, msg JsonPackage) error
func (*SocketServer) JsonEmitAll ¶
func (socket *SocketServer) JsonEmitAll(msg JsonPackage) (int, int)
func (*SocketServer) ProtoBuf ¶
func (socket *SocketServer) ProtoBuf(fd uint32, msg proto.Message) error
func (*SocketServer) ProtoBufEmit ¶
func (socket *SocketServer) ProtoBufEmit(fd uint32, msg ProtoBufPackage) error
func (*SocketServer) ProtoBufEmitAll ¶
func (socket *SocketServer) ProtoBufEmitAll(msg ProtoBufPackage) (int, int)
func (*SocketServer) Ready ¶
func (socket *SocketServer) Ready()
func (*SocketServer) SetRouter ¶
func (socket *SocketServer) SetRouter(router *SocketServerRouter) *SocketServer
func (*SocketServer) Shutdown ¶
func (socket *SocketServer) Shutdown()
func (*SocketServer) Start ¶
func (socket *SocketServer) Start()
func (*SocketServer) Use ¶
func (socket *SocketServer) Use(middle ...func(SocketServerMiddle) SocketServerMiddle)
type SocketServerAfter ¶
type SocketServerBefore ¶
type SocketServerFunction ¶
type SocketServerGroup ¶
type SocketServerGroup struct {
// contains filtered or unexported fields
}
func (*SocketServerGroup) After ¶
func (group *SocketServerGroup) After(after ...SocketServerAfter) *SocketServerGroup
func (*SocketServerGroup) Before ¶
func (group *SocketServerGroup) Before(before ...SocketServerBefore) *SocketServerGroup
func (*SocketServerGroup) Handler ¶
func (group *SocketServerGroup) Handler(fn SocketServerGroupFunction)
func (*SocketServerGroup) Route ¶
func (group *SocketServerGroup) Route(path string) *SocketServerGroup
type SocketServerGroupFunction ¶
type SocketServerGroupFunction func(handler *SocketServerRouteHandler)
type SocketServerMiddle ¶
type SocketServerMiddle func(conn *Socket, receive *ReceivePackage)
type SocketServerNode ¶
type SocketServerNode struct { Info string Route []byte SocketServerFunction SocketServerFunction Before []SocketServerBefore After []SocketServerAfter }
type SocketServerRoute ¶
type SocketServerRoute struct {
// contains filtered or unexported fields
}
func (*SocketServerRoute) After ¶
func (route *SocketServerRoute) After(after ...SocketServerAfter) *SocketServerRoute
func (*SocketServerRoute) Before ¶
func (route *SocketServerRoute) Before(before ...SocketServerBefore) *SocketServerRoute
func (*SocketServerRoute) ForceAfter ¶
func (route *SocketServerRoute) ForceAfter() *SocketServerRoute
func (*SocketServerRoute) ForceBefore ¶
func (route *SocketServerRoute) ForceBefore() *SocketServerRoute
func (*SocketServerRoute) Handler ¶
func (route *SocketServerRoute) Handler(fn SocketServerFunction)
func (*SocketServerRoute) PassAfter ¶
func (route *SocketServerRoute) PassAfter() *SocketServerRoute
func (*SocketServerRoute) PassBefore ¶
func (route *SocketServerRoute) PassBefore() *SocketServerRoute
type SocketServerRouteHandler ¶
type SocketServerRouteHandler struct {
// contains filtered or unexported fields
}
func (*SocketServerRouteHandler) Route ¶
func (handler *SocketServerRouteHandler) Route(path string) *SocketServerRoute
type SocketServerRouter ¶
type SocketServerRouter struct { IgnoreCase bool // contains filtered or unexported fields }
func (*SocketServerRouter) GetAllRouters ¶
func (router *SocketServerRouter) GetAllRouters() []*SocketServerNode
func (*SocketServerRouter) Group ¶
func (router *SocketServerRouter) Group(path string) *SocketServerGroup
func (*SocketServerRouter) Route ¶
func (router *SocketServerRouter) Route(path string) *SocketServerRoute
type Stream ¶
type Stream struct { Server *HttpServer Response http.ResponseWriter Request *http.Request Params Params Context Context Query Store Form Store Json Json Files Files // contains filtered or unexported fields }
func NewStream ¶
func NewStream(h *HttpServer, w http.ResponseWriter, r *http.Request) *Stream
func (*Stream) JsonFormat ¶
func (*Stream) ParseFiles ¶
func (*Stream) ParseMultipart ¶
func (*Stream) ParseQuery ¶
func (*Stream) SetMaxMemory ¶
type WebSocket ¶
type WebSocket struct { FD uint32 Conn *websocket.Conn Server *WebSocketServer Response http.ResponseWriter Request *http.Request Context Context }
WebSocket WebSocket
func (*WebSocket) JsonEmit ¶
func (conn *WebSocket) JsonEmit(msg JsonPackage) error
func (*WebSocket) JsonFormat ¶
func (conn *WebSocket) JsonFormat(msg JsonPackage) exception.Error
func (*WebSocket) ProtoBufEmit ¶
func (conn *WebSocket) ProtoBufEmit(msg ProtoBufPackage) error
type WebSocketClient ¶
type WebSocketClient struct { // 服务器信息 Protocol string Host string Port int Path string // 客户端信息 Conn *websocket.Conn Response *http.Response AutoHeartBeat bool HeartBeatTimeout int HeartBeatInterval int HeartBeat func(c *WebSocketClient) error Reconnect bool ReconnectInterval int WriteBufferSize int ReadBufferSize int HandshakeTimeout int // 消息处理 OnOpen func(c *WebSocketClient) OnClose func(c *WebSocketClient) OnMessage func(c *WebSocketClient, messageType int, msg []byte) OnError func(err exception.Error) Status bool Context interface{} PingHandler func(c *WebSocketClient) func(appData string) error PongHandler func(c *WebSocketClient) func(appData string) error // contains filtered or unexported fields }
WebSocketClient 客户端
func (*WebSocketClient) Close ¶
func (client *WebSocketClient) Close() error
func (*WebSocketClient) GetRouter ¶
func (client *WebSocketClient) GetRouter() *WebSocketClientRouter
func (*WebSocketClient) Json ¶
func (client *WebSocketClient) Json(msg interface{}) error
Json 发送JSON字符
func (*WebSocketClient) JsonEmit ¶
func (client *WebSocketClient) JsonEmit(msg JsonPackage) error
func (*WebSocketClient) JsonFormat ¶
func (client *WebSocketClient) JsonFormat(msg JsonPackage) exception.Error
func (*WebSocketClient) ProtoBufEmit ¶
func (client *WebSocketClient) ProtoBufEmit(msg ProtoBufPackage) error
func (*WebSocketClient) Push ¶
func (client *WebSocketClient) Push(messageType int, message []byte) error
Push 发送消息
func (*WebSocketClient) SetRouter ¶
func (client *WebSocketClient) SetRouter(router *WebSocketClientRouter) *WebSocketClient
func (*WebSocketClient) Use ¶
func (client *WebSocketClient) Use(middle ...func(WebSocketClientMiddle) WebSocketClientMiddle)
type WebSocketClientAfter ¶
type WebSocketClientAfter func(c *WebSocketClient, receive *Receive) exception.Error
type WebSocketClientBefore ¶
type WebSocketClientBefore func(c *WebSocketClient, receive *Receive) (Context, exception.Error)
type WebSocketClientFunction ¶
type WebSocketClientFunction func(c *WebSocketClient, receive *Receive) exception.Error
type WebSocketClientGroup ¶
type WebSocketClientGroup struct {
// contains filtered or unexported fields
}
func (*WebSocketClientGroup) After ¶
func (group *WebSocketClientGroup) After(after ...WebSocketClientAfter) *WebSocketClientGroup
func (*WebSocketClientGroup) Before ¶
func (group *WebSocketClientGroup) Before(before ...WebSocketClientBefore) *WebSocketClientGroup
func (*WebSocketClientGroup) Handler ¶
func (group *WebSocketClientGroup) Handler(fn WebSocketClientGroupFunction)
func (*WebSocketClientGroup) Route ¶
func (group *WebSocketClientGroup) Route(path string) *WebSocketClientGroup
type WebSocketClientGroupFunction ¶
type WebSocketClientGroupFunction func(handler *WebSocketClientRouteHandler)
type WebSocketClientMiddle ¶
type WebSocketClientMiddle func(c *WebSocketClient, receive *ReceivePackage)
type WebSocketClientNode ¶
type WebSocketClientNode struct { Info string Route []byte WebSocketClientFunction WebSocketClientFunction Before []WebSocketClientBefore After []WebSocketClientAfter }
type WebSocketClientRoute ¶
type WebSocketClientRoute struct {
// contains filtered or unexported fields
}
func (*WebSocketClientRoute) After ¶
func (route *WebSocketClientRoute) After(after ...WebSocketClientAfter) *WebSocketClientRoute
func (*WebSocketClientRoute) Before ¶
func (route *WebSocketClientRoute) Before(before ...WebSocketClientBefore) *WebSocketClientRoute
func (*WebSocketClientRoute) ForceAfter ¶
func (route *WebSocketClientRoute) ForceAfter() *WebSocketClientRoute
func (*WebSocketClientRoute) ForceBefore ¶
func (route *WebSocketClientRoute) ForceBefore() *WebSocketClientRoute
func (*WebSocketClientRoute) Handler ¶
func (route *WebSocketClientRoute) Handler(fn WebSocketClientFunction)
func (*WebSocketClientRoute) PassAfter ¶
func (route *WebSocketClientRoute) PassAfter() *WebSocketClientRoute
func (*WebSocketClientRoute) PassBefore ¶
func (route *WebSocketClientRoute) PassBefore() *WebSocketClientRoute
type WebSocketClientRouteHandler ¶
type WebSocketClientRouteHandler struct {
// contains filtered or unexported fields
}
func (*WebSocketClientRouteHandler) Route ¶
func (handler *WebSocketClientRouteHandler) Route(path string) *WebSocketClientRoute
type WebSocketClientRouter ¶
type WebSocketClientRouter struct { IgnoreCase bool // contains filtered or unexported fields }
func (*WebSocketClientRouter) GetAllRouters ¶
func (router *WebSocketClientRouter) GetAllRouters() []*WebSocketClientNode
func (*WebSocketClientRouter) Group ¶
func (router *WebSocketClientRouter) Group(path string) *WebSocketClientGroup
func (*WebSocketClientRouter) Route ¶
func (router *WebSocketClientRouter) Route(path string) *WebSocketClientRoute
type WebSocketServer ¶
type WebSocketServer struct { // Host 服务Host Host string // Port 服务端口 Port int // Protocol 协议 Protocol string // TLS FILE CertFile string // TLS KEY KeyFile string AutoBind bool OnClose func(conn *WebSocket) OnMessage func(conn *WebSocket, messageType int, msg []byte) OnOpen func(conn *WebSocket) OnError func(err exception.Error) HeartBeatTimeout int HeartBeatInterval int HandshakeTimeout int ReadBufferSize int WriteBufferSize int WaitQueueSize int CheckOrigin func(r *http.Request) bool Path string PingHandler func(connection *WebSocket) func(appData string) error PongHandler func(connection *WebSocket) func(appData string) error // contains filtered or unexported fields }
WebSocketServer conn
func (*WebSocketServer) CheckPath ¶
func (socket *WebSocketServer) CheckPath(p1 string, p2 string) bool
func (*WebSocketServer) Close ¶
func (socket *WebSocketServer) Close(fd uint32) error
func (*WebSocketServer) GetConnection ¶
func (socket *WebSocketServer) GetConnection(fd uint32) (*WebSocket, bool)
func (*WebSocketServer) GetConnections ¶
func (socket *WebSocketServer) GetConnections() chan *WebSocket
func (*WebSocketServer) GetConnectionsCount ¶
func (socket *WebSocketServer) GetConnectionsCount() uint32
func (*WebSocketServer) GetRouter ¶
func (socket *WebSocketServer) GetRouter() *WebSocketServerRouter
func (*WebSocketServer) Json ¶
func (socket *WebSocketServer) Json(fd uint32, msg interface{}) error
Push Json 发送消息
func (*WebSocketServer) JsonEmit ¶
func (socket *WebSocketServer) JsonEmit(fd uint32, msg JsonPackage) error
func (*WebSocketServer) JsonEmitAll ¶
func (socket *WebSocketServer) JsonEmitAll(msg JsonPackage) (int, int)
func (*WebSocketServer) JsonFormat ¶
func (socket *WebSocketServer) JsonFormat(fd uint32, msg JsonPackage) exception.Error
func (*WebSocketServer) JsonFormatAll ¶
func (socket *WebSocketServer) JsonFormatAll(msg JsonPackage) (int, int)
func (*WebSocketServer) ProtoBuf ¶
func (socket *WebSocketServer) ProtoBuf(fd uint32, msg proto.Message) error
func (*WebSocketServer) ProtoBufEmit ¶
func (socket *WebSocketServer) ProtoBufEmit(fd uint32, msg ProtoBufPackage) error
func (*WebSocketServer) ProtoBufEmitAll ¶
func (socket *WebSocketServer) ProtoBufEmitAll(msg ProtoBufPackage) (int, int)
func (*WebSocketServer) Push ¶
func (socket *WebSocketServer) Push(fd uint32, messageType int, msg []byte) error
Push 发送消息
func (*WebSocketServer) Ready ¶
func (socket *WebSocketServer) Ready()
func (*WebSocketServer) ServeHTTP ¶
func (socket *WebSocketServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*WebSocketServer) SetRouter ¶
func (socket *WebSocketServer) SetRouter(router *WebSocketServerRouter) *WebSocketServer
func (*WebSocketServer) Shutdown ¶
func (socket *WebSocketServer) Shutdown()
func (*WebSocketServer) Use ¶
func (socket *WebSocketServer) Use(middle ...func(next WebSocketServerMiddle) WebSocketServerMiddle)
type WebSocketServerAfter ¶
type WebSocketServerBefore ¶
type WebSocketServerFunction ¶
type WebSocketServerGroup ¶
type WebSocketServerGroup struct {
// contains filtered or unexported fields
}
func (*WebSocketServerGroup) After ¶
func (group *WebSocketServerGroup) After(after ...WebSocketServerAfter) *WebSocketServerGroup
func (*WebSocketServerGroup) Before ¶
func (group *WebSocketServerGroup) Before(before ...WebSocketServerBefore) *WebSocketServerGroup
func (*WebSocketServerGroup) Handler ¶
func (group *WebSocketServerGroup) Handler(fn WebSocketServerGroupFunction)
func (*WebSocketServerGroup) Route ¶
func (group *WebSocketServerGroup) Route(path string) *WebSocketServerGroup
type WebSocketServerGroupFunction ¶
type WebSocketServerGroupFunction func(handler *WebSocketServerRouteHandler)
type WebSocketServerMiddle ¶
type WebSocketServerMiddle func(conn *WebSocket, receive *ReceivePackage)
type WebSocketServerNode ¶
type WebSocketServerNode struct { Info string Route []byte WebSocketServerFunction WebSocketServerFunction Before []WebSocketServerBefore After []WebSocketServerAfter }
type WebSocketServerRoute ¶
type WebSocketServerRoute struct {
// contains filtered or unexported fields
}
func (*WebSocketServerRoute) After ¶
func (route *WebSocketServerRoute) After(after ...WebSocketServerAfter) *WebSocketServerRoute
func (*WebSocketServerRoute) Before ¶
func (route *WebSocketServerRoute) Before(before ...WebSocketServerBefore) *WebSocketServerRoute
func (*WebSocketServerRoute) ForceAfter ¶
func (route *WebSocketServerRoute) ForceAfter() *WebSocketServerRoute
func (*WebSocketServerRoute) ForceBefore ¶
func (route *WebSocketServerRoute) ForceBefore() *WebSocketServerRoute
func (*WebSocketServerRoute) Handler ¶
func (route *WebSocketServerRoute) Handler(fn WebSocketServerFunction)
func (*WebSocketServerRoute) PassAfter ¶
func (route *WebSocketServerRoute) PassAfter() *WebSocketServerRoute
func (*WebSocketServerRoute) PassBefore ¶
func (route *WebSocketServerRoute) PassBefore() *WebSocketServerRoute
type WebSocketServerRouteHandler ¶
type WebSocketServerRouteHandler struct {
// contains filtered or unexported fields
}
func (*WebSocketServerRouteHandler) Route ¶
func (handler *WebSocketServerRouteHandler) Route(path string) *WebSocketServerRoute
type WebSocketServerRouter ¶
type WebSocketServerRouter struct { IgnoreCase bool // contains filtered or unexported fields }
func (*WebSocketServerRouter) GetAllRouters ¶
func (router *WebSocketServerRouter) GetAllRouters() []*WebSocketServerNode
func (*WebSocketServerRouter) Group ¶
func (router *WebSocketServerRouter) Group(path string) *WebSocketServerGroup
func (*WebSocketServerRouter) Route ¶
func (router *WebSocketServerRouter) Route(path string) *WebSocketServerRoute
Source Files ¶
Click to show internal directories.
Click to hide internal directories.