Versions in this module Expand all Collapse all v1 v1.0.0 Jun 1, 2021 Changes in this version + const DefaultBufferSize + const DefaultConcurrency + const DefaultFlushDelay + const DefaultPendingMessages + const DefaultRequestTimeout + var ErrCanceled = &ClientError + func NilErrorLogger(format string, args ...interface{}) + func RegisterType(x interface{}) + func SetErrorLogger(f LoggerFunc) + type AsyncResult struct + Done <-chan struct{} + Error error + Response interface{} + func (m *AsyncResult) Cancel() + type Batch struct + func (b *Batch) Add(request interface{}) *BatchResult + func (b *Batch) AddSkipResponse(request interface{}) + func (b *Batch) Call() error + func (b *Batch) CallTimeout(timeout time.Duration) error + type BatchResult struct + Done <-chan struct{} + Error error + Response interface{} + type Client struct + Addr string + Conns int + Dial DialFunc + DisableCompression bool + FlushDelay time.Duration + LogError LoggerFunc + OnConnect OnConnectFunc + PendingRequests int + RecvBufferSize int + RequestTimeout time.Duration + SendBufferSize int + Stats ConnStats + func NewTCPClient(addr string) *Client + func NewTLSClient(addr string, cfg *tls.Config) *Client + func NewUnixClient(addr string) *Client + func (c *Client) Call(request interface{}) (response interface{}, err error) + func (c *Client) CallAsync(request interface{}) (*AsyncResult, error) + func (c *Client) CallTimeout(request interface{}, timeout time.Duration) (response interface{}, err error) + func (c *Client) NewBatch() *Batch + func (c *Client) PendingRequestsCount() int + func (c *Client) Send(request interface{}) error + func (c *Client) Start() + func (c *Client) Stop() + type ClientError struct + Canceled bool + Connection bool + Overflow bool + Server bool + Timeout bool + func (e *ClientError) Error() string + type ConnStats struct + AcceptCalls uint64 + AcceptErrors uint64 + BytesRead uint64 + BytesWritten uint64 + DialCalls uint64 + DialErrors uint64 + RPCCalls uint64 + RPCTime uint64 + ReadCalls uint64 + ReadErrors uint64 + WriteCalls uint64 + WriteErrors uint64 + func (cs *ConnStats) AvgRPCBytes() (send float64, recv float64) + func (cs *ConnStats) AvgRPCCalls() (write float64, read float64) + func (cs *ConnStats) AvgRPCTime() time.Duration + func (cs *ConnStats) Reset() + func (cs *ConnStats) Snapshot() *ConnStats + type DialFunc func(addr string) (conn io.ReadWriteCloser, err error) + type Dispatcher struct + func NewDispatcher() *Dispatcher + func (d *Dispatcher) AddFunc(funcName string, f interface{}) + func (d *Dispatcher) AddService(serviceName string, service interface{}) + func (d *Dispatcher) NewFuncClient(c *Client) *DispatcherClient + func (d *Dispatcher) NewHandlerFunc() HandlerFunc + func (d *Dispatcher) NewServiceClient(serviceName string, c *Client) *DispatcherClient + type DispatcherBatch struct + func (b *DispatcherBatch) Add(funcName string, request interface{}) *BatchResult + func (b *DispatcherBatch) AddSkipResponse(funcName string, request interface{}) + func (b *DispatcherBatch) Call() error + func (b *DispatcherBatch) CallTimeout(timeout time.Duration) error + type DispatcherClient struct + func (dc *DispatcherClient) Call(funcName string, request interface{}) (response interface{}, err error) + func (dc *DispatcherClient) CallAsync(funcName string, request interface{}) (*AsyncResult, error) + func (dc *DispatcherClient) CallTimeout(funcName string, request interface{}, timeout time.Duration) (response interface{}, err error) + func (dc *DispatcherClient) NewBatch() *DispatcherBatch + func (dc *DispatcherClient) Send(funcName string, request interface{}) error + type HandlerFunc func(clientAddr string, request interface{}) (response interface{}) + type Listener interface + Accept func() (conn io.ReadWriteCloser, clientAddr string, err error) + Close func() error + Init func(addr string) error + ListenAddr func() net.Addr + type LoggerFunc func(format string, args ...interface{}) + type OnConnectFunc func(remoteAddr string, rwc io.ReadWriteCloser) (io.ReadWriteCloser, error) + type Server struct + Addr string + Concurrency int + FlushDelay time.Duration + Handler HandlerFunc + Listener Listener + LogError LoggerFunc + OnConnect OnConnectFunc + PendingResponses int + RecvBufferSize int + SendBufferSize int + Stats ConnStats + func NewTCPServer(addr string, handler HandlerFunc) *Server + func NewTLSServer(addr string, handler HandlerFunc, cfg *tls.Config) *Server + func NewUnixServer(addr string, handler HandlerFunc) *Server + func (s *Server) Serve() error + func (s *Server) Start() error + func (s *Server) Stop()