Versions in this module Expand all Collapse all v0 v0.1.0 Jan 6, 2021 Changes in this version + const BodyBegin + const BodyEnd + const BodyJson + const BodyProtobuf + var DefaultDialTimeout = time.Second * 10 + var DefaultRegister = NewTransportRegister() + var DefaultServeTimeout = time.Second * 20 + type DialOption func(*DialOptions) + func WithStream() DialOption + func WithTimeout(d time.Duration) DialOption + type DialOptions struct + Context context.Context + Stream bool + Timeout time.Duration + type ListenOption func(*ListenOptions) + type ListenOptions struct + Context context.Context + type Listener interface + Accept func(context.Context, TransportHandler) error + Addr func() string + Close func() error + type Message struct + Body interface{} + Name string + type MessageFunc func(context.Context, Socket, *Message) error + type MessageHandler struct + Fn MessageFunc + Name string + RType reflect.Type + type Option func(*Options) + func Addrs(addrs ...string) Option + func Codec(c codec.Marshaler) Option + func Secure(b bool) Option + func TLSConfig(t *tls.Config) Option + func Timeout(t time.Duration) Option + type Options struct + Addrs []string + Codec codec.Marshaler + Context context.Context + Secure bool + TLSConfig *tls.Config + Timeout time.Duration + type Register interface + GetHandler func(uint32) (*MessageHandler, error) + RegisterJsonMessage func(codec.JsonCodec, MessageFunc) error + RegisterProtobufMessage func(proto.Message, MessageFunc) error + func NewTransportRegister() Register + type Socket interface + AddEvictedHandle func(func(Socket)) + Close func() error + IsClosed func() bool + Local func() string + Recv func(Register) (*Message, *MessageHandler, error) + Remote func() string + Send func(*Message) error + type SocketCloseHandler func() + type Transport interface + Dial func(addr string, opts ...DialOption) (Socket, error) + Init func(...Option) error + ListenAndServe func(ctx context.Context, addr string, handler TransportHandler, ...) error + Options func() Options + Protocol func() string + func NewTransport(proto string) Transport + type TransportHandler func(context.Context, Socket, SocketCloseHandler)