You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ntool-biz/nmodbus/protocol/router.go

30 lines
545 B
Go

1 year ago
package protocol
import (
"git.noahlan.cn/noahlan/nnet/connection"
"git.noahlan.cn/noahlan/nnet/packet"
rt "git.noahlan.cn/noahlan/nnet/router"
)
type Router struct {
handler rt.Handler
}
func NewRouter(handler rt.Handler) rt.Router {
return &Router{
handler: handler,
}
}
func (r *Router) Handle(c *connection.Connection, pkg packet.IPacket) {
r.handler.Handle(c, pkg)
}
func (r *Router) Register(_ interface{}, handler rt.Handler) error {
r.handler = handler
return nil
}
func (r *Router) SetNotFoundHandler(_ rt.Handler) {
}