2020-09-03 12:21:00 +03:00
|
|
|
package tcp
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
|
2021-10-27 01:04:58 +03:00
|
|
|
"go.unistack.org/micro/v3/register"
|
|
|
|
"go.unistack.org/micro/v3/server"
|
2020-09-03 12:21:00 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
type Handler interface {
|
|
|
|
Serve(net.Conn)
|
|
|
|
}
|
|
|
|
|
|
|
|
type tcpHandler struct {
|
|
|
|
opts server.HandlerOptions
|
|
|
|
hd interface{}
|
2021-04-26 01:10:37 +03:00
|
|
|
eps []*register.Endpoint
|
2020-09-03 12:21:00 +03:00
|
|
|
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
|
|
|
|
}
|