Documentation ¶
Index ¶
- func CheckOrigin(_ *http.Request) bool
- func GetNetListener(address, certFile, keyFile string) (net.Listener, error)
- type BlackListFn
- type CheckClientFn
- type Connection
- type LoginRecord
- type PomeloComponent
- type PomeloComponentOptions
- type SimpleComponent
- type SimpleComponentOptions
- type TCPConnector
- type WebSocketConnector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlackListFn ¶
type BlackListFn func(list []string)
type CheckClientFn ¶
type Connection ¶
connCount count
func (*Connection) Add ¶
func (c *Connection) Add(info *LoginRecord)
func (*Connection) DecreaseConn ¶
func (c *Connection) DecreaseConn()
func (*Connection) IncreaseConn ¶
func (c *Connection) IncreaseConn()
func (*Connection) List ¶
func (c *Connection) List() (connCount int32, loginCount int32, loginRecords map[cherryInterfaces.UID]*LoginRecord)
func (*Connection) Remove ¶
func (c *Connection) Remove(uid cherryInterfaces.UID)
type LoginRecord ¶
type LoginRecord struct {
// contains filtered or unexported fields
}
type PomeloComponent ¶
type PomeloComponent struct { cherryInterfaces.BaseComponent PomeloComponentOptions // contains filtered or unexported fields }
func NewPomelo ¶
func NewPomelo() *PomeloComponent
func NewPomeloWithOpts ¶
func NewPomeloWithOpts(opts PomeloComponentOptions) *PomeloComponent
func (*PomeloComponent) AfterInit ¶
func (p *PomeloComponent) AfterInit()
func (*PomeloComponent) Init ¶
func (p *PomeloComponent) Init()
func (*PomeloComponent) Name ¶
func (p *PomeloComponent) Name() string
func (*PomeloComponent) Stop ¶
func (p *PomeloComponent) Stop()
type PomeloComponentOptions ¶
type PomeloComponentOptions struct { Connector cherryInterfaces.IConnector ConnectListener cherryInterfaces.IConnectListener PacketEncode cherryInterfaces.PacketEncoder PacketDecode cherryInterfaces.PacketDecoder Serializer cherryInterfaces.ISerializer SessionOnClosed cherryInterfaces.SessionListener SessionOnError cherryInterfaces.SessionListener BlackListFunc BlackListFn BlackList []string ForwardMessage bool Heartbeat int DisconnectOnTimeout bool UseDict bool UseProtobuf bool UseCrypto bool UseHostFilter bool CheckClient CheckClientFn DataCompression bool }
type SimpleComponent ¶
type SimpleComponent struct { cherryInterfaces.BaseComponent SimpleComponentOptions // contains filtered or unexported fields }
func (*SimpleComponent) AfterInit ¶
func (t *SimpleComponent) AfterInit()
func (*SimpleComponent) Init ¶
func (t *SimpleComponent) Init()
func (*SimpleComponent) Name ¶
func (t *SimpleComponent) Name() string
type SimpleComponentOptions ¶
type TCPConnector ¶
type TCPConnector struct {
// contains filtered or unexported fields
}
func NewTCPConnector ¶
func NewTCPConnector(address string) *TCPConnector
func NewTCPConnectorLTS ¶
func NewTCPConnectorLTS(address, certFile, keyFile string) *TCPConnector
func (*TCPConnector) OnConnect ¶
func (t *TCPConnector) OnConnect(listener cherryInterfaces.IConnectListener)
type WebSocketConnector ¶
type WebSocketConnector struct {
// contains filtered or unexported fields
}
func NewWSConnectorLTS ¶
func NewWSConnectorLTS(address, certFile, keyFile string) *WebSocketConnector
func NewWebSocketConnector ¶
func NewWebSocketConnector(address string) *WebSocketConnector
func (*WebSocketConnector) OnConnect ¶
func (w *WebSocketConnector) OnConnect(listener cherryInterfaces.IConnectListener)
func (*WebSocketConnector) ServeHTTP ¶
func (w *WebSocketConnector) ServeHTTP(rw http.ResponseWriter, r *http.Request)
ServerHTTP server.Handler
func (*WebSocketConnector) Start ¶
func (w *WebSocketConnector) Start()
ListenAndServe listens and serve in the specified addr
func (*WebSocketConnector) Stop ¶
func (w *WebSocketConnector) Stop()
Click to show internal directories.
Click to hide internal directories.