Documentation ¶
Index ¶
Constants ¶
const LoggerTag = "RPCSPLITTER"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Any ¶
type Any struct {
// contains filtered or unexported fields
}
Any stores an argument in its raw form, and it is passed to the RPC server unmodified.
func (Any) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*Any) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type Option ¶
type Option func(s *server) error
func WithEndpoints ¶
WithEndpoints options instructs RPC-Splitter to use provided list of Ethereum RPC nodes.
func WithGracefulTimeout ¶
WithGracefulTimeout sets a timeout for slower endpoints. If the RPC-Splitter gets enough responses to return a valid response, it will wait until the timeout for slower endpoints is exceeded. This will allow slower requests to be gracefully finished, and for endpoints that calculate the median value, it will return a more accurate response.
func WithRequirements ¶
WithRequirements specifies the requirements that must be met in order for responses to be considered valid.
minResponses - minimum number of same responses, ideally this number should be greater than half the number of endpoints provided. For methods that return a gas price or block number, this is the number of non-error responses.
maxBlockBehind - the maximum number of blocks after the last known block. Because some RPC endpoints may be behind others, the RPC-Splitter uses the lowest block number of all responses, but the difference from the last known cannot be less than specified in this parameter.
func WithTotalTimeout ¶
WithTotalTimeout sets the total timeout for all endpoints. When the timeout is exceeded, RPC-Splitter cancels all requests to the endpoints.
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport implements the http.RoundTripper interface. It creates a virtual host with RPC Splitter.
func NewTransport ¶
NewTransport returns a new instance of Transport.