Versions in this module Expand all Collapse all v1 v1.0.0 Feb 1, 2026 Changes in this version + func BackoffDuration(attempt int, initial, max time.Duration, multiplier float64) time.Duration + func ExponentialBackoff(maxRetries int, initial, max time.Duration, multiplier float64) []time.Duration + func GetStatusCode(err error) int + func IsAuthError(err error) bool + func IsRateLimitError(err error) bool + func IsRetryable(err error) bool + type CircuitBreaker struct + func NewCircuitBreaker(config CircuitBreakerConfig) *CircuitBreaker + func NewDefaultCircuitBreaker() *CircuitBreaker + func (cb *CircuitBreaker) Allow() bool + func (cb *CircuitBreaker) Execute(fn func() error) error + func (cb *CircuitBreaker) OnStateChange(fn func(from, to CircuitState)) + func (cb *CircuitBreaker) RecordFailure() + func (cb *CircuitBreaker) RecordSuccess() + func (cb *CircuitBreaker) Reset() + func (cb *CircuitBreaker) State() CircuitState + func (cb *CircuitBreaker) Stats() CircuitBreakerStats + type CircuitBreakerConfig struct + FailureThreshold int + MaxConcurrent int + SuccessThreshold int + Timeout time.Duration + func DefaultCircuitBreakerConfig() CircuitBreakerConfig + type CircuitBreakerStats struct + Failures int + HalfOpenRequests int + LastFailureTime time.Time + State CircuitState + Successes int + type CircuitOpenError struct + State CircuitState + func (e *CircuitOpenError) Error() string + type CircuitState int + const Closed + const HalfOpen + const Open + func (s CircuitState) String() string + type CrawlError struct + Cause error + Message string + Operation string + Retryable bool + StatusCode int + Type ErrorType + URL string + func Categorize(err error, url string) *CrawlError + func CategorizeHTTPStatus(statusCode int, url string) *CrawlError + func NewAuthError(url string, statusCode int, message string) *CrawlError + func NewBrowserError(url, operation string, cause error) *CrawlError + func NewCancelledError(url, operation string) *CrawlError + func NewClientError(url string, statusCode int, message string) *CrawlError + func NewCrawlError(errType ErrorType, url, operation, message string, cause error) *CrawlError + func NewNetworkError(url, operation string, cause error) *CrawlError + func NewNotFoundError(url string) *CrawlError + func NewParseError(url, operation string, cause error) *CrawlError + func NewRateLimitError(url string, retryAfter int) *CrawlError + func NewScopeError(url, reason string) *CrawlError + func NewServerError(url string, statusCode int, message string) *CrawlError + func NewTimeoutError(url, operation string, cause error) *CrawlError + func (e *CrawlError) Error() string + func (e *CrawlError) Is(target error) bool + func (e *CrawlError) Unwrap() error + type ErrorType int + const Auth + const Browser + const Cancelled + const ClientError + const Network + const NotFound + const Parse + const RateLimit + const Scope + const ServerError + const Timeout + const Unknown + func GetErrorType(err error) ErrorType + func (t ErrorType) IsRetryable() bool + func (t ErrorType) String() string + type HostCircuitBreakers struct + func NewHostCircuitBreakers(config CircuitBreakerConfig) *HostCircuitBreakers + func (hcb *HostCircuitBreakers) AllStats() map[string]CircuitBreakerStats + func (hcb *HostCircuitBreakers) Get(host string) *CircuitBreaker + func (hcb *HostCircuitBreakers) Reset() + type Retrier struct + func NewDefaultRetrier() *Retrier + func NewRetrier(config RetryConfig) *Retrier + func (r *Retrier) Do(ctx context.Context, operation string, url string, fn RetryFunc) *RetryResult + type RetryConfig struct + InitialDelay time.Duration + Jitter float64 + MaxDelay time.Duration + MaxRetries int + Multiplier float64 + RetryableTypes []ErrorType + func DefaultRetryConfig() RetryConfig + type RetryFunc func(ctx context.Context) error + type RetryResult struct + Attempts int + Duration time.Duration + LastError error + Success bool + func DoWithResult[T any](ctx context.Context, r *Retrier, operation, url string, ...) (T, *RetryResult)