apt

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 21 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 the apt mirror backend: Debian and Ubuntu repositories.

The backend is built around repository metadata rather than TTL guesses. Each suite's small InRelease file lists the SHA256 and size of every Packages index, plus Codename, Suite, Components and Architectures. Indexes are stored in a content-addressed blob cache (keyed by SHA256), so healthy mirrors of the same distro share one download, and each index is parsed once into a compact lookup map.

Index

Constants

View Source
const DefaultSpeedDuration = 10 * time.Second

DefaultSpeedDuration bounds a speed-test download.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChecksumMismatchError added in v0.4.2

type ChecksumMismatchError struct {
	URL  string
	Got  string
	Want string
	Body []byte
}

ChecksumMismatchError reports an index blob whose SHA256 does not match the value published in the mirror's Release file. The downloaded Body is carried along so callers may treat it as unverified-but-usable (the mirror is likely mid-sync).

func (*ChecksumMismatchError) Error added in v0.4.2

func (e *ChecksumMismatchError) Error() string

type ConfigOption

type ConfigOption func(*Service)

ConfigOption customizes a Service at construction.

func WithDistro

func WithDistro(d Distro) ConfigOption

WithDistro sets the distro family hint.

type Distro

type Distro string

Distro identifies a distribution family for status/speed defaults and index discovery hints.

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

Distro values.

type PackageDetail

type PackageDetail struct {
	Suite     string `json:"suite"`
	Component string `json:"component"`
	Arch      string `json:"arch"`
	Filename  string `json:"filename,omitempty"`
	IndexPath string `json:"index_path,omitempty"`
}

PackageDetail is apt's PackageResult.Detail payload.

type QueryOptions

type QueryOptions struct {
	// Suite is a suite name ("noble", "bookworm-updates") or codename.
	// Empty scans all discovered suites and reports the latest codename.
	Suite     string
	Component string // "main", "universe", ... Empty = any (wave order).
	Arch      string // "amd64", "arm64", ... Empty = any arch listed.
}

QueryOptions narrows an apt package lookup.

type Service

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

Service implements core.Prober for apt repositories.

func New

func New(cfg core.Config, opts ...ConfigOption) *Service

New builds an apt Service.

func (*Service) Package

func (s *Service) Package(ctx context.Context, mirror string, q core.PackageQuery) (core.PackageResult, error)

Package implements core.Prober.

func (*Service) Resolve

func (s *Service) Resolve(ctx context.Context, mirror string, q core.PackageQuery) (core.DownloadResult, error)

Resolve implements core.Prober: return the direct .deb URL.

func (*Service) Speed

func (s *Service) Speed(ctx context.Context, mirror string, o core.SpeedOptions) (core.SpeedResult, error)

Speed measures throughput by downloading the mirror's ls-lR.gz (a large file every Debian-style mirror ships).

func (*Service) Status

func (s *Service) Status(ctx context.Context, mirror string) (core.StatusResult, error)

Status checks the mirror by probing dists/<suite>/Release paths.

Jump to

Keyboard shortcuts

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