Documentation
¶
Index ¶
- func NewNodeProviderProxy(config NodeProviderConfig) (*httputil.ReverseProxy, error)
- type Config
- type HealthCheckConfig
- type HealthCheckManager
- type HealthCheckManagerConfig
- type HealthChecker
- func (h *HealthChecker) BlockNumber() uint64
- func (h *HealthChecker) CheckAndSetHealth()
- func (h *HealthChecker) GasLimit() uint64
- func (h *HealthChecker) IsHealthy() bool
- func (h *HealthChecker) Name() string
- func (h *HealthChecker) Start(c context.Context)
- func (h *HealthChecker) Stop(_ context.Context) error
- type HealthCheckerConfig
- type JSONRPCResponse
- type NodeProvider
- type NodeProviderConfig
- type NodeProviderConnectionConfig
- type NodeProviderConnectionHTTPConfig
- type Proxy
- type ProxyConfig
- type ReponseWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNodeProviderProxy ¶
func NewNodeProviderProxy(config NodeProviderConfig) (*httputil.ReverseProxy, error)
Types ¶
type Config ¶
type Config struct {
Proxy ProxyConfig
Targets []NodeProviderConfig
HealthChecks HealthCheckConfig
HealthcheckManager *HealthCheckManager
}
This struct is temporary. It's about to keep the input interface clean and simple.
type HealthCheckConfig ¶
type HealthCheckManager ¶
type HealthCheckManager struct {
// contains filtered or unexported fields
}
func NewHealthCheckManager ¶
func NewHealthCheckManager(config HealthCheckManagerConfig) (*HealthCheckManager, error)
func (*HealthCheckManager) IsHealthy ¶
func (h *HealthCheckManager) IsHealthy(name string) bool
type HealthCheckManagerConfig ¶
type HealthCheckManagerConfig struct {
Targets []NodeProviderConfig
Config HealthCheckConfig
Logger *slog.Logger
}
type HealthChecker ¶
type HealthChecker struct {
// contains filtered or unexported fields
}
func NewHealthChecker ¶
func NewHealthChecker(config HealthCheckerConfig) (*HealthChecker, error)
func (*HealthChecker) BlockNumber ¶
func (h *HealthChecker) BlockNumber() uint64
func (*HealthChecker) CheckAndSetHealth ¶
func (h *HealthChecker) CheckAndSetHealth()
CheckAndSetHealth makes the following calls - `eth_blockNumber` - to get the latest block reported by the node - `eth_call` - to get the gas limit And sets the health status based on the responses.
func (*HealthChecker) GasLimit ¶
func (h *HealthChecker) GasLimit() uint64
func (*HealthChecker) IsHealthy ¶
func (h *HealthChecker) IsHealthy() bool
func (*HealthChecker) Name ¶
func (h *HealthChecker) Name() string
func (*HealthChecker) Start ¶
func (h *HealthChecker) Start(c context.Context)
type HealthCheckerConfig ¶
type HealthCheckerConfig struct {
URL string
Name string // identifier imported from RPC gateway config
Logger *slog.Logger
// How often to check health.
Interval time.Duration `yaml:"healthcheckInterval"`
// How long to wait for responses before failing
Timeout time.Duration `yaml:"healthcheckTimeout"`
// Try FailureThreshold times before marking as unhealthy
FailureThreshold uint `yaml:"healthcheckInterval"`
// Minimum consecutive successes required to mark as healthy
SuccessThreshold uint `yaml:"healthcheckInterval"`
}
type JSONRPCResponse ¶
type NodeProvider ¶
type NodeProvider struct {
Config NodeProviderConfig
Proxy *httputil.ReverseProxy
}
func NewNodeProvider ¶
func NewNodeProvider(config NodeProviderConfig) (*NodeProvider, error)
func (*NodeProvider) Name ¶
func (n *NodeProvider) Name() string
func (*NodeProvider) ServeHTTP ¶
func (n *NodeProvider) ServeHTTP(w http.ResponseWriter, r *http.Request)
type NodeProviderConfig ¶
type NodeProviderConfig struct {
Name string `yaml:"name"`
Connection NodeProviderConnectionConfig `yaml:"connection"`
}
type NodeProviderConnectionConfig ¶
type NodeProviderConnectionConfig struct {
HTTP NodeProviderConnectionHTTPConfig `yaml:"http"`
}
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func (*Proxy) HasNodeProviderFailed ¶
type ProxyConfig ¶
type ReponseWriter ¶
type ReponseWriter struct {
// contains filtered or unexported fields
}
func NewResponseWriter ¶
func NewResponseWriter() *ReponseWriter
func (*ReponseWriter) Header ¶
func (p *ReponseWriter) Header() http.Header
func (*ReponseWriter) WriteHeader ¶
func (p *ReponseWriter) WriteHeader(statusCode int)
Click to show internal directories.
Click to hide internal directories.