gtserver

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KeepAlivePeriod time.Duration = 3000
View Source
var MsgHeaderSize int = 2
View Source
var TcpClientRecvChanSize int = 4
View Source
var TcpClientSendChanSize int = 4
View Source
var TcpServerRecvChanSize int = 4
View Source
var TcpServerSendChanSize int = 4
View Source
var UdpClientRecvChanSize int = 4
View Source
var UdpClientSendChanSize int = 4
View Source
var UdpPacketSize int = 10240
View Source
var UdpServerRecvChanSize int = 1024
View Source
var UdpServerSendChanSize int = 1024

Functions

This section is empty.

Types

type IClient

type IClient interface {
	IConn
	Connect(addr string) error
}

type IConn

type IConn interface {
	Send([]byte)
	Close() error
	LocalAddr() string
	RemoteAddr() string
	SetDataParser(IDataParser)
	SetListener(IConnListener)
}

type IConnListener

type IConnListener interface {
	OnClose()
	OnError(int, string)
	OnPreSend([]byte)
	OnPostSend([]byte, int)
	OnRecvBusy([]byte)
	OnSendBusy([]byte)
}

type IDataParser

type IDataParser interface {
	Parse(io.Reader) error
}

type IServer

type IServer interface {
	Start(addr string, connhandler func(net.Conn)) error
	Stop() error
}

type KcpServer

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

func NewKcpServer

func NewKcpServer() *KcpServer

func (*KcpServer) Start

func (this *KcpServer) Start(addr string, connhandler func(net.Conn)) error

func (*KcpServer) Stop

func (this *KcpServer) Stop() error

type Server

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

func NewServer

func NewServer() *Server

func (*Server) Start

func (this *Server) Start(net, addr string, connhandler func(net.Conn)) error

func (*Server) Stop

func (this *Server) Stop() error

type ServerEx

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

func NewServerEx

func NewServerEx() *ServerEx

func (*ServerEx) Start

func (this *ServerEx) Start(net, ip string, startport, endport int, connhandler func(net.Conn)) error

func (*ServerEx) Stop

func (this *ServerEx) Stop() error

type TcpServer

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

func NewTcpServer

func NewTcpServer() *TcpServer

func (*TcpServer) Start

func (this *TcpServer) Start(addr string, connhandler func(net.Conn)) error

func (*TcpServer) Stop

func (this *TcpServer) Stop() error

type UdpConn

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

func (*UdpConn) Close

func (this *UdpConn) Close() error

func (*UdpConn) LocalAddr

func (this *UdpConn) LocalAddr() net.Addr

func (*UdpConn) Read

func (this *UdpConn) Read(p []byte) (n int, err error)

func (*UdpConn) RemoteAddr

func (this *UdpConn) RemoteAddr() net.Addr

func (*UdpConn) Send

func (this *UdpConn) Send(buff []byte)

func (*UdpConn) SetDataParser

func (this *UdpConn) SetDataParser(parser IDataParser)

func (*UdpConn) SetDeadline

func (this *UdpConn) SetDeadline(t time.Time) error

func (*UdpConn) SetListener

func (this *UdpConn) SetListener(listener IConnListener)

func (*UdpConn) SetReadDeadline

func (this *UdpConn) SetReadDeadline(t time.Time) error

func (*UdpConn) SetWriteDeadline

func (this *UdpConn) SetWriteDeadline(t time.Time) error

func (*UdpConn) Write

func (this *UdpConn) Write(b []byte) (n int, err error)

type UdpServer

type UdpServer struct {
	Listener udpServerListener
	Addr     string
	// contains filtered or unexported fields
}

func NewUdpServer

func NewUdpServer(addr string) *UdpServer

func (*UdpServer) Send

func (this *UdpServer) Send(buff []byte, raddr *net.UDPAddr)

func (*UdpServer) Start

func (this *UdpServer) Start() error

func (*UdpServer) Stop

func (this *UdpServer) Stop() error

type UdpServerEx

type UdpServerEx struct {
	*UdpServer
	// contains filtered or unexported fields
}

func NewUdpServerEx

func NewUdpServerEx() *UdpServerEx

func (*UdpServerEx) OnError

func (this *UdpServerEx) OnError(errcode int, msg string)

func (*UdpServerEx) OnPostSend

func (this *UdpServerEx) OnPostSend(buff []byte, raddr *net.UDPAddr, num int)

func (*UdpServerEx) OnPreSend

func (this *UdpServerEx) OnPreSend(buff []byte, raddr *net.UDPAddr)

func (*UdpServerEx) OnRecv

func (this *UdpServerEx) OnRecv(buff []byte, raddr *net.UDPAddr)

func (*UdpServerEx) OnRecvBusy

func (this *UdpServerEx) OnRecvBusy(buff []byte, raddr *net.UDPAddr)

func (*UdpServerEx) OnSendBusy

func (this *UdpServerEx) OnSendBusy(buff []byte, raddr *net.UDPAddr)

func (*UdpServerEx) OnStop

func (this *UdpServerEx) OnStop()

func (*UdpServerEx) Start

func (this *UdpServerEx) Start(addr string, connhandler func(net.Conn)) error

type WsServer

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

func NewWsServer

func NewWsServer() *WsServer

func (*WsServer) Start

func (this *WsServer) Start(addr string, connhandler func(net.Conn)) error

func (*WsServer) Stop

func (this *WsServer) Stop() error

Jump to

Keyboard shortcuts

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