Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrWrongMagicNumber = errors.New("vex: wrong magic number") ErrReadSizeMismatch = errors.New("vex: read size != expected size") ErrWriteSizeMismatch = errors.New("vex: write size != expected size") )
View Source
var (
Endian = binary.BigEndian
)
Functions ¶
Types ¶
type PacketHandler ¶
type PacketHandler func(ctx context.Context, packetType PacketType, requestPacket []byte) (responsePacket []byte, err error)
PacketHandler is a handler for handling packets. You will receive a byte slice of request and should return a byte slice or error if necessary.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func NewRouter ¶
func NewRouter() *Router
NewRouter creates a router for registering some packet handlers.
func (*Router) Register ¶
func (r *Router) Register(packetType PacketType, handler PacketHandler)
Register registers a packet handler to router.
Click to show internal directories.
Click to hide internal directories.