Documentation ¶
Index ¶
- Constants
- Variables
- func Close()
- func DecodeUint32(data []byte) uint32
- func EncodeUint32(n uint32) []byte
- func OnlineCount() uint32
- func Pack(proto uint32, message []byte, count uint32) []byte
- func Regist(s interface{}, f interface{})
- func Server(addr string) (ln net.Listener)
- func Unpack(buffer []byte, length uint32, readerChannel chan *Packet) uint32
- type Connection
- func (c *Connection) Close()
- func (c *Connection) GetConnected() bool
- func (c *Connection) GetIPAddr() uint32
- func (c *Connection) GetLogin() bool
- func (c *Connection) GetUserid() string
- func (c *Connection) LoginTimeout()
- func (c *Connection) ReadPump()
- func (c *Connection) Reader(readChan chan *Packet)
- func (c *Connection) Send(data interfacer.IProto)
- func (c *Connection) SetLogin()
- func (c *Connection) SetUserid(userid string)
- func (c *Connection) WritePump()
- type Packet
Constants ¶
View Source
const ( PROTOLen uint32 = 4 DataLen uint32 = 4 //包信息数据长度占位长度 )
View Source
const (
// 网络掉线事件
OFFLINE = "offline"
)
Variables ¶
View Source
var ( VERSION = "0.0.1" BUILD_TIME = "" RUN_TIME = time.Now().Format("2006-01-02 15:04:05") )
View Source
var HANDDLen uint32 = 9
View Source
var HeaderLen uint32 = 1 // 包头长度
Functions ¶
Types ¶
type Connection ¶
type Connection struct { ReadChan chan *Packet event.Dispatcher // 事件管理器 // contains filtered or unexported fields }
func (*Connection) Close ¶
func (c *Connection) Close()
func (*Connection) GetConnected ¶
func (c *Connection) GetConnected() bool
func (*Connection) GetIPAddr ¶
func (c *Connection) GetIPAddr() uint32
func (*Connection) GetLogin ¶
func (c *Connection) GetLogin() bool
func (*Connection) GetUserid ¶
func (c *Connection) GetUserid() string
func (*Connection) LoginTimeout ¶
func (c *Connection) LoginTimeout()
func (*Connection) ReadPump ¶
func (c *Connection) ReadPump()
func (*Connection) Reader ¶
func (c *Connection) Reader(readChan chan *Packet)
func (*Connection) Send ¶
func (c *Connection) Send(data interfacer.IProto)
func (*Connection) SetLogin ¶
func (c *Connection) SetLogin()
func (*Connection) SetUserid ¶
func (c *Connection) SetUserid(userid string)
func (*Connection) WritePump ¶
func (c *Connection) WritePump()
type Packet ¶
type Packet struct {
// contains filtered or unexported fields
}
func (*Packet) GetContent ¶
func (*Packet) SetContent ¶
Click to show internal directories.
Click to hide internal directories.