Documentation ¶
Index ¶
- Variables
- func Float642String(val float64) string
- func Int2String(val int) string
- func Int642String(val int64) string
- func NewUUID() string
- func String2Int(val string) int
- func Uint322ByteArray(val uint32) []byte
- func Uint322String(val uint32) string
- type Config
- type Conn
- type ConnCallback
- type IntHeap
- type Packet
- type Protocol
- type Server
- type Stack
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrConnClosing = errors.New("use of closed network connection") ErrWriteBlocking = errors.New("write packet was blocking") ErrReadBlocking = errors.New("read packet was blocking") )
Error type
Functions ¶
func Float642String ¶
Float642String convert from int to string
func Uint322ByteArray ¶
Uint322ByteArray uint32 to byte array
func Uint322String ¶
Uint322String convert from uint32 to string
Types ¶
type Config ¶
type Config struct { PacketSendChanLimit uint32 // the limit of packet send channel PacketReceiveChanLimit uint32 // the limit of packet receive channel }
Config struct
type Conn ¶
Conn exposes a set of callbacks for the various events that occur on a connection
func (*Conn) AsyncWritePacket ¶
AsyncWritePacket async writes a packet, this method will never block
func (*Conn) GetExtraData ¶
func (c *Conn) GetExtraData() interface{}
GetExtraData gets the extra data from the Conn
func (*Conn) GetRawConn ¶
GetRawConn returns the raw net.TCPConn from the Conn
func (*Conn) PutExtraData ¶
func (c *Conn) PutExtraData(data interface{})
PutExtraData puts the extra data with the Conn
type ConnCallback ¶
type ConnCallback interface { // OnConnect is called when the connection was accepted, // If the return value of false is closed OnConnect(*Conn) bool // OnMessage is called when the connection receives a packet, // If the return value of false is closed OnMessage(*Conn, Packet) bool // OnClose is called when the connection closed OnClose(*Conn) }
ConnCallback is an interface of methods that are used as callbacks on a connection
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server struct
func NewServer ¶
func NewServer(config *Config, callback ConnCallback, protocol Protocol) *Server
NewServer creates a server
Click to show internal directories.
Click to hide internal directories.