lwnet

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: MIT Imports: 7 Imported by: 1

README

lwnet

介绍

GO前摄器网络

软件架构

软件架构说明

安装教程
  1. xxxx
  2. xxxx
  3. xxxx
使用说明
  1. xxxx
  2. xxxx
  3. xxxx
参与贡献
  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request
码云特技
  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. 码云官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解码云上的优秀开源项目
  4. GVP 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
  5. 码云官方提供的使用手册 https://gitee.com/help
  6. 码云封面人物是一档用来展示码云会员风采的栏目 https://gitee.com/gitee-stars/

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection interface {
	Write(data []byte)
	AsyncWrite(data []byte)
	IsConnected() bool
	RemoteAddr() net.Addr
	SetContext(ctx interface{})
	GetContext() interface{}
	Close()
	AsyncClose()
}

type IEventHandler

type IEventHandler interface {
	OnInited()
	OnNewConnect(c Connection)
	OnNewRead(c Connection, decodeObj interface{})
	OnClose(c Connection)
}

type IFrameReadCodec

type IFrameReadCodec interface {
	CodecOneFrame([]byte) (obj interface{}, usedBytes uint64)
}

type Option

type Option func(opts *Options)

func WithEventCoroutineNum

func WithEventCoroutineNum(eventCoroutineNum int) Option

func WithFrameReadCodec

func WithFrameReadCodec(codec IFrameReadCodec) Option

type Options

type Options struct {
	WorkGoroutinesNum int
	// contains filtered or unexported fields
}

type Poller

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

func Create

func Create() (*Poller, error)

func (*Poller) AddRead

func (ep *Poller) AddRead(fd int) error

func (*Poller) AddWrite

func (ep *Poller) AddWrite(fd int) error

func (*Poller) Delete

func (ep *Poller) Delete(fd int) error

func (*Poller) ModRead

func (ep *Poller) ModRead(fd int) error

func (*Poller) ModReadWrite

func (ep *Poller) ModReadWrite(fd int) error

func (*Poller) Poll

func (ep *Poller) Poll(handler func(fd int, event int32))

func (*Poller) Trigger

func (ep *Poller) Trigger(job internal.Job) error

type Server

type Server interface {
	Start() error
	Stop() error
}

func NewServer

func NewServer(eventHandler IEventHandler, port int, opts ...Option) (obj Server, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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