Versions in this module Expand all Collapse all v0 v0.2.0 Jul 2, 2026 Changes in this version type ClientConfig + Transport http.RoundTripper v0.1.0 Apr 21, 2026 Changes in this version + const BackoffExponential + const BackoffLinear + const BackoffNone + const DefaultCacheKeyPrefix + const DefaultCacheTTL + const DefaultCircuitBreakerHalfOpenRequests + const DefaultCircuitBreakerMaxFailures + const DefaultCircuitBreakerOpenTimeout + const DefaultMaxCacheFileSize + const DefaultMaxRedirects + const DefaultMaxResponseBodySize + const DefaultMemoryCacheSize + const DefaultRetryMax + const DefaultRetryMaxWait + const DefaultRetryWait + const DefaultTimeout + var ErrCacheSizeLimitExceeded = errors.New("cache: size limit exceeded") + var ErrCircuitBreakerOpen = errors.New("circuit breaker is open") + var ErrDecompressionBombDetected = errors.New("decompressed response exceeds maximum allowed size") + var ErrResponseBodyTooLarge = errors.New("response body exceeds maximum allowed size") + func BuildNamedBackoff(strategy string, initialWait, maxWait time.Duration) retryablehttp.Backoff + func BuildStatusCodeCheckRetry(statusCodes []int) retryablehttp.CheckRetry + func ValidateURLNotPrivate(rawURL string) error + type AppConfig struct + AllowPrivateIPs *bool + CacheDir string + CacheKeyPrefix string + CacheTTL string + CacheType string + CircuitBreakerHalfOpenMaxRequests int + CircuitBreakerMaxFailures int + CircuitBreakerOpenTimeout string + EnableCache *bool + EnableCircuitBreaker *bool + EnableCompression *bool + MaxCacheFileSize int64 + MaxResponseBodySize int64 + MemoryCacheSize int + RetryMax int + RetryWaitMax string + RetryWaitMin string + Timeout string + func MergeAppConfig(base, override *AppConfig) *AppConfig + type CacheStats struct + HitRate float64 + Hits uint64 + Misses uint64 + type CacheType string + const CacheTypeFilesystem + const CacheTypeMemory + type CircuitBreakerConfig struct + HalfOpenMaxRequests int + MaxFailures int + OpenTimeout time.Duration + func DefaultCircuitBreakerConfig() *CircuitBreakerConfig + type CircuitBreakerState int + const StateClosed + const StateHalfOpen + const StateOpen + type Client struct + func NewClient(config *ClientConfig) *Client + func NewClientFromAppConfig(cfg *AppConfig, logger logr.Logger) (*Client, error) + func (c *Client) CacheStats() *CacheStats + func (c *Client) CleanExpiredCache() error + func (c *Client) ClearCache() error + func (c *Client) Close() error + func (c *Client) Delete(ctx context.Context, url string) (*http.Response, error) + func (c *Client) DeleteCacheEntry(ctx context.Context, url string) error + func (c *Client) Do(req *http.Request) (*http.Response, error) + func (c *Client) Get(ctx context.Context, url string) (*http.Response, error) + func (c *Client) Post(ctx context.Context, url, contentType string, body io.Reader) (*http.Response, error) + func (c *Client) Put(ctx context.Context, url, contentType string, body io.Reader) (*http.Response, error) + func (c *Client) RetryableClient() *retryablehttp.Client + func (c *Client) StandardClient() *http.Client + func (c *Client) WarmCache(ctx context.Context, urls []string) error + type ClientConfig struct + AllowPrivateIPs bool + Backoff retryablehttp.Backoff + CacheDir string + CacheKeyPrefix string + CacheTTL time.Duration + CacheType CacheType + CheckRetry retryablehttp.CheckRetry + CircuitBreakerConfig *CircuitBreakerConfig + EnableCache bool + EnableCircuitBreaker bool + EnableCompression bool + ErrorHandler retryablehttp.ErrorHandler + Logger logr.Logger + MaxCacheFileSize int64 + MaxRedirects int + MaxResponseBodySize int64 + MemoryCacheSize int + Metrics Metrics + OnUnauthorized func(ctx context.Context) (authorizationHeader string, err error) + RequestHooks []RequestHook + ResponseHooks []ResponseHook + RetryMax int + RetryWaitMax time.Duration + RetryWaitMin time.Duration + Timeout time.Duration + func DefaultConfig() *ClientConfig + type FileCache struct + func NewFileCache(config *FileCacheConfig) (*FileCache, error) + func (fc *FileCache) CleanExpired() error + func (fc *FileCache) Clear() error + func (fc *FileCache) Close() error + func (fc *FileCache) Del(ctx context.Context, key string) error + func (fc *FileCache) Get(ctx context.Context, key string) ([]byte, error) + func (fc *FileCache) Set(ctx context.Context, key string, data []byte, _ time.Duration) error + func (fc *FileCache) Stats() (hits, misses uint64) + type FileCacheConfig struct + Dir string + FileIOTimeout time.Duration + KeyPrefix string + Logger logr.Logger + MaxSize int64 + Metrics Metrics + TTL time.Duration + type Metrics interface + DecrementConcurrentRequests func(ctx context.Context) + IncrementCacheHits func(ctx context.Context) + IncrementCacheMisses func(ctx context.Context) + IncrementConcurrentRequests func(ctx context.Context) + IncrementErrorsTotal func(ctx context.Context, method, host, pathTemplate, errorType string) + IncrementRequestsTotal func(ctx context.Context, method, host, pathTemplate string, statusCode int) + IncrementRetries func(ctx context.Context, method, host, pathTemplate string) + RecordRequestDuration func(ctx context.Context, method, host, pathTemplate string, statusCode int, ...) + RecordRequestSize func(ctx context.Context, method, host, pathTemplate string, bytes float64) + RecordResponseSize func(ctx context.Context, method, host, pathTemplate string, bytes float64) + SetCacheSizeBytes func(bytes int64) + SetCircuitBreakerState func(host string, state float64) + type NoopMetrics struct + func (NoopMetrics) DecrementConcurrentRequests(context.Context) + func (NoopMetrics) IncrementCacheHits(context.Context) + func (NoopMetrics) IncrementCacheMisses(context.Context) + func (NoopMetrics) IncrementConcurrentRequests(context.Context) + func (NoopMetrics) IncrementErrorsTotal(context.Context, string, string, string, string) + func (NoopMetrics) IncrementRequestsTotal(context.Context, string, string, string, int) + func (NoopMetrics) IncrementRetries(context.Context, string, string, string) + func (NoopMetrics) RecordRequestDuration(context.Context, string, string, string, int, time.Duration) + func (NoopMetrics) RecordRequestSize(context.Context, string, string, string, float64) + func (NoopMetrics) RecordResponseSize(context.Context, string, string, string, float64) + func (NoopMetrics) SetCacheSizeBytes(int64) + func (NoopMetrics) SetCircuitBreakerState(string, float64) + type RequestHook func(*http.Request) error + type ResponseHook func(*http.Response) error