Versions in this module Expand all Collapse all v1 v1.14.1 Aug 30, 2023 v1.0.0 Aug 30, 2023 Changes in this version + const EpollClose — darwin/amd64, linux/amd64 + const EpollRead — darwin/amd64, linux/amd64 + const EventClose + const EventIn + const EventTimeout + var ErrReadTimeout = errors.New("tcp read timeout") + var ErrServerDown = errors.New("tcp server down") — windows/amd64 + func GetLogger() logger + func SetLogger(l logger) + func TimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder) + type Conn struct + func (c *Conn) Close() + func (c *Conn) CloseRead() error + func (c *Conn) GetAddr() string + func (c *Conn) GetBuffer() *codec.Buffer + func (c *Conn) GetData() interface{} + func (c *Conn) GetFd() int + func (c *Conn) GetFd() int32 + func (c *Conn) SetData(data interface{}) + func (c *Conn) Write(bytes []byte) (int, error) + func (c *Conn) WriteWithEncoder(bytes []byte) error + type Handler interface + OnClose func(c *Conn, err error) + OnConnect func(c *Conn) + OnMessage func(c *Conn, bytes []byte) + type Option interface + func WithAcceptGNum(num int) Option + func WithDecoder(decoder codec.Decoder) Option + func WithEncoder(encoder codec.Encoder) Option + func WithIOEventQueueLen(num int) Option + func WithIOGNum(num int) Option + func WithReadBufferLen(len int) Option + func WithTimeout(timeout time.Duration) Option + type Server struct + func NewServer(address string, handler Handler, opts ...Option) (*Server, error) + func (s *Server) GetConn(addr string) (*Conn, bool) + func (s *Server) GetConn(fd int) (*Conn, bool) + func (s *Server) GetConnsNum() int64 + func (s *Server) Run() + func (s *Server) Stop()