proxy

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 29 Imported by: 0

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 Forwarder

type Forwarder struct {
	// contains filtered or unexported fields
}

Forwarder creates a request forwarder.

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 NewProxy

func NewProxy(config config.Config) *RPCProxy

NewProxy creates a new rpc proxy.

func (*RPCProxy) Forward

func (r *RPCProxy) Forward(c *gin.Context, chainID uint32)

Forward forwards the rpc request to the servers and makes assertions around confirmation thresholds.

func (*RPCProxy) Run

func (r *RPCProxy) Run(ctx context.Context)

Run runs the rpc server until context cancellation.

type RPCRequest

type RPCRequest struct {
	ID     json.RawMessage   `json:"id"`
	Method string            `json:"method"`
	Params []json.RawMessage `json:"params"`
}

RPCRequest is a raw rpc request format.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL