conn

package
v1.9.91 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tcp

type Tcp struct {
	//解协议方法
	Protocol TcpHandle
	//解包方法
	Method map[int]TcpHandle
	//连接管理
	Conns map[string]TcpEngine
}

func NewTcp

func NewTcp() *Tcp

func (*Tcp) AddProtocol

func (t *Tcp) AddProtocol(f TcpHandle)

添加协议

func (*Tcp) AddRoute

func (t *Tcp) AddRoute(cmd int, f TcpHandle)

添加锁模块路由

func (*Tcp) Start

func (t *Tcp) Start(host string, port int)

type TcpEngine

type TcpEngine struct {
	Owner  *Tcp
	Handel net.Conn
	Log    *base.Logger
	Cache  []byte
	WC     chan []byte
	Pack   interface{}
}

func (*TcpEngine) Listen

func (t *TcpEngine) Listen()

type TcpHandle

type TcpHandle func(*TcpEngine)

type Web

type Web struct {
	//运行状态
	Run bool
	//Web请求数量
	Process chan struct{}
	// contains filtered or unexported fields
}

func NewWeb

func NewWeb() *Web

func (*Web) AddRoute

func (web *Web) AddRoute(path string, r base.Handle)

func (*Web) AddService

func (web *Web) AddService(i interface{})

添加服务

func (*Web) Listen

func (web *Web) Listen(port int)

func (*Web) ServeHTTP

func (web *Web) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*Web) Wait

func (web *Web) Wait() chan struct{}

监听正在处理的进程完成

Jump to

Keyboard shortcuts

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