Documentation
¶
Index ¶
Constants ¶
View Source
const ( // MAX_JSONRPC_ID max jsonrpc request/response id MAX_JSONRPC_ID = 0x7FFFFFFF // VERSION jsonrpc version VERSION = "2.0" )
View Source
const ( // Errors defined in the JSON-RPC spec. See // http://www.jsonrpc.org/specification#error_object. CodeParseError = -32700 CodeInvalidRequest = -32600 CodeMethodNotFound = -32601 CodeInvalidParams = -32602 CodeInternalError = -32603 )
View Source
const ( // DefaultMaxSleepTime max sleep interval in accept DefaultMaxSleepTime = 1 * time.Second // DefaultHTTPRspBufferSize ... DefaultHTTPRspBufferSize = 1024 // PathPrefix ... PathPrefix = byte('/') )
View Source
const ( // JSONRPC //module name JSONRPC = "jsonrpc" )
Variables ¶
View Source
var (
// Version ...
Version = "2.0"
)
Functions ¶
Types ¶
type Error ¶
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}
Error response Error
type HTTPClient ¶
type HTTPClient struct {
ID int64
// contains filtered or unexported fields
}
HTTPClient ...
func (*HTTPClient) Call ¶
func (c *HTTPClient) Call(ctx context.Context, service common.URL, req *Request, rsp interface{}) error
Call ...
func (*HTTPClient) Do ¶
Do !!The high level of complexity and the likelihood that the fasthttp client has not been extensively used in production means that you would need to expect a very large benefit to justify the adoption of fasthttp today.
func (*HTTPClient) NewRequest ¶
func (c *HTTPClient) NewRequest(service common.URL, method string, args interface{}) *Request
NewRequest ...
type HTTPOptions ¶
HTTPOptions ...
type JsonrpcExporter ¶
type JsonrpcExporter struct {
protocol.BaseExporter
}
JsonrpcExporter ...
func NewJsonrpcExporter ¶
func NewJsonrpcExporter(key string, invoker protocol.Invoker, exporterMap *sync.Map) *JsonrpcExporter
NewJsonrpcExporter ...
type JsonrpcInvoker ¶
type JsonrpcInvoker struct {
protocol.BaseInvoker
// contains filtered or unexported fields
}
JsonrpcInvoker ...
func NewJsonrpcInvoker ¶
func NewJsonrpcInvoker(url common.URL, client *HTTPClient) *JsonrpcInvoker
NewJsonrpcInvoker ...
func (*JsonrpcInvoker) Invoke ¶
func (ji *JsonrpcInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result
Invoke ...
type JsonrpcProtocol ¶
type JsonrpcProtocol struct {
protocol.BaseProtocol
// contains filtered or unexported fields
}
JsonrpcProtocol ...
type Request ¶
type Request struct {
ID int64
// contains filtered or unexported fields
}
Request ...
type ServerCodec ¶
type ServerCodec struct {
// contains filtered or unexported fields
}
ServerCodec ...
func (*ServerCodec) ReadHeader ¶
func (c *ServerCodec) ReadHeader(header map[string]string, body []byte) error
ReadHeader ...
Click to show internal directories.
Click to hide internal directories.