Versions in this module Expand all Collapse all v0 v0.2.0 Feb 9, 2020 Changes in this version + var ErrClosed = errors.New("closed") + var ErrInvalidVersion = errors.New("invalid version") + var ErrNoData = errors.New("no data available to decode") + type CallFunc func(ctx context.Context, s *Session, args *Data) (ret interface{}, err error) + type Config struct + CallTimeout time.Duration + Codec codec.Codec + InitTimeout time.Duration + Log *zerolog.Logger + PrintPanicStackTraces bool + SendErrToCaller bool + func DefaultConfig() *Config + type Conn interface + AcceptStream func(context.Context) (Stream, error) + LocalAddr func() net.Addr + OpenStream func(context.Context) (Stream, error) + RemoteAddr func() net.Addr + type Data struct + Raw []byte + func (d *Data) Decode(v interface{}) error + type Error interface + Code func() int + Msg func() string + func Err(err error, msg string, code int) Error + type ErrorCode struct + Code int + func (e ErrorCode) Error() string + type Hook interface + OnCall func(s *Session, service, id string) error + OnCallCompleted func(s *Session, service, id string, err error) + OnNewSession func(s *Session, stream Stream) error + OnNewStream func(s *Session, service, id string) error + type Listener interface + Accept func() (Conn, error) + Addr func() net.Addr + type Server struct + func NewServer(ln Listener, cf *ServerConfig, h ServerHandler, hs ...Hook) *Server + func (s *Server) Listen() error + func (s *Server) Session(id string) (sn *Session) + func (s *Server) Sessions() []*Session + type ServerConfig struct + NewConnChanSize int + NewConnNumberWorkers int + NewSessionChanSize int + type ServerHandler interface + InitServer func(s *Server) + type Session struct + func NewClient(conn Conn, cf *Config, h SessionHandler, hs ...Hook) (s *Session, err error) + func (s *Session) Call(ctx context.Context, service, id string, data interface{}) (d *Data, err error) + func (s *Session) CallAsync(ctx context.Context, service, id string, data interface{}) (d *Data, err error) + func (s *Session) CallTimeout() time.Duration + func (s *Session) Codec() codec.Codec + func (s *Session) DeleteValue(k string) + func (s *Session) ID() string + func (s *Session) LocalAddr() net.Addr + func (s *Session) OpenStream(ctx context.Context, service, id string) (stream Stream, err error) + func (s *Session) RegisterCall(service, id string, f CallFunc) + func (s *Session) RegisterStream(service, id string, f StreamFunc) + func (s *Session) RemoteAddr() net.Addr + func (s *Session) SetValue(k string, v interface{}) + func (s *Session) Value(k string) (v interface{}) + type SessionHandler interface + InitSession func(s *Session) + type Stream interface + IsClosed func() bool + type StreamFunc func(s *Session, stream net.Conn)