Documentation
¶
Overview ¶
Code generated by hack/gen-logs.sh; DO NOT EDIT. This file is created and regenerated automatically. Anything added here might get removed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface {
Get(ctx context.Context, endpoint string, resp any) error
GetStatusCode(ctx context.Context, endpoint string) (int, error)
GetSSZ(ctx context.Context, endpoint string) ([]byte, http.Header, error)
Post(ctx context.Context, endpoint string, headers map[string]string, data *bytes.Buffer, resp any) error
PostSSZ(ctx context.Context, endpoint string, headers map[string]string, data *bytes.Buffer) ([]byte, http.Header, error)
Host() string
}
Handler defines the interface for making REST API requests.
type MockRestProvider ¶
type MockRestProvider struct {
MockHandler Handler
MockHosts []string
HostIndex int
ConnCounter uint64
}
MockRestProvider implements RestConnectionProvider for testing.
func (*MockRestProvider) ConnectionCounter ¶ added in v7.1.7
func (m *MockRestProvider) ConnectionCounter() uint64
func (*MockRestProvider) CurrentHost ¶
func (m *MockRestProvider) CurrentHost() string
func (*MockRestProvider) Handler ¶
func (m *MockRestProvider) Handler() Handler
func (*MockRestProvider) Hosts ¶
func (m *MockRestProvider) Hosts() []string
func (*MockRestProvider) SwitchHost ¶
func (m *MockRestProvider) SwitchHost(index int) error
type RestConnectionProvider ¶
type RestConnectionProvider interface {
// Handler returns the REST handler for making API requests.
Handler() Handler
// CurrentHost returns the current REST API endpoint URL.
CurrentHost() string
// Hosts returns all configured REST API endpoint URLs.
Hosts() []string
// SwitchHost switches to the endpoint at the given index.
SwitchHost(index int) error
// ConnectionCounter returns a monotonic counter that advances on each host
// switch, distinguishing a host0 → host1 → host0 bounce from no change.
ConnectionCounter() uint64
}
RestConnectionProvider manages HTTP client configuration for REST API with failover support. It allows switching between different beacon node REST endpoints when the current one becomes unavailable.
func NewRestConnectionProvider ¶
func NewRestConnectionProvider(endpoint string, opts ...RestConnectionProviderOption) (RestConnectionProvider, error)
NewRestConnectionProvider creates a new REST connection provider that manages HTTP client configuration. The endpoint parameter can be a comma-separated list of URLs (e.g., "http://host1:3500,http://host2:3500").
type RestConnectionProviderOption ¶
type RestConnectionProviderOption func(*restConnectionProviderConfig)
RestConnectionProviderOption is a functional option for configuring the REST connection provider.
func WithHttpHeaders ¶
func WithHttpHeaders(headers map[string][]string) RestConnectionProviderOption
WithHttpHeaders sets custom HTTP headers to include in all requests.
func WithHttpTimeout ¶
func WithHttpTimeout(timeout time.Duration) RestConnectionProviderOption
WithHttpTimeout sets the HTTP client timeout.
func WithTracing ¶
func WithTracing() RestConnectionProviderOption
WithTracing enables OpenTelemetry tracing for HTTP requests.