gconsole

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(remoteIP string, remotePort int32) *Client

func (*Client) Run

func (c *Client) Run()

func (*Client) SendMsg

func (c *Client) SendMsg(data []byte) error

SendMsg 发送消息

func (*Client) Start

func (c *Client) Start()

func (*Client) StartConsoleReader

func (c *Client) StartConsoleReader()

func (*Client) StartTcpReader

func (c *Client) StartTcpReader()

type ConnCallback

type ConnCallback func(conn *Connection)

ConnCallback 连接回调

type Connection

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

func NewConnection

func NewConnection(server *Server, conn *net.TCPConn, connID uint32) *Connection

NewConnection 创建新的链接对象

func (*Connection) RemoteAddr

func (c *Connection) RemoteAddr() net.Addr

func (*Connection) SendMsg

func (c *Connection) SendMsg(data []byte) error

SendMsg 发送消息

func (*Connection) Start

func (c *Connection) Start()

func (*Connection) StartReader

func (c *Connection) StartReader()

StartReader StartTcpReader 读消息Goroutine,用于从客户端中读取数据

func (*Connection) Stop

func (c *Connection) Stop()

type Server

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

Server 定义一个Server服务类,实现interfaces.IServer接口

func NewServer

func NewServer() *Server

func (*Server) CallOnConnStart

func (s *Server) CallOnConnStart(conn *Connection)

CallOnConnStart 调用连接OnConnStart Hook函数

func (*Server) CallOnConnStop

func (s *Server) CallOnConnStop(conn *Connection)

CallOnConnStop 调用连接OnConnStop Hook函数

func (*Server) GetRouter

func (s *Server) GetRouter() *gnet.Router

func (*Server) Run

func (s *Server) Run()

Run 运行服务器

func (*Server) SetOnConnStart

func (s *Server) SetOnConnStart(connCallback ConnCallback)

SetOnConnStart 设置服务器有新的链接Hook函数

func (*Server) SetOnConnStop

func (s *Server) SetOnConnStop(connCallback ConnCallback)

SetOnConnStop 设置服务器有链接断开Hook函数

func (*Server) Start

func (s *Server) Start()

Start 启动服务器

func (*Server) Stop

func (s *Server) Stop()

Stop 停止服务器

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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