Documentation ¶
Index ¶
- Constants
- Variables
- func NewMemAreaPool() *memAreaPool
- type Agent
- type CAFile
- type Conn
- type ConnSet
- type HttpServer
- type INetMempool
- type MsgParser
- type TCPClient
- type TCPConn
- func (tcpConn *TCPConn) Close()
- func (tcpConn *TCPConn) Destroy()
- func (tcpConn *TCPConn) GetRemoteIp() string
- func (tcpConn *TCPConn) IsConnected() bool
- func (tcpConn *TCPConn) LocalAddr() net.Addr
- func (tcpConn *TCPConn) Read(b []byte) (int, error)
- func (tcpConn *TCPConn) ReadMsg() ([]byte, error)
- func (tcpConn *TCPConn) ReleaseReadMsg(byteBuff []byte)
- func (tcpConn *TCPConn) RemoteAddr() net.Addr
- func (tcpConn *TCPConn) SetReadDeadline(d time.Duration)
- func (tcpConn *TCPConn) SetWriteDeadline(d time.Duration)
- func (tcpConn *TCPConn) Write(b []byte) error
- func (tcpConn *TCPConn) WriteMsg(args ...[]byte) error
- func (tcpConn *TCPConn) WriteRawMsg(args []byte) error
- type TCPServer
- type WSClient
- type WSConn
- type WSHandler
- type WSServer
- type WebsocketConnSet
Constants ¶
View Source
const ( Default_ReadDeadline = time.Second * 30 //默认读超时30s Default_WriteDeadline = time.Second * 30 //默认写超时30s Default_MaxConnNum = 1000000 //默认最大连接数 Default_PendingWriteNum = 100000 //单连接写消息Channel容量 Default_LittleEndian = false //默认大小端 Default_MinMsgLen = 2 //最小消息长度2byte Default_LenMsgLen = 2 //包头字段长度占用2byte Default_MaxMsgLen = 65535 //最大消息长度 )
Variables ¶
View Source
var DefaultMaxHeaderBytes int = 1 << 20
Functions ¶
func NewMemAreaPool ¶
func NewMemAreaPool() *memAreaPool
Types ¶
type HttpServer ¶
type HttpServer struct {
// contains filtered or unexported fields
}
func (*HttpServer) SetCAFile ¶
func (slf *HttpServer) SetCAFile(caFile []CAFile)
func (*HttpServer) Start ¶
func (slf *HttpServer) Start()
type INetMempool ¶
type MsgParser ¶
type MsgParser struct { LenMsgLen int MinMsgLen uint32 MaxMsgLen uint32 LittleEndian bool INetMempool }
-------------- | len | data | --------------
type TCPClient ¶
type TCPClient struct { sync.Mutex Addr string ConnNum int ConnectInterval time.Duration PendingWriteNum int ReadDeadline time.Duration WriteDeadline time.Duration AutoReconnect bool NewAgent func(*TCPConn) Agent // msg parser MsgParser // contains filtered or unexported fields }
func (*TCPClient) GetCloseFlag ¶ added in v1.19.0
type TCPConn ¶
func (*TCPConn) GetRemoteIp ¶
func (*TCPConn) IsConnected ¶
func (*TCPConn) ReleaseReadMsg ¶
func (*TCPConn) RemoteAddr ¶
func (*TCPConn) SetReadDeadline ¶
func (*TCPConn) SetWriteDeadline ¶
func (*TCPConn) WriteRawMsg ¶
type TCPServer ¶
type TCPServer struct { Addr string MaxConnNum int PendingWriteNum int ReadDeadline time.Duration WriteDeadline time.Duration NewAgent func(*TCPConn) Agent MsgParser // contains filtered or unexported fields }
func (*TCPServer) GetNetMempool ¶
func (server *TCPServer) GetNetMempool() INetMempool
func (*TCPServer) SetNetMempool ¶
func (server *TCPServer) SetNetMempool(mempool INetMempool)
type WSClient ¶
type WSConn ¶
func (*WSConn) RemoteAddr ¶
type WSHandler ¶
type WSHandler struct {
// contains filtered or unexported fields
}
func (*WSHandler) ServeHTTP ¶
func (handler *WSHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*WSHandler) SetMessageType ¶ added in v1.17.5
type WSServer ¶
type WSServer struct { Addr string MaxConnNum int PendingWriteNum int MaxMsgLen uint32 HTTPTimeout time.Duration CertFile string KeyFile string NewAgent func(*WSConn) Agent // contains filtered or unexported fields }
func (*WSServer) SetMessageType ¶ added in v1.17.5
type WebsocketConnSet ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.