initial implementation
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
35
handler.go
Normal file
35
handler.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package tcp
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/unistack-org/micro/v3/registry"
|
||||
"github.com/unistack-org/micro/v3/server"
|
||||
)
|
||||
|
||||
type Handler interface {
|
||||
Serve(net.Conn)
|
||||
}
|
||||
|
||||
type tcpHandler struct {
|
||||
opts server.HandlerOptions
|
||||
eps []*registry.Endpoint
|
||||
hd interface{}
|
||||
maxMsgSize int
|
||||
}
|
||||
|
||||
func (h *tcpHandler) Name() string {
|
||||
return "handler"
|
||||
}
|
||||
|
||||
func (h *tcpHandler) Handler() interface{} {
|
||||
return h.hd
|
||||
}
|
||||
|
||||
func (h *tcpHandler) Endpoints() []*registry.Endpoint {
|
||||
return h.eps
|
||||
}
|
||||
|
||||
func (h *tcpHandler) Options() server.HandlerOptions {
|
||||
return h.opts
|
||||
}
|
Reference in New Issue
Block a user