source

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package source fetches, unpacks and detects install media referenced by a local path or an http(s) URL, presenting each as a read-only io/fs.FS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SafeURL

func SafeURL(rawURL string) string

SafeURL strips a URL's userinfo, query, and fragment - any of which can carry a credential - so it is safe to log, record, or fold into an error. An unparseable URL returns a placeholder rather than being echoed back.

Types

type Credential

type Credential struct {
	Host, Username, Password string
}

Credential is HTTP Basic auth for one host, scoped to https requests only.

type Credentials

type Credentials []Credential

Credentials is a set of host-matched credentials, tried in order.

type Options

type Options struct {
	CacheDir    string
	Credentials Credentials
	Client      *http.Client
}

Options configures a Resolver: where fetched archives are cached, the credentials offered to https hosts, and the HTTP client to fetch with (http.DefaultClient when nil).

type Resolver

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

Resolver turns a source reference - a local path or an http(s) URL - into a vfs.Resolved: the read-only filesystem it serves, whether that is an EFS image or an extracted directory, and the closer that frees it. It satisfies vfs.Resolver.

func New

func New(opts Options) *Resolver

New returns a Resolver. The range reader and grab share one derived client that adds a CheckRedirect stripping credentials on unsafe redirects and, when the caller gave no transport, a response-header timeout.

func (*Resolver) Resolve

func (r *Resolver) Resolve(ref string) (vfs.Resolved, error)

Resolve turns ref - a local path or an http(s) URL - into a read-only filesystem. An archive is fetched whole and extracted; a raw image is read lazily by byte-range, buffered whole only if the server ignores ranges.

Jump to

Keyboard shortcuts

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