apt

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package apt implements APT mirror internals. Use pkg.AptMirrorService instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Distro

type Distro string

Distro identifies a specific APT distribution family.

const (
	DistroAny    Distro = ""
	DistroDebian Distro = "debian"
	DistroUbuntu Distro = "ubuntu"
)

type HttpRequestError

type HttpRequestError struct {
	URL        string
	StatusCode int
	Err        error
}

HttpRequestError represents HTTP request failures.

func (*HttpRequestError) Error

func (e *HttpRequestError) Error() string

func (*HttpRequestError) Unwrap

func (e *HttpRequestError) Unwrap() error

type InvalidMirrorError

type InvalidMirrorError struct {
	URL string
	Err error
}

InvalidMirrorError is returned when a mirror is unreachable or invalid.

func (*InvalidMirrorError) Error

func (e *InvalidMirrorError) Error() string

func (*InvalidMirrorError) Unwrap

func (e *InvalidMirrorError) Unwrap() error

type JsonParseError

type JsonParseError struct {
	URL string
	Err error
}

JsonParseError is returned when JSON parsing fails.

func (*JsonParseError) Error

func (e *JsonParseError) Error() string

type Mirror

type Mirror struct {
	HttpClient       *http.Client
	CacheTTL         time.Duration
	CacheDir         string
	DisableDiskCache bool
	Distro           Distro
	// contains filtered or unexported fields
}

Mirror holds HTTP and cache state for apt index lookups.

func NewMirror

func NewMirror(httpClient *http.Client) *Mirror

NewMirror creates an apt mirror backend with the given settings.

func (*Mirror) CacheDirectory

func (m *Mirror) CacheDirectory() string

CacheDirectory returns the directory used for on-disk apt cache files.

func (*Mirror) FetchMirrorFile

func (m *Mirror) FetchMirrorFile(client *http.Client, rawURL string) (io.ReadCloser, error)

func (*Mirror) LookupPackageVersion

func (m *Mirror) LookupPackageVersion(
	repositoryURL,
	packageName string,
	search *PackageSearch,
) (*PackageLookupResult, error)

LookupPackageVersion finds the latest package version on an APT mirror. Pass a non-nil search to limit which indexes are scanned (faster on live mirrors).

type PackageLookupResult

type PackageLookupResult struct {
	PackageName string
	Version     string
	Suite       string
	Component   string
	Arch        string
	IndexPath   string
	Filename    string
}

PackageLookupResult is returned by Mirror.LookupPackageVersion.

type PackageNotFoundError

type PackageNotFoundError struct {
	Package   string
	Release   string
	Component string
	Arch      string
}

PackageNotFoundError is returned when a package does not exist in a repository.

func (*PackageNotFoundError) Error

func (e *PackageNotFoundError) Error() string

type PackageSearch

type PackageSearch struct {
	Suite     string
	Component string
	Arch      string
}

type ResponseReadError

type ResponseReadError struct {
	URL string
	Err error
}

ResponseReadError is returned when reading an HTTP response body fails.

func (*ResponseReadError) Error

func (e *ResponseReadError) Error() string

type SpeedTestError

type SpeedTestError struct {
	URL string
	Err error
}

SpeedTestError is returned when a mirror speed test fails.

func (*SpeedTestError) Error

func (e *SpeedTestError) Error() string

type TimeoutError

type TimeoutError struct {
	URL     string
	Timeout int
	Err     error
}

TimeoutError is returned when an HTTP request times out.

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

ValidationError represents invalid user input.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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