Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetToReqCtx ¶
func SetToReqCtx(ctx *fasthttp.RequestCtx, setter func(*ReqCtx))
SetToReqCtx retrieves the ReqCtx from fasthttp.RequestCtx, applies the provided setter, and stores it back.
Types ¶
type JSONRPCError ¶
JSONRPCError json-rpc error spec struct.
type JSONRPCRequest ¶
type JSONRPCRequest struct {
Method string `json:"method"`
}
JSONRPCRequest json-rpc request spec struct with method field.
type JSONRPCResponse ¶
type JSONRPCResponse struct {
Error JSONRPCError `json:"error"`
}
JSONRPCResponse json-rpc response spec struct with error field.
func (*JSONRPCResponse) HasError ¶
func (j *JSONRPCResponse) HasError() bool
HasError return false if JSONRPCResponse Error field is empty.
type ReqCtx ¶
type ReqCtx struct {
Request []JSONRPCRequest // json-rpc request from client
Response []JSONRPCResponse // json-rpc response from node
ConnURL string // provider connection url choiced by balanacer
Balancer string // load balancing algorithm for request
Client string // login from basic auth
ChainID int64 // chainID from path
RPCName string // rpc name from config
Provider string // provider from config
Latency float64 // request latency
IsClientError bool // true if response contains user user
}
ReqCtx carries request-scoped metadata used for metrics and logging. It is progressively filled by middlewares during request handling.
func GetReqCtx ¶
func GetReqCtx(ctx *fasthttp.RequestCtx) *ReqCtx
GetReqCtx returns the ReqCtx from fasthttp.RequestCtx. If none exists, a new one is created.
func (*ReqCtx) SetToCtx ¶
func (r *ReqCtx) SetToCtx(ctx *fasthttp.RequestCtx)
SetToCtx stores the ReqCtx in the given fasthttp.RequestCtx.
Click to show internal directories.
Click to hide internal directories.