Versions in this module Expand all Collapse all v0 v0.0.12 Jan 13, 2026 Changes in this version + type Client interface + Close func() error + Ping func(ctx context.Context) error + type ClientFactory func(url string) (Client, error) + type Endpoint struct + Client Client + ExcludedAt time.Time + LastUsed time.Time + Metrics *EndpointMetrics + State EndpointState + URL string + func NewEndpoint(url string) *Endpoint + func (e *Endpoint) GetClient() Client + func (e *Endpoint) GetState() EndpointState + func (e *Endpoint) IsHealthy() bool + func (e *Endpoint) SetClient(client Client) + func (e *Endpoint) UpdateState(state EndpointState) + type EndpointInfo struct + AverageLatency float64 + FailureCount uint64 + HealthScore float64 + LastUsed time.Time + RequestCount uint64 + State string + TotalLatency int64 + URL string + type EndpointMetrics struct + AverageLatency time.Duration + ConsecutiveFailures int + FailedRequests uint64 + HealthScore float64 + LastError error + LastErrorTime time.Time + LastSuccessTime time.Time + SuccessfulRequests uint64 + TotalRequests uint64 + func (m *EndpointMetrics) GetConsecutiveFailures() int + func (m *EndpointMetrics) GetHealthScore() float64 + func (m *EndpointMetrics) GetSuccessRate() float64 + func (m *EndpointMetrics) UpdateFailure(err error, latency time.Duration) + func (m *EndpointMetrics) UpdateSuccess(latency time.Duration) + type EndpointSelector struct + func NewEndpointSelector(strategy LoadBalancingStrategy) *EndpointSelector + func (s *EndpointSelector) GetStrategy() LoadBalancingStrategy + func (s *EndpointSelector) SelectEndpoint(healthyEndpoints []*Endpoint) *Endpoint + type EndpointState int + const StateDegraded + const StateExcluded + const StateHealthy + const StateUnhealthy + func (s EndpointState) String() string + type EndpointStats struct + ChainID string + Endpoints []EndpointInfo + Strategy string + TotalEndpoints int + type EndpointStatus struct + HealthScore float64 + LastChecked time.Time + LastError string + ResponseTime int64 + State string + URL string + type HealthChecker interface + CheckHealth func(ctx context.Context, client Client) error + type HealthMonitor struct + func NewHealthMonitor(manager *Manager, config *config.RPCPoolConfig, logger zerolog.Logger) *HealthMonitor + func (h *HealthMonitor) GetHealthStatus() *HealthStatus + func (h *HealthMonitor) SetHealthChecker(checker HealthChecker) + func (h *HealthMonitor) Start(ctx context.Context, wg *sync.WaitGroup) + func (h *HealthMonitor) Stop() + type HealthStatus struct + ChainID string + DegradedCount int + Endpoints []EndpointStatus + ExcludedCount int + HealthyCount int + Strategy string + TotalEndpoints int + UnhealthyCount int + type LoadBalancingStrategy string + const StrategyRoundRobin + const StrategyWeighted + type Manager struct + HealthMonitor *HealthMonitor + func NewManager(chainID string, urls []string, poolConfig *config.RPCPoolConfig, ...) *Manager + func (m *Manager) GetConfig() *config.RPCPoolConfig + func (m *Manager) GetEndpointStats() *EndpointStats + func (m *Manager) GetEndpoints() []*Endpoint + func (m *Manager) GetHealthyEndpointCount() int + func (m *Manager) SelectEndpoint() (*Endpoint, error) + func (m *Manager) Start(ctx context.Context) error + func (m *Manager) Stop() + func (m *Manager) UpdateEndpointMetrics(endpoint *Endpoint, success bool, latency time.Duration, err error)