hproxy

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// XXX think about these durations
	DefaultClientIdleTimeout = 5 * time.Minute  // Reap timer for client persistence
	DefaultRequestTimeout    = 9 * time.Second  // Smaller than 12s
	DefaultPollFrequency     = 11 * time.Second // Smaller than 12s
	DefaultListenAddress     = "localhost:8545" // Default geth port
	DefaultControlAddress    = "localhost:1337" // Default control port

	RouteControlAdd    = routeControl + "/add"
	RouteControlRemove = routeControl + "/remove"
	RouteControlList   = routeControl + "/list"
)
View Source
const EthereumVersion = "2.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ClientIdleTimeout       time.Duration
	ControlAddress          string
	HVMURLs                 []string
	ListenAddress           string
	LogLevel                string
	Network                 string
	PollFrequency           time.Duration
	PrometheusListenAddress string
	PrometheusNamespace     string
	PprofListenAddress      string
	RequestTimeout          time.Duration
}

func NewDefaultConfig

func NewDefaultConfig() *Config

type EthereumProxy

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

func (EthereumProxy) Poke

func (e EthereumProxy) Poke(ctx context.Context) error

type EthereumRequest

type EthereumRequest struct {
	Version string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  []any  `json:"params,omitempty"`
	ID      any    `json:"id"`
}

EthereumRequest is a JSON-RPC request object. https://www.jsonrpc.org/specification

type EthereumResponse

type EthereumResponse struct {
	Version string          `json:"jsonrpc"`
	Result  json.RawMessage `json:"result"`
	Error   json.RawMessage `json:"error,omitempty"`
	ID      any             `json:"id"`
}

EthereumResponse is a JSON-RPC response object. https://www.jsonrpc.org/specification

func CallEthereum

func CallEthereum(ctx context.Context, c *http.Client, url, method string, params ...any) (*EthereumResponse, error)

type HVMHandler

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

type HVMState

type HVMState int
const (
	StateNew       HVMState = 0
	StateHealthy   HVMState = 1
	StateUnhealthy HVMState = 2
	StateRemoved   HVMState = 3
)

type Node

type Node struct {
	NodeURL string `json:"node_url"`
}

type NodeError

type NodeError struct {
	NodeURL string `json:"node_url"`
	Error   string `json:"error"`
}

type NodeHealth

type NodeHealth struct {
	NodeURL     string `json:"node_url"`
	Status      string `json:"status"`
	Connections int    `json:"connections"`
}

type Proxy

type Proxy interface {
	Poke(ctx context.Context) error
}

func NewEthereumProxy

func NewEthereumProxy(f func(ctx context.Context) error) Proxy

type Server

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

func NewServer

func NewServer(cfg *Config) (*Server, error)

func (*Server) Collectors

func (s *Server) Collectors() []prometheus.Collector

Collectors returns the Prometheus collectors available for the server.

func (*Server) Run

func (s *Server) Run(pctx context.Context) error

Jump to

Keyboard shortcuts

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