network

package
v0.0.0-...-31a40c9 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	Run()
	OnClose()
	Close()
}

type Conn

type Conn interface {
	ReadMsg(recvBuffer []byte) (int, error)
	WriteMsg(args ...[]byte) error
	UnreliableWriteMsg(args ...[]byte) error
	LocalAddr() net.Addr
	RemoteAddr() net.Addr
	Close()
	Destroy()
}

type ConnSet

type ConnSet map[net.Conn]struct{}

type KCPConn

type KCPConn struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*KCPConn) Close

func (kcpConn *KCPConn) Close()

func (*KCPConn) Destroy

func (kcpConn *KCPConn) Destroy()

func (*KCPConn) LocalAddr

func (kcpConn *KCPConn) LocalAddr() net.Addr

func (*KCPConn) ReadMsg

func (kcpConn *KCPConn) ReadMsg(b []byte) (int, error)

func (*KCPConn) RemoteAddr

func (kcpConn *KCPConn) RemoteAddr() net.Addr

func (*KCPConn) UnreliableWriteMsg

func (kcpConn *KCPConn) UnreliableWriteMsg(args ...[]byte) error

func (*KCPConn) Write

func (kcpConn *KCPConn) Write(b []byte)

b must not be modified by the others goroutines

func (*KCPConn) WriteMsg

func (kcpConn *KCPConn) WriteMsg(args ...[]byte) error

type KCPServer

type KCPServer struct {
	Addr            string
	MaxConnNum      int
	PendingWriteNum int
	NewAgent        func(*KCPConn) Agent

	// msg parser
	LenMsgLen    int
	MinMsgLen    uint32
	MaxMsgLen    uint32
	LittleEndian bool
	// contains filtered or unexported fields
}

func (*KCPServer) Close

func (server *KCPServer) Close()

func (*KCPServer) Start

func (server *KCPServer) Start()

type Processor

type Processor interface {
	// must goroutine safe
	Route(msg interface{}, userData interface{}) error
	// must goroutine safe
	Unmarshal(data []byte) (interface{}, error)
	// must goroutine safe
	Marshal(msg interface{}) ([][]byte, error)
}

type UDPAgentSet

type UDPAgentSet map[Agent]struct{}

type UDPConn

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

func (*UDPConn) Close

func (udpConn *UDPConn) Close()

func (*UDPConn) Destroy

func (udpConn *UDPConn) Destroy()

func (*UDPConn) LocalAddr

func (udpConn *UDPConn) LocalAddr() net.Addr

func (*UDPConn) ReadMsg

func (udpConn *UDPConn) ReadMsg(recvBuffer []byte) (int, error)

func (*UDPConn) RemoteAddr

func (udpConn *UDPConn) RemoteAddr() net.Addr

func (*UDPConn) UnreliableWriteMsg

func (udpConn *UDPConn) UnreliableWriteMsg(args ...[]byte) error

func (*UDPConn) WriteMsg

func (udpConn *UDPConn) WriteMsg(args ...[]byte) error

type UDPServer

type UDPServer struct {
	Addr       string
	MaxConnNum int
	NewAgent   func(*UDPConn) Agent

	MaxMsgLen uint32
	// contains filtered or unexported fields
}

func (*UDPServer) Close

func (server *UDPServer) Close()

func (*UDPServer) Start

func (server *UDPServer) Start()

type UDPSessionSet

type UDPSessionSet map[*rudpsession.Session]struct{}

Directories

Path Synopsis
Package kcp - A Fast and Reliable ARQ Protocol
Package kcp - A Fast and Reliable ARQ Protocol

Jump to

Keyboard shortcuts

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