http

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package http implements a Gatherer for HTTP and HTTPS sources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPGatherer

type HTTPGatherer struct {
	Client http.Client
}

HTTPGatherer gathers resources over HTTP/HTTPS.

func NewHTTPGatherer

func NewHTTPGatherer(opts ...Option) *HTTPGatherer

NewHTTPGatherer returns an HTTPGatherer with a default 30-second timeout.

func (*HTTPGatherer) Gather

func (h *HTTPGatherer) Gather(ctx context.Context, rawSource, dst string) (meta metadata.Metadata, err error)

Gather downloads a file from rawSource via HTTP and writes it to dst.

func (*HTTPGatherer) Matcher

func (h *HTTPGatherer) Matcher(uri string) bool

Matcher returns true if the URI uses an HTTP or HTTPS scheme and is not a known git host.

type HTTPMetadata

type HTTPMetadata struct {
	URI          string
	Path         string
	ResponseCode int
	Size         int64
	Timestamp    string
}

HTTPMetadata holds metadata about a gathered HTTP resource.

func (HTTPMetadata) Get

func (h HTTPMetadata) Get() interface{}

Get returns the HTTPMetadata value.

func (HTTPMetadata) GetPinnedURL

func (h HTTPMetadata) GetPinnedURL(u string) (string, error)

GetPinnedURL returns an http:: prefixed URL for the given address.

type Option added in v1.1.6

type Option func(*HTTPGatherer)

Option configures an HTTPGatherer.

func WithTransport added in v1.1.6

func WithTransport(t http.RoundTripper) Option

WithTransport sets the http.RoundTripper used by the HTTPGatherer's client.

Jump to

Keyboard shortcuts

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