Documentation ¶
Index ¶
- Constants
- func DecodeMsg(flag byte, buf []byte) (msgdef.IMsg, error)
- func DecryptData(buf []byte) []byte
- func Dial(protocal string, addr string) (iserver.ISess, error)
- func EncodeMsg(msg msgdef.IMsg, buf []byte, forceNoCompress bool) ([]byte, error)
- func EncodeMsgWithEncrypt(msg msgdef.IMsg, buf []byte, forceNoCompress bool, encryptEnabled bool) ([]byte, error)
- func EncryptData(buf []byte) []byte
- func GetMsgID(buf []byte) uint16
- type ARQNetSrv
- type IConnNotify
- type IConnReceiver
- type IMsgServer
- type INetSrv
- type MsgServer
- type NetSess
- func (sess *NetSess) Close()
- func (sess *NetSess) FetchBacklog(o iserver.ISess)
- func (sess *NetSess) FlushBacklog()
- func (sess *NetSess) GetID() uint64
- func (sess *NetSess) GetServerType() uint8
- func (sess *NetSess) IsClosed() bool
- func (sess *NetSess) IsVertified() bool
- func (sess *NetSess) RemoteAddr() string
- func (sess *NetSess) Send(msg msgdef.IMsg)
- func (sess *NetSess) SendRaw(rawMsg []byte)
- func (sess *NetSess) SetID(id uint64)
- func (sess *NetSess) SetMsgHandler(handler msghandler.IMsgHandlers)
- func (sess *NetSess) SetServerType(servertype uint8)
- func (sess *NetSess) SetVertify()
- func (sess *NetSess) Start()
- func (sess *NetSess) Touch()
- type RawMsg
- type SessMgr
Constants ¶
View Source
const (
// MaxMsgBuffer 消息最大长度
MaxMsgBuffer = 100 * 1024
)
View Source
const (
// MsgHeadSize consist message length , compression type and message id
MsgHeadSize = 6
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ARQNetSrv ¶
type ARQNetSrv struct {
// contains filtered or unexported fields
}
ARQNetSrv 网络服务器
type IConnNotify ¶
type IConnNotify interface {
// contains filtered or unexported methods
}
IConnNotify 连接状态发生改变得到通知
type IConnReceiver ¶
type IConnReceiver interface {
// contains filtered or unexported methods
}
IConnReceiver 连接接收
type IMsgServer ¶
type IMsgServer interface { msghandler.IMsgHandlers IConnReceiver Start() error Close() MainLoop() GetSession(id uint64) iserver.ISess Count() int SetEncryptEnabled() }
IMsgServer 消息服务器接口
func NewMsgServer ¶
func NewMsgServer(protocal string, addr string, maxConns int) IMsgServer
NewMsgServer 创建一个消息监听器
type MsgServer ¶
type MsgServer struct { msghandler.IMsgHandlers *SessMgr INetSrv // contains filtered or unexported fields }
MsgServer 消息服务器
func (*MsgServer) GetSession ¶
GetSession 获取一个Sess对象
func (*MsgServer) SetEncryptEnabled ¶
func (srv *MsgServer) SetEncryptEnabled()
SetEncryptEnabled 是否加密
type NetSess ¶
type NetSess struct { msghandler.IMsgHandlers // contains filtered or unexported fields }
NetSess 代表一个网络连接
func (*NetSess) FetchBacklog ¶
FetchBacklog 获取积压消息
func (*NetSess) SetMsgHandler ¶
func (sess *NetSess) SetMsgHandler(handler msghandler.IMsgHandlers)
SetMsgHandler 设置消息处理器
func (*NetSess) SetServerType ¶
SetID 设置servertype
Click to show internal directories.
Click to hide internal directories.