Documentation ¶
Overview ¶
Package packet provides the backbone for a UDP packet server with some opinionated defaults.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface {
HandlePacket(context.Context, []byte, net.Addr, func([]byte) error) error
}
Handler is the interface for handling packets.
type HandlerFunc ¶
HandlerFunc is the Handler func.
type Middleware ¶
Middleware for the HTTP Server.
func MiddlewareFunc ¶
func MiddlewareFunc(middlewareFunc func(next HandlerFunc) HandlerFunc) Middleware
MiddlewareFunc returns middlewareFunc as Middleware.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is an option for the stream server.
func WithMiddleware ¶
func WithMiddleware(middleware ...Middleware) Option
WithMiddleware adds middleware.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements a UDP packet server.
func (*Server) AddMiddleware ¶
func (s *Server) AddMiddleware(middleware ...Middleware)
AddMiddleware adds middleware.
func (*Server) GracefulStop ¶
GracefulStop stops the stream server gracefully.
Click to show internal directories.
Click to hide internal directories.