Documentation ¶
Index ¶
- Constants
- func Decrypt(rawData string, key []byte) (string, error)
- func Encrypt(rawData, key []byte) (string, error)
- func GenCid() string
- func GetAddrByCid(cId string) (addr string)
- func NewComet() *comet
- type Conn
- type ConnectHandler
- func (c *ConnectHandler) C(k, v interface{})
- func (c *ConnectHandler) Clear()
- func (c *ConnectHandler) D(k interface{})
- func (c *ConnectHandler) Each(fu func(k, v interface{}) bool)
- func (c *ConnectHandler) R(k interface{}) (interface{}, bool)
- func (c *ConnectHandler) Size() int64
- func (c *ConnectHandler) U(k, v interface{}) (interface{}, bool)
- type IConn
- type IEvent
- type IServer
- type TCPHandler
- func (eh *TCPHandler) GetConn(c gnet.Conn) IConn
- func (eh *TCPHandler) OnClosed(c gnet.Conn, err error) (action gnet.Action)
- func (eh *TCPHandler) OnInitComplete(server gnet.Server) (action gnet.Action)
- func (eh *TCPHandler) OnOpened(c gnet.Conn) (out []byte, action gnet.Action)
- func (eh *TCPHandler) React(frame []byte, c gnet.Conn) (out []byte, action gnet.Action)
- func (eh *TCPHandler) Release()
- func (eh *TCPHandler) Size() int64
- type WSSHandler
Constants ¶
View Source
const (
//# 对称加密key
CryptoKey = "Adba723b7fe06819"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) AsyncWrite ¶
AsyncWrite writes data to client/connection asynchronously, usually you would call it in individual goroutines instead of the event-loop goroutines.
func (*Conn) Context ¶
func (c *Conn) Context() (ctx interface{})
Context returns a user-defined context.
func (*Conn) Read ¶
Read reads all data from inbound ring-buffer and event-loop-buffer without moving "read" pointer, which means it does not evict the data from buffers actually and those data will present in buffers until the ResetBuffer method is called.
func (*Conn) RemoteAddr ¶
RemoteAddr is the connection's remote peer address.
func (*Conn) SetContext ¶
func (c *Conn) SetContext(ctx interface{})
SetContext sets a user-defined context.
type ConnectHandler ¶
连接管理
type IConn ¶
type IConn interface { // Context returns a user-defined context. Context() (ctx interface{}) // SetContext sets a user-defined context. SetContext(ctx interface{}) // LocalAddr is the connection's local socket address. LocalAddr() (addr net.Addr) // RemoteAddr is the connection's remote peer address. RemoteAddr() (addr net.Addr) // Read reads all data from inbound ring-buffer and event-loop-buffer without moving "read" pointer, which means // it does not evict the data from buffers actually and those data will present in buffers until the // ResetBuffer method is called. Read() (buf []byte) // AsyncWrite writes data to client/connection asynchronously, usually you would call it in individual goroutines // instead of the event-loop goroutines. AsyncWrite(buf []byte) error // Close closes the current connection. Close() error }
type TCPHandler ¶
type TCPHandler struct { *gnet.EventServer // contains filtered or unexported fields }
tcp event
func (*TCPHandler) OnInitComplete ¶
func (eh *TCPHandler) OnInitComplete(server gnet.Server) (action gnet.Action)
gnet 服务启动成功
type WSSHandler ¶
type WSSHandler struct { *gnet.EventServer // contains filtered or unexported fields }
wss event
Click to show internal directories.
Click to hide internal directories.