Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct { // OnConnect handles logic when a connection comes up OnConnect func(conn net.Conn) // OnRead handles logic when a connection sends a message OnRead func(conn net.Conn) error // OnClose handles logic when a connection gets closed OnClose func(conn net.Conn) // contains filtered or unexported fields }
func DefaultServer ¶
DefaultServer is a echo server with default config
func (*Server) Run ¶
func (s *Server) Run()
Run makes the server ready for accepting request. Here we use asyncIO, with the help of edge-triggered epoll, for the sake of performance. In addition, we use worker pool in order to prevent DDOS. If the server can not accept incoming request for some reasons (eg: run out of resources), we let the server cool down.
func (*Server) SetCooldownTime ¶
SetCooldownTime set cooldown time for the server
func (*Server) SetIOTimeout ¶
SetIOTimeout set io timeout for every readl/write call of connections To not set deadline, set timeout to 0
func (*Server) SetScheduleTimeout ¶
SetScheduleTimeout set schedule timeout for the server
Click to show internal directories.
Click to hide internal directories.