Documentation
¶
Index ¶
- type Server
- func (s *Server) Addr() string
- func (s *Server) DeregisterHandler(actionType types.HandlerType)
- func (s *Server) OnInitComplete(server gnet.Server) (action gnet.Action)
- func (s *Server) React(frame []byte, c gnet.Conn) (out []byte, action gnet.Action)
- func (s *Server) RegisterHandler(actionType types.HandlerType, handler UDPHandler)
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Stop() error
- func (s *Server) Tick() (delay time.Duration, action gnet.Action)
- func (s *Server) WaitStarted() <-chan struct{}
- type UDPHandler
- type UDPReadHandler
- type UDPWriteHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
*gnet.EventServer
// contains filtered or unexported fields
}
Server struct represents the UDP server using gnet
func (*Server) DeregisterHandler ¶
func (s *Server) DeregisterHandler(actionType types.HandlerType)
DeregisterHandler deregisters a handler for a specific action
func (*Server) OnInitComplete ¶
OnInitComplete is called when the server starts
func (*Server) RegisterHandler ¶
func (s *Server) RegisterHandler(actionType types.HandlerType, handler UDPHandler)
RegisterHandler registers a handler for a specific action
func (*Server) WaitStarted ¶
func (s *Server) WaitStarted() <-chan struct{}
WaitStarted returns the started channel for waiting until the server starts
type UDPHandler ¶
UDPHandler function type for UDP handlers
type UDPReadHandler ¶
type UDPReadHandler struct {
// contains filtered or unexported fields
}
UDPReadHandler struct with MDBX database passed in
func NewUDPReadHandler ¶
func NewUDPReadHandler(db db.Provider) *UDPReadHandler
NewUDPReadHandler creates a new UDPReadHandler with an MDBX database
func (*UDPReadHandler) HandleMessage ¶
func (rh *UDPReadHandler) HandleMessage(c gnet.Conn, frame []byte)
HandleMessage processes the incoming message using the UDPReadHandler
type UDPWriteHandler ¶
type UDPWriteHandler struct {
// contains filtered or unexported fields
}
UDPWriteHandler struct with MDBX database passed in
func NewUDPWriteHandler ¶
func NewUDPWriteHandler(db db.Provider, batchWriter *db.BatchWriter) *UDPWriteHandler
NewUDPWriteHandler creates a new UDPWriteHandler with an MDBX database
func (*UDPWriteHandler) HandleMessage ¶
func (wh *UDPWriteHandler) HandleMessage(c gnet.Conn, frame []byte)
HandleMessage processes the incoming message using the UDPWriteHandler