Documentation
¶
Overview ¶
Package capture fetches external URLs into note content behind SSRF guards. It is ported and trimmed from Seam v1 internal/capture: the URL path is kept (private-IP rejection, DNS-rebinding-safe pinned dialer, port allowlist, redirect-scheme and downgrade validation, response size cap); voice transcription is dropped.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidURL = errors.New("invalid URL") ErrFetchFailed = errors.New("URL fetch failed") ErrPrivateIP = errors.New("URL points to private/loopback address") ErrUnsafeScheme = errors.New("URL scheme not allowed") ErrDisallowedPort = errors.New("URL port not allowed") )
Domain errors.
Functions ¶
This section is empty.
Types ¶
type URLContent ¶
URLContent holds the extracted content from a fetched URL.
type URLFetcher ¶
type URLFetcher struct {
// contains filtered or unexported fields
}
URLFetcher fetches and extracts readable content from URLs behind SSRF guards.
func NewURLFetcher ¶
func NewURLFetcher(allowedPorts []int) *URLFetcher
NewURLFetcher creates a URLFetcher whose transport rejects private/loopback addresses and ports outside allowedPorts (connecting only to a validated IP, so DNS rebinding cannot slip past the check) and caps redirects at 10, each hop re-validated for an HTTP(S) scheme, no https->http downgrade, and -- because every hop dials through the same transport -- a public IP on an allowed port. An empty allowedPorts means the 80/443 default, never "any port".
func (*URLFetcher) FetchURL ¶
func (f *URLFetcher) FetchURL(ctx context.Context, rawURL string) (*URLContent, error)
FetchURL fetches rawURL and extracts its title and main readable content. It rejects non-HTTP(S) schemes and empty hosts before dialing; the transport's SSRF guard rejects private addresses at connect time.