Versions in this module Expand all Collapse all v0 v0.1.2 Mar 24, 2019 v0.1.1 Mar 9, 2019 Changes in this version + const CodeInternalError + const CodeInvalidParams + const CodeInvalidRequest + const CodeMethodNotFound + const CodeParseError + const DefaultHTTPRspBufferSize + const DefaultMaxSleepTime + const MAX_JSONRPC_ID + const PathPrefix + const VERSION + var Version = "2.0" + type CodecData struct + Args interface{} + Error string + ID int64 + Method string + type Error struct + Code int + Data interface{} + Message string + func NewError(code int, message string) *Error + func (e *Error) Error() string + type HTTPClient struct + ID int64 + func NewHTTPClient(opt *HTTPOptions) *HTTPClient + func (c *HTTPClient) Call(ctx context.Context, service registry.ServiceURL, req Request, rsp interface{}) error + func (c *HTTPClient) Do(addr, path string, httpHeader http.Header, body []byte) ([]byte, error) + func (c *HTTPClient) NewRequest(conf registry.ServiceConfig, method string, args interface{}) Request + type HTTPOptions struct + HTTPTimeout time.Duration + HandshakeTimeout time.Duration + type Handler interface + Service func() string + Version func() string + type Option func(*Options) + func ConfList(confList []registry.ServerConfig) Option + func Registry(r registry.Registry) Option + func ServiceConfList(confList []registry.ServiceConfig) Option + type Options struct + ConfList []registry.ServerConfig + Registry registry.Registry + ServiceConfList []registry.ServiceConfig + Timeout time.Duration + type Request struct + ID int64 + func (r *Request) ServiceConfig() registry.ServiceConfigIf + type Server struct + func NewServer(opts ...Option) *Server + func (s *Server) Handle(h Handler) error + func (s *Server) Options() Options + func (s *Server) Start() error + func (s *Server) Stop() + type ServerCodec struct + func (c *ServerCodec) ReadBody(x interface{}) error + func (c *ServerCodec) ReadHeader(header map[string]string, body []byte) error + func (c *ServerCodec) Write(errMsg string, x interface{}) ([]byte, error)