iduck

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encryptor

type Encryptor interface {
	Encode(bs []byte) []byte
	Decode(bs []byte) []byte
}

type IConnection

type IConnection interface {
	GetUuid() string
	ReadMsg()
	WriteMsg(message interface{})
	Close() error
	AfterClose(func())
	// 设置自定义数据
	SetData(interface{})
	GetData() interface{}
	// 设置节点
	SetNode(INode)
	GetNode() INode
	// 是否关闭
	IsClosed() bool
}

网络连接

type INode

type INode interface {
	AddConn(IConnection) error
	DelConn(string) error
	Serve()
	OnRawMessage([]byte) error
	OnProtocolMessage(interface{}) error
	GetAllMessage() chan []interface{}
	Destroy() error
	Complete() error
}

网络同步节点,如游戏房间节点,聊天室节点

type Processor

type Processor interface {
	SetBigEndian()
	GetBigEndian() bool
	SetEncryptor(enc Encryptor)
	OnReceivedPackage(interface{}, []byte)
	WarpMsg(interface{}) (error, []byte)
	RegisterHandler(id int, entity interface{}, handle func(args ...interface{}))
}

type Server

type Server interface {
	Run() error
	Handle(conn net.Conn)
}

Jump to

Keyboard shortcuts

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