httpclient

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

internal/httpclient/cache.go

This file implements a simple in-memory cache for HTTP GET responses. It is intentionally small and conservative, but provides a real, effective caching layer that reduces repeated network requests.

internal/httpclient/limiter.go

This file implements simple concurrency limiting for outbound HTTP requests, both globally and per-host. It helps ensure that Aether behaves politely when accessing remote servers.

internal/httpclient/response.go

This file defines the internal HTTP response type used by Aether's HTTP client. It is deliberately small and immutable from the point of view of callers.

internal/httpclient/robots.go

This file implements robots.txt fetching and caching for the HTTP client. Robots files are fetched once per host and reused.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is Aether's internal HTTP client.

NOTE: - Consumers do NOT use this directly. - The public aether.Client wraps this and provides Fetch().

func New

func New(cfg *config.Config, logger log.Logger, unified cache.Cache) *Client

New constructs a new internal HTTP client.

This client: - uses a single http.Client for pooling - respects timeouts - sets up robots.txt cache - sets concurrency limits - initializes the composite cache (memory/file/redis)

func (*Client) Fetch

func (c *Client) Fetch(
	ctx context.Context,
	rawURL string,
	headers http.Header,
) (*Response, error)

Fetch performs a robots.txt compliant HTTP GET with: - concurrency limiting - composite caching - retry logic - transparent User-Agent injection

headers: optional additional request headers.

type Error

type Error = errors.Error

Error is Aether’s internal structured error type (re-exported).

type Response

type Response struct {
	URL        string
	StatusCode int
	Header     http.Header
	Body       []byte
	FetchedAt  time.Time
}

Response represents the result of a single HTTP GET operation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL