Documentation ¶
Index ¶
- type Config
- type Context
- func (c *Context) Connection() connection.IConnection
- func (c *Context) Pack() connection.IPacket
- func (c *Context) Reset()
- func (c *Context) SetConnection(conn connection.IConnection)
- func (c *Context) SetPack(pack connection.IPacket)
- func (c *Context) SetSpanId(spanId string)
- func (c *Context) SetTraceId(traceId string)
- func (c *Context) SpanId() string
- func (c *Context) TraceId() string
- type HostInfo
- type IHandler
- type IService
- type Server
- type TcpService
- type WebSocketService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { PConfig connection.PacketConfig `json:"packet_config" yaml:"packet_config"` Host string `json:"host" yaml:"host"` Port int `json:"port" yaml:"port"` }
type Context ¶
func NewContext ¶ added in v1.0.7
func (*Context) Connection ¶
func (c *Context) Connection() connection.IConnection
func (*Context) Pack ¶
func (c *Context) Pack() connection.IPacket
func (*Context) SetConnection ¶
func (c *Context) SetConnection(conn connection.IConnection)
func (*Context) SetPack ¶
func (c *Context) SetPack(pack connection.IPacket)
func (*Context) SetTraceId ¶
type IHandler ¶
type IHandler interface { Connect(connection.IConnection) error Receive(*Context) error Close(connection.IConnection) error Packet([]byte) (connection.IPacket, error) }
type IService ¶
type IService interface { Listen(host string, port int) error Accept() (connection.IConnection, error) Close() Shutdown() IsClosed() bool }
type Server ¶
type Server struct { OnSuccess func(*Server) // contains filtered or unexported fields }
func (*Server) SetHandler ¶
func (*Server) SetService ¶
type TcpService ¶
type TcpService struct {
// contains filtered or unexported fields
}
func NewTcpService ¶
func NewTcpService(connMax int) *TcpService
func (*TcpService) Accept ¶
func (t *TcpService) Accept() (connection.IConnection, error)
func (*TcpService) Close ¶
func (t *TcpService) Close()
func (*TcpService) IsClosed ¶ added in v0.1.7
func (t *TcpService) IsClosed() bool
func (*TcpService) Shutdown ¶
func (t *TcpService) Shutdown()
type WebSocketService ¶
type WebSocketService struct {
// contains filtered or unexported fields
}
func NewWebSocketService ¶
func NewWebSocketService(connMax int) *WebSocketService
func (*WebSocketService) Accept ¶
func (t *WebSocketService) Accept() (connection.IConnection, error)
func (*WebSocketService) Close ¶
func (t *WebSocketService) Close()
func (*WebSocketService) IsClosed ¶ added in v0.1.7
func (t *WebSocketService) IsClosed() bool
func (*WebSocketService) Shutdown ¶
func (t *WebSocketService) Shutdown()
Click to show internal directories.
Click to hide internal directories.