Documentation ¶
Index ¶
- Variables
- func ArrayReduce(data interface{}, callable iface.CarryFunc, initial interface{}) interface{}
- func MaxListenerBacklog() int
- func NewContext(request iface.IRequest) iface.IContext
- func NewLogger() *logrus.Logger
- func NewPipeline() iface.IPipeline
- func SockaddrToTCPOrUnixAddr(sa unix.Sockaddr) net.Addr
- type Context
- type DataPacker
- type Message
- type Pipeline
- type Queue
- type Request
Constants ¶
This section is empty.
Variables ¶
View Source
var BodyLenExceedLimit = errors.New("body length exceed limit")
View Source
var HeadBytesLengthFail = errors.New("head bytes fail")
View Source
var Logger = NewLogger()
View Source
var RouterNotFound = errors.New("router Not Found")
View Source
var TLSHandshakeUnFinish = errors.New("tls handshake un finish")
View Source
var WebsocketOpcodeFail = errors.New("websocket opcode fail")
Functions ¶
func ArrayReduce ¶ added in v0.1.7
ArrayReduce .
func NewContext ¶ added in v0.1.7
NewContext .
func NewPipeline ¶ added in v0.1.7
Types ¶
type Context ¶ added in v0.1.7
type Context struct {
// contains filtered or unexported fields
}
func (*Context) GetConnect ¶ added in v0.1.7
func (*Context) GetMessage ¶ added in v0.1.7
GetMessage 获取消息
func (*Context) GetRequest ¶ added in v0.1.7
type DataPacker ¶
type DataPacker struct {
// contains filtered or unexported fields
}
DataPacker 可以自行实现IPacker,可以按照自己的协议格式来处理
func NewDataPacker ¶
func NewDataPacker() *DataPacker
func (*DataPacker) GetHeaderLength ¶ added in v0.1.3
func (d *DataPacker) GetHeaderLength() uint32
GetHeaderLength 获取头部长度
func (*DataPacker) Pack ¶
func (d *DataPacker) Pack(msgID uint32, data []byte) ([]byte, error)
Pack 封包格式:data长度(4字节)msgID(4字节)data
func (*DataPacker) SetMaxBodyLength ¶ added in v0.0.8
func (d *DataPacker) SetMaxBodyLength(maxBodyLength uint32)
SetMaxBodyLength .
type Message ¶
type Message struct { MsgID uint32 // 消息ID DataLen uint32 // 消息长度 Data []byte // 消息 IsWebSocket bool // 是否为websocket协议 Opcode uint8 // 操作码 }
Message 收到数据的封装
func (*Message) IsWebsocket ¶ added in v0.1.5
type Pipeline ¶ added in v0.1.7
type Pipeline struct {
// contains filtered or unexported fields
}
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func NewRequest ¶
func (*Request) GetConnects ¶ added in v0.1.1
GetConnects 获取所有的connect
Click to show internal directories.
Click to hide internal directories.