Documentation
¶
Overview ¶
Package web_fetch provides a public URL content fetcher with SSRF protection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrorCode ¶
type ErrorCode string
ErrorCode identifies the stage and class of a fetch failure.
const ( ErrorInvalidURL ErrorCode = "invalid_url" ErrorDNS ErrorCode = "dns_failed" ErrorTimeout ErrorCode = "connection_timeout" ErrorTLS ErrorCode = "tls_failed" ErrorHTTP403 ErrorCode = "http_403" ErrorHTTP429 ErrorCode = "http_429" ErrorHTTP5xx ErrorCode = "http_5xx" ErrorHTTPStatus ErrorCode = "http_status" ErrorSSRFRejected ErrorCode = "ssrf_rejected" ErrorRedirectRejected ErrorCode = "redirect_rejected" ErrorRead ErrorCode = "read_failed" ErrorHTMLParse ErrorCode = "html_parse_failed" ErrorEmptyContent ErrorCode = "empty_content" ErrorConnection ErrorCode = "connection_failed" ErrorBodyTooLarge ErrorCode = "body_too_large" ErrorUnsupportedContent ErrorCode = "unsupported_content" ErrorSnapshotExpired ErrorCode = "snapshot_expired" )
Fetch failure codes distinguish retryable network errors from permanent failures.
type FetchError ¶
FetchError carries stable, machine-readable failure details.
func (*FetchError) Error ¶
func (e *FetchError) Error() string
func (*FetchError) Unwrap ¶
func (e *FetchError) Unwrap() error
type Fetcher ¶
type Fetcher struct {
// contains filtered or unexported fields
}
Fetcher fetches and extracts public web pages through an SSRF-safe client.
func NewFetcher ¶
func NewFetcher() *Fetcher
NewFetcher creates a production fetcher with DNS and redirect SSRF guards.
func NewPipelineFetcher ¶
func NewPipelineFetcher() *Fetcher
NewPipelineFetcher creates an HTTP-only fetcher for the chat pipeline. It keeps the pre-refactor 15s timeout and does not launch Chromium.
Click to show internal directories.
Click to hide internal directories.