Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerFunc ¶
type HandlerFunc func(*Context)
type Route ¶
type Route interface {
// ID returns the uint16 message ID this route handles.
ID() uint16
// Name returns the name of the route, useful for logging.
Name() string
// Handler returns the bmux.HandlerFunc for this message.
Handler() HandlerFunc
// Status indicates whether the route is enabled.
Status() bool
// Experimental indicates if the route is experimental.
Experimental() bool
// Middleware returns middleware applied only to this route.
Middleware() []func(HandlerFunc) HandlerFunc
}
Route defines a handler for a specific message ID in the bmux protocol.
func NewRoute ¶
func NewRoute( name string, id uint16, status, experimental bool, handler HandlerFunc, middleware []func(HandlerFunc) HandlerFunc, opts ...RouteWrapper, ) Route
type RouteWrapper ¶
type Router ¶
type Router interface {
// Routes returns all registered routes in the router.
Routes() []Route
// Status indicates whether this router is currently active.
Status() bool
// Middleware returns router-level middleware applied to all routes.
// Middleware wraps the handler with additional behavior.
Middleware() []func(HandlerFunc) HandlerFunc
}
Router defines a message-based router for the bmux protocol. It maps incoming message identifiers (uint16) to handlers, supports middleware, and allows for enabling/disabling routers.
func NewRouter ¶
func NewRouter( status bool, routes []Route, middleware []func(HandlerFunc) HandlerFunc, opts ...RouterWrapper, ) Router
type RouterWrapper ¶
Click to show internal directories.
Click to hide internal directories.