agent

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEchoAgent

func GetEchoAgent() core.Agent

func GetSendAgent

func GetSendAgent() core.Agent

func GetSingleAgent

func GetSingleAgent() core.Agent

Types

type EchoAgent

type EchoAgent struct {
	SingleAgent
}

EchoAgent 最简单的 Echo 代理,发什么回什么,使用单例实现(也可以和 Conn 一一对应)

func (*EchoAgent) OnMessage

func (agent *EchoAgent) OnMessage(b []byte, conn core.Conn)

type SendAgent

type SendAgent struct {
	SingleAgent
}

SendAgent 发消息代理,一连上就开始发消息

func (*SendAgent) OnConnect

func (agent *SendAgent) OnConnect(conn core.Conn)

type SingleAgent

type SingleAgent struct {
}

SingleAgent 最简单的网络代理,单例且不响应任何事件

func (*SingleAgent) OnClose

func (agent *SingleAgent) OnClose(_ core.Conn)

func (*SingleAgent) OnConnect

func (agent *SingleAgent) OnConnect(_ core.Conn)

func (*SingleAgent) OnMessage

func (agent *SingleAgent) OnMessage(_ []byte, _ core.Conn)

Jump to

Keyboard shortcuts

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