tcp

package
v0.0.0-...-e348a8d Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncompletePacket = errors.New("incomplete packet")
	ErrTooLargePacket   = errors.New("too large packet")
)

Functions

func NewServer

func NewServer(addr string, opts ...Option) network.Server

Types

type Codec

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

func NewCodec

func NewCodec(isBigEndian bool, magic uint16, maxBodyLen uint32) *Codec

func (*Codec) Decode

func (slf *Codec) Decode(gn gnet.Conn) ([]byte, error)

func (*Codec) Encode

func (slf *Codec) Encode(data []byte) ([]byte, error)

func (*Codec) Unpack

func (slf *Codec) Unpack(buf []byte) ([]byte, error)

type Option

type Option func(*options)

func WithMaxConnNum

func WithMaxConnNum(maxConnNum int) Option

func WithMaxMsgLen

func WithMaxMsgLen(maxMsgLen uint32) Option

func WithRunMode

func WithRunMode(runMode network.RunMode) Option

Jump to

Keyboard shortcuts

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