cherryConnector

package
v1.1.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2021 License: MIT Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckOrigin

func CheckOrigin(_ *http.Request) bool

CheckOrigin 请求检查函数 防止跨站请求伪造 true则不检查

func GetNetListener

func GetNetListener(address, certFile, keyFile string) (net.Listener, error)

GetNetListener 证书构造 net.Listener

Types

type Component added in v1.1.0

type Component struct {
	facade.Component
	ConnectStat *ConnectStat
	// contains filtered or unexported fields
}

Component (连接器组件适用于前端节点)

func NewComponent added in v1.1.5

func NewComponent(connector facade.IConnector) *Component

func (*Component) Name added in v1.1.0

func (c *Component) Name() string

func (*Component) OnAfterInit added in v1.1.0

func (c *Component) OnAfterInit()

func (*Component) OnConnect added in v1.1.5

func (c *Component) OnConnect(listener ...facade.OnConnectListener)

func (*Component) OnStart added in v1.1.5

func (c *Component) OnStart()

func (*Component) OnStop added in v1.1.0

func (c *Component) OnStop()

type ConnectStat added in v1.1.0

type ConnectStat struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ConnectStat 连接统计

func (*ConnectStat) Add added in v1.1.0

func (c *ConnectStat) Add(info *LoginRecord)

func (*ConnectStat) ConnCount added in v1.1.0

func (c *ConnectStat) ConnCount() int64

func (*ConnectStat) DecreaseConn added in v1.1.0

func (c *ConnectStat) DecreaseConn()

func (*ConnectStat) IncreaseConn added in v1.1.0

func (c *ConnectStat) IncreaseConn()

func (*ConnectStat) LoginCount added in v1.1.0

func (c *ConnectStat) LoginCount() int64

func (*ConnectStat) LoginRecords added in v1.1.0

func (c *ConnectStat) LoginRecords() map[facade.UID]*LoginRecord

func (*ConnectStat) PrintInfo added in v1.1.0

func (c *ConnectStat) PrintInfo() string

func (*ConnectStat) Remove added in v1.1.0

func (c *ConnectStat) Remove(uid facade.UID)

type LoginRecord

type LoginRecord struct {
	// contains filtered or unexported fields
}

LoginRecord 登录记录器

type TCPConnector

type TCPConnector struct {
	// contains filtered or unexported fields
}

func NewTCP added in v1.1.0

func NewTCP(address string) *TCPConnector

func NewTCPLTS added in v1.1.0

func NewTCPLTS(address, certFile, keyFile string) *TCPConnector

func (*TCPConnector) OnConnect

func (t *TCPConnector) OnConnect(listener ...cherryFacade.OnConnectListener)

func (*TCPConnector) OnStart added in v1.1.0

func (t *TCPConnector) OnStart()

func (*TCPConnector) OnStop added in v1.1.0

func (t *TCPConnector) OnStop()

OnStop stops the connector

type WSConnector added in v1.1.0

type WSConnector struct {
	// contains filtered or unexported fields
}

func NewWS added in v1.1.0

func NewWS(address string) *WSConnector

func NewWebsocketLTS added in v1.1.0

func NewWebsocketLTS(address, certFile, keyFile string) *WSConnector

func (*WSConnector) OnConnect added in v1.1.0

func (w *WSConnector) OnConnect(listener ...cherryFacade.OnConnectListener)

func (*WSConnector) OnStart added in v1.1.0

func (w *WSConnector) OnStart()

func (*WSConnector) OnStop added in v1.1.0

func (w *WSConnector) OnStop()

func (*WSConnector) ServeHTTP added in v1.1.0

func (w *WSConnector) ServeHTTP(rw http.ResponseWriter, r *http.Request)

ServerHTTP server.Handler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL