22 lines
386 B
Go
22 lines
386 B
Go
package transport
|
|
|
|
import (
|
|
"git.wzray.com/homelab/hivemind/internal/transport/codec"
|
|
)
|
|
|
|
type Handler struct {
|
|
path string
|
|
handler func(codec.Codec, []byte) ([]byte, error)
|
|
}
|
|
|
|
func (h Handler) Path() string {
|
|
return h.path
|
|
}
|
|
|
|
func (h Handler) Handle(c codec.Codec, v []byte) ([]byte, error) {
|
|
return h.handler(c, v)
|
|
}
|
|
|
|
type Registrator interface {
|
|
Register(endpoint Handler)
|
|
}
|