2020-09-03 12:21:00 +03:00
|
|
|
package tcp
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
|
2021-01-29 15:16:03 +03:00
|
|
|
"github.com/unistack-org/micro/v3/register"
|
2020-09-03 12:21:00 +03:00
|
|
|
"github.com/unistack-org/micro/v3/server"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Handler interface {
|
|
|
|
Serve(net.Conn)
|
|
|
|
}
|
|
|
|
|
|
|
|
type tcpHandler struct {
|
|
|
|
opts server.HandlerOptions
|
2021-01-29 15:16:03 +03:00
|
|
|
eps []*register.Endpoint
|
2020-09-03 12:21:00 +03:00
|
|
|
hd interface{}
|
|
|
|
maxMsgSize int
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *tcpHandler) Name() string {
|
|
|
|
return "handler"
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *tcpHandler) Handler() interface{} {
|
|
|
|
return h.hd
|
|
|
|
}
|
|
|
|
|
2021-01-29 15:16:03 +03:00
|
|
|
func (h *tcpHandler) Endpoints() []*register.Endpoint {
|
2020-09-03 12:21:00 +03:00
|
|
|
return h.eps
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *tcpHandler) Options() server.HandlerOptions {
|
|
|
|
return h.opts
|
|
|
|
}
|