Documentation ¶
Index ¶
- func SetLogLevel(level Level) error
- type CountdownTimer
- type Level
- type MessageHandler
- type MultipartFile
- type Options
- type Protocol
- type ProtocolCodec
- type Server
- func (server *Server) AddHandler(msgID protocol.MsgID, handler MessageHandler)
- func (server *Server) Broadcast(entity protocol.Entity) int
- func (server *Server) GetPrivateKey() *rsa.PrivateKey
- func (server *Server) GetSession(id uint64) (*Session, bool)
- func (server *Server) Run(network string, port int) error
- func (server *Server) Stop()
- type Session
- func (session *Session) Close() error
- func (session *Session) GetPublicKey() *rsa.PublicKey
- func (session *Session) GetServer() *Server
- func (session *Session) ID() uint64
- func (session *Session) Reply(msg *protocol.Message, result protocol.Result) (uint16, error)
- func (session *Session) Request(entity protocol.Entity, cb func(answer *protocol.Message)) (uint16, error)
- func (session *Session) Send(entity protocol.Entity) (uint16, error)
- func (session *Session) SetPublicKey(publicKey *rsa.PublicKey)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CountdownTimer ¶
type CountdownTimer struct {
// contains filtered or unexported fields
}
倒计时器
func NewCountdownTimer ¶
func NewCountdownTimer(seconds int64, callback func(string)) *CountdownTimer
创建倒计时器
func (*CountdownTimer) SetExpiration ¶
func (timer *CountdownTimer) SetExpiration(seconds int64)
设置过期时间
type MessageHandler ¶
type MultipartFile ¶
多分包文件
type Options ¶
type Options struct { Keepalive int64 AutoMergePacket bool CloseHandler func(*Session) PrivateKey *rsa.PrivateKey }
服务器选项
type ProtocolCodec ¶
type ProtocolCodec struct {
// contains filtered or unexported fields
}
编解码器
func (*ProtocolCodec) GetPublicKey ¶
func (codec *ProtocolCodec) GetPublicKey() *rsa.PublicKey
获取RSA公钥
func (*ProtocolCodec) SetPublicKey ¶
func (codec *ProtocolCodec) SetPublicKey(publicKey *rsa.PublicKey)
设置RSA公钥
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
协议服务器
func (*Server) AddHandler ¶
func (server *Server) AddHandler(msgID protocol.MsgID, handler MessageHandler)
添加消息处理
type Session ¶
type Session struct { UserData interface{} // contains filtered or unexported fields }
终端会话
func (*Session) Request ¶
func (session *Session) Request(entity protocol.Entity, cb func(answer *protocol.Message)) (uint16, error)
发起请求
func (*Session) SetPublicKey ¶
设置RSA公钥
Source Files ¶
Click to show internal directories.
Click to hide internal directories.