gnet

package
v0.0.0-...-bc856b6 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Conn gnet.Conn
}

func (Connection) Close

func (c Connection) Close() (err error)

func (Connection) RemoteAddr

func (c Connection) RemoteAddr() string

func (Connection) Send

func (c Connection) Send(bs []byte) (n int, err error)

type GnetEasyNetPlugin

type GnetEasyNetPlugin struct {
	Conn net.Conn

	Ctx context.Context

	Config *YamlConfig

	Server *GnetServer

	Handler _interface.IEasyNet
}

func NewGnetEasyNetPlugin

func NewGnetEasyNetPlugin(ctx context.Context, iconfig _interface.IConfig, handler _interface.IEasyNet) *GnetEasyNetPlugin

func (GnetEasyNetPlugin) Run

func (g GnetEasyNetPlugin) Run() error

type GnetServer

type GnetServer struct {
	Ctx context.Context
	gnet.BuiltinEventEngine

	InputStreamMap map[string]_interface.IInputStream
	ConnectionMap  map[string]_interface.IConnection
	// contains filtered or unexported fields
}

func NewGnetServer

func NewGnetServer(ctx context.Context, config *YamlConfig, handler _interface.IEasyNet) *GnetServer

func (*GnetServer) OnBoot

func (s *GnetServer) OnBoot(eng gnet.Engine) gnet.Action

func (*GnetServer) OnClose

func (s *GnetServer) OnClose(c gnet.Conn, err error) (action gnet.Action)

func (*GnetServer) OnOpen

func (s *GnetServer) OnOpen(c gnet.Conn) (out []byte, action gnet.Action)

func (*GnetServer) OnShutdown

func (s *GnetServer) OnShutdown(eng gnet.Engine)

func (*GnetServer) OnTick

func (s *GnetServer) OnTick() (delay time.Duration, action gnet.Action)

func (*GnetServer) OnTraffic

func (s *GnetServer) OnTraffic(c gnet.Conn) gnet.Action

type YamlConfig

type YamlConfig struct {
	Protocol       string `json:"protocol" yaml:"protocol"`
	Ip             string `json:"ip" yaml:"ip"`
	Port           int32  `json:"port" yaml:"port"`
	Multicore      bool   `json:"multicore" yaml:"multicore"`
	Lockosthread   bool   `json:"lockosthread" yaml:"lockosthread"`
	ReadBufferCap  int32  `json:"readbuffercap" yaml:"readbuffercap"`
	WriteBufferCap int32  `json:"writebuffercap" yaml:"writebuffercap"`
	NumEventLoop   int32  `json:"numeventloop" yaml:"numeventloop"`
	ReusePort      bool   `json:"reuseport" yaml:"reuseport"`
	ReuseAddr      bool   `json:"reuseaddr" yaml:"reuseaddr"`
}

func (*YamlConfig) GetIp

func (n *YamlConfig) GetIp() string

func (*YamlConfig) GetLockosthread

func (n *YamlConfig) GetLockosthread() bool

func (*YamlConfig) GetMulticore

func (n *YamlConfig) GetMulticore() bool

func (*YamlConfig) GetNumEventLoop

func (n *YamlConfig) GetNumEventLoop() int32

func (*YamlConfig) GetPort

func (n *YamlConfig) GetPort() int32

func (*YamlConfig) GetProtocol

func (n *YamlConfig) GetProtocol() string

func (*YamlConfig) GetReadBufferCap

func (n *YamlConfig) GetReadBufferCap() int32

func (*YamlConfig) GetReuseAddr

func (n *YamlConfig) GetReuseAddr() bool

func (*YamlConfig) GetReusePort

func (n *YamlConfig) GetReusePort() bool

func (*YamlConfig) GetWriteBufferCap

func (n *YamlConfig) GetWriteBufferCap() int32

Jump to

Keyboard shortcuts

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