Documentation ¶
Overview ¶
Package proxy proxies rpc request to the best rpc node
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BodyReader ¶
type BodyReader interface { io.ReadCloser }
BodyReader is used for generating a mock of the request body that returns an error
type ErrorResponse ¶ added in v0.0.9
type ErrorResponse struct { Hashes map[string][]ErroredRPCResponse `json:"hashes"` Error string `json:"error"` // ErroredURLS returned no response at all ErroredURLS []string `json:"errored_urls"` // FailedForwards stores lower level json errors where no response could be returned at all FailedForwards map[string]string `json:"failed_forwards"` }
ErrorResponse contains error response used for debugging.
type ErroredRPCResponse ¶ added in v0.0.9
type ErroredRPCResponse struct { Raw json.RawMessage `json:"json_response"` URL string `json:"url"` }
ErroredRPCResponse contains an errored rpc response this is mostly used for debugging.
type FailedForward ¶ added in v0.0.44
type FailedForward struct { // Err is the error returned Err error // URL is the url of the error URL string }
FailedForward contains a failed forward.
type Forwarder ¶
type Forwarder struct {
// contains filtered or unexported fields
}
Forwarder creates a request forwarder.
type JSONError ¶ added in v0.0.14
type JSONError struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data,omitempty"` }
JSONError is used to hold a json error.
type JSONRPCMessage ¶ added in v0.0.14
type JSONRPCMessage struct { Version string `json:"jsonrpc,omitempty"` ID int `json:"id,omitempty"` Method string `json:"method,omitempty"` Params json.RawMessage `json:"params,omitempty"` Error *JSONError `json:"error,omitempty"` Result json.RawMessage `json:"result,omitempty"` }
JSONRPCMessage is A value of this type can a JSON-RPC request, notification, successful response or error response. Which one it is depends on the fields.
type RPCProxy ¶
type RPCProxy struct {
// contains filtered or unexported fields
}
RPCProxy proxies rpc request to the fastest endpoint. Requests fallback in cases where data is not available.
func (*RPCProxy) AcquireForwarder ¶ added in v0.0.9
AcquireForwarder allocates a forwarder and allows it to be released when not in use this allows forwarder cycling reducing GC overhead.
func (*RPCProxy) Forward ¶
Forward forwards the rpc request to the servers and makes assertions around confirmation thresholds. required confirmations can be used to override the required confirmations count.
func (*RPCProxy) ReleaseForwarder ¶ added in v0.0.9
ReleaseForwarder releases a forwarder object for reuse.