chainproxy

package
v5.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 22 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	LavaErrorCode       = 555
	InternalErrorString = "Internal Error"
)
View Source
const (
	ParallelConnectionsFlag                    = "parallel-connections"
	GRPCUseTls                                 = "use-tls"
	GRPCAllowInsecureConnection                = "allow-insecure-connection"
	MaximumNumberOfParallelConnectionsAttempts = 10
	MaxCallRecvMsgSize                         = 1024 * 1024 * 512 // setting receive size to 512mb for large debug responses
)

Variables

View Source
var NumberOfParallelConnections uint = 10

Functions

func DefaultParsableRPCInput

func DefaultParsableRPCInput(input json.RawMessage) parser.RPCInput

func HashURL

func HashURL(url string) string

Types

type BaseMessage

type BaseMessage struct {
	Headers                 []pairingtypes.Metadata
	LatestBlockHeaderSetter *spectypes.ParseDirective
	// contains filtered or unexported fields
}

func (*BaseMessage) AppendHeader

func (bm *BaseMessage) AppendHeader(metadata []pairingtypes.Metadata)

appends only headers that do not exist

func (*BaseMessage) DisableErrorHandling

func (bm *BaseMessage) DisableErrorHandling()

func (*BaseMessage) GetDisableErrorHandling

func (bm *BaseMessage) GetDisableErrorHandling() bool

func (BaseMessage) GetHeaders

func (bm BaseMessage) GetHeaders() []pairingtypes.Metadata

func (*BaseMessage) SetLatestBlockWithHeader

func (bm *BaseMessage) SetLatestBlockWithHeader(latestBlock uint64, modifyContent bool) (done bool)

type Connector

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

Connector manages HTTP/JSON-RPC connections to blockchain nodes. For HTTP connections, a single shared rpcclient.Client is used since http.Client is goroutine-safe and handles connection pooling internally. This design eliminates lock contention and maximizes connection reuse.

func NewConnector

func NewConnector(ctx context.Context, nConns uint, nodeUrl common.NodeUrl) (*Connector, error)

NewConnector creates a new HTTP/JSON-RPC connector. Note: The nConns parameter is ignored for HTTP connections since a single shared client is used (http.Client is goroutine-safe and handles connection pooling internally). The parameter is kept for API compatibility with gRPC connector which still uses connection pooling.

func (*Connector) Close

func (connector *Connector) Close()

Close closes the connector and its underlying client.

func (*Connector) GetRpc

func (connector *Connector) GetRpc(ctx context.Context, block bool) (*rpcclient.Client, error)

GetRpc returns the shared RPC client. The client is goroutine-safe and handles connection pooling internally, so no locking or pool management is needed. The 'block' parameter is kept for API compatibility but is not used.

func (*Connector) GetUrlHash

func (connector *Connector) GetUrlHash() string

getting hashed url from connection. this is never changed. so its not locked.

func (*Connector) ReturnRpc

func (connector *Connector) ReturnRpc(rpc *rpcclient.Client)

ReturnRpc is a no-op for HTTP connections. The shared client is goroutine-safe and doesn't need to be "returned". This method exists for API compatibility.

type CustomParsingMessage

type CustomParsingMessage interface {
	NewParsableRPCInput(input json.RawMessage) (parser.RPCInput, error)
}

type DefaultRPCInput

type DefaultRPCInput struct {
	Result json.RawMessage
	BaseMessage
}

func (DefaultRPCInput) GetError

func (dri DefaultRPCInput) GetError() *rpcclient.JsonError

func (DefaultRPCInput) GetID

func (dri DefaultRPCInput) GetID() json.RawMessage

func (DefaultRPCInput) GetMethod

func (dri DefaultRPCInput) GetMethod() string

func (DefaultRPCInput) GetParams

func (dri DefaultRPCInput) GetParams() interface{}

func (DefaultRPCInput) GetResult

func (dri DefaultRPCInput) GetResult() json.RawMessage

func (DefaultRPCInput) ParseBlock

func (dri DefaultRPCInput) ParseBlock(inp string) (int64, error)

type GRPCConnector

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

func NewGRPCConnector

func NewGRPCConnector(ctx context.Context, nConns uint, nodeUrl common.NodeUrl) (*GRPCConnector, error)

func (*GRPCConnector) Close

func (connector *GRPCConnector) Close()

func (*GRPCConnector) GetRpc

func (connector *GRPCConnector) GetRpc(ctx context.Context, block bool) (*grpc.ClientConn, error)

func (*GRPCConnector) ReturnRpc

func (connector *GRPCConnector) ReturnRpc(rpc *grpc.ClientConn)

Directories

Path Synopsis
package rpcclient implements bi-directional JSON-RPC 2.0 on multiple transports.
package rpcclient implements bi-directional JSON-RPC 2.0 on multiple transports.

Jump to

Keyboard shortcuts

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