middle

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: GPL-3.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrUnKnownProto 未知协议
	ErrUnKnownProto = errors.New("unknown protocol")
	//ErrUnAuthorized 越权请求
	ErrUnAuthorized = errors.New("unauthorized request")
	//ErrAccidentalRelease 意外的资源释放
	ErrAccidentalRelease = errors.New("accidental release")
	//ErrHandshakeFailure 握手失败
	ErrHandshakeFailure = errors.New("Handshake failure")
)

Functions

This section is empty.

Types

type Exception

type Exception interface {
	Error(error)
	Debug(error)
}

Exception 中间异常处理接口

type KCMiddleware

type KCMiddleware interface {
	Subscribe(*net.UDPConn, *net.UDPAddr, time.Duration) (interface{}, error)
}

KCMiddleware KCP 客户端中间件

type KSMiddleware

type KSMiddleware interface {
	Exception
	Subscribe([]byte, *net.UDPConn, *net.UDPAddr) (interface{}, error)
	UnSubscribe(uint32)
	Update()
}

KSMiddleware KCP 服务端中间件

type SnkMiddleCli

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

SnkMiddleCli snk资源订阅客户端

func SpawnSnkMiddleCli

func SpawnSnkMiddleCli(p, g uint64) *SnkMiddleCli

SpawnSnkMiddleCli 创建Snk客户端中间件

func (*SnkMiddleCli) Subscribe

func (slf *SnkMiddleCli) Subscribe(c *net.UDPConn,
	a *net.UDPAddr, timeout time.Duration) (interface{}, error)

Subscribe 订阅资源

type SnkMiddleServe

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

SnkMiddleServe 服务端

func SpawnSnkMiddleServe

func SpawnSnkMiddleServe(seed int, p, g uint64, timeout time.Duration) *SnkMiddleServe

SpawnSnkMiddleServe 创建Snk服务端中间件

func (*SnkMiddleServe) Subscribe

func (slf *SnkMiddleServe) Subscribe(d []byte,
	c *net.UDPConn,
	a *net.UDPAddr) (interface{}, error)

Subscribe 订阅资源

func (*SnkMiddleServe) UnSubscribe

func (slf *SnkMiddleServe) UnSubscribe(d uint32)

UnSubscribe 取消一个订阅资源

func (*SnkMiddleServe) Update

func (slf *SnkMiddleServe) Update()

Update 维护

Jump to

Keyboard shortcuts

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