pkg

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: 15 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AptCheckPackageData

type AptCheckPackageData struct {
	Exists       bool     `json:"exists"`
	PackageName  string   `json:"package_name"`
	Version      string   `json:"version,omitempty"`
	Release      string   `json:"release,omitempty"`
	Component    string   `json:"component,omitempty"`
	Arch         string   `json:"arch,omitempty"`
	CheckedPaths []string `json:"checked_paths"`
	FoundPath    string   `json:"found_path,omitempty"`
}

type AptCheckPackageParams

type AptCheckPackageParams struct {
	Release   string `validate:"omitempty,oneof=stable oldstable testing focal jammy noble bionic buster bullseye bookworm trixie"`
	Component string `validate:"omitempty,oneof=main universe contrib non-free non-free-firmware restricted multiverse"`
	Arch      string `validate:"omitempty,oneof=amd64 arm64 i386 armhf ppc64el s390x"`
}

type AptCheckSpeedData

type AptCheckSpeedData struct {
	SpeedMBps       float64 `json:"speed_mbps"`
	DownloadedMB    float64 `json:"downloaded_mb"`
	DurationSec     float64 `json:"duration_sec"`
	TestURL         string  `json:"test_url"`
	BytesDownloaded int64   `json:"bytes_downloaded"`
	TargetBytes     int64   `json:"target_bytes"`
	ContentLength   int64   `json:"content_length"`
	TimeoutSec      int     `json:"timeout_sec"`
	SpeedRating     string  `json:"speed_rating"`
	Message         string  `json:"message"`
}

type AptCheckStatusData

type AptCheckStatusData struct {
	Success     bool     `json:"success"`
	TestedPaths []string `json:"tested_paths"`
	WorkingPath string   `json:"working_path,omitempty"`
	StatusCode  int      `json:"status_code,omitempty"`
	Message     string   `json:"message,omitempty"`
}

type AptDebianMirrorService

type AptDebianMirrorService = AptMirrorService

type AptMirrorService

type AptMirrorService struct {
	HttpClient *http.Client
	// CacheTTL controls apt package/index caching (memory + disk). Zero uses apt default.
	CacheTTL time.Duration
	// CacheDir overrides the on-disk cache location. Empty uses the OS app cache dir
	// (os.UserCacheDir()/mirava-core/apt, e.g. ~/Library/Caches/mirava-core/apt on macOS).
	CacheDir string
	// DisableDiskCache turns off persistent cache (tests only).
	DisableDiskCache bool
	// Distro specifies the distribution family (Debian, Ubuntu, or generic).
	Distro apt.Distro
	// contains filtered or unexported fields
}

func NewAptDebianMirrorService

func NewAptDebianMirrorService() *AptMirrorService

func NewAptMirrorService

func NewAptMirrorService() *AptMirrorService

func NewAptUbuntuMirrorService

func NewAptUbuntuMirrorService() *AptMirrorService

func (*AptMirrorService) CacheDirectory

func (m *AptMirrorService) CacheDirectory() string

func (*AptMirrorService) CheckPackage

func (m *AptMirrorService) CheckPackage(mirrorURL, packageName string, verbose bool, params AptCheckPackageParams) (bool, *AptCheckPackageData, error)

func (*AptMirrorService) CheckSpeed

func (m *AptMirrorService) CheckSpeed(mirrorURL string, timeout int, verbose bool) (float64, *AptCheckSpeedData, error)

func (*AptMirrorService) CheckStatus

func (m *AptMirrorService) CheckStatus(mirrorURL string, verbose bool) (bool, *AptCheckStatusData, error)

type AptUbuntuMirrorService

type AptUbuntuMirrorService = AptMirrorService

type CargoCheckPackageData

type CargoCheckPackageData struct {
	Version       string
	VersionsCount int
	AllVersions   []string
}

type CargoCheckSpeedData

type CargoCheckSpeedData struct {
	DownloadMb      float64
	DurationSec     float64
	ContentLength   int64
	TimeoutSec      int
	SpeedMbps       float64
	SpeedRating     string
	BytesDownloaded int64
	Crate           string
}

type CargoCheckStatusData

type CargoCheckStatusData struct {
	Status     bool
	TestPath   string
	StatusCode int
}

type CargoMirrorService

type CargoMirrorService struct {
	HttpClient *http.Client
}

func NewCargoMirrorService

func NewCargoMirrorService() *CargoMirrorService

NewCargoMirrorService creates a new Cargo sparse index mirror service instance.

func (*CargoMirrorService) CheckPackage

func (m *CargoMirrorService) CheckPackage(
	mirrorURL,
	crateName string,
	verbose bool,
) (bool, *CargoCheckPackageData, error)

CheckPackage checks if a crate exists on a Cargo sparse HTTP index mirror.

func (*CargoMirrorService) CheckSpeed

func (m *CargoMirrorService) CheckSpeed(
	mirrorURL string,
	timeout int,
	verbose bool,
	packageName *string,
) (float64, *CargoCheckSpeedData, error)

func (*CargoMirrorService) CheckStatus

func (m *CargoMirrorService) CheckStatus(
	url string,
	verbose bool,
) (bool, *CargoCheckStatusData, error)

type ComposerAuthor

type ComposerAuthor struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	Homepage string `json:"homepage"`
	Role     string `json:"role"`
}

type ComposerCheckPackageData

type ComposerCheckPackageData struct {
	Package     string
	Version     string
	Description string
	Type        string
	License     []string
	Homepage    string
	Time        string
	Authors     []ComposerAuthor
	Require     map[string]string
	RequireDev  map[string]string
	Downloads   *ComposerDownloads
	Abandoned   bool
	AbandonedBy string
}

type ComposerCheckSpeedData

type ComposerCheckSpeedData struct {
	DownloadMb      float64
	DurationSec     float64
	TimeoutSec      int
	SpeedMBps       float64
	SpeedRating     string
	BytesDownloaded int64
	ContentLength   int64
	Package         string
	Version         string
	MirrorURL       string
	TestURL         string
}

type ComposerCheckSpeedParams

type ComposerCheckSpeedParams struct {
	Package string // Package to test speed with (e.g., "laravel/framework")
	Version string // Specific version, empty for latest
}

type ComposerCheckStatusData

type ComposerCheckStatusData struct {
	Status       bool
	PackagesURL  string
	ProvidersURL string
	StatusCode   int
}

type ComposerDownloads

type ComposerDownloads struct {
	Total   int `json:"total"`
	Monthly int `json:"monthly"`
	Daily   int `json:"daily"`
}

type ComposerMirrorService

type ComposerMirrorService struct {
	HttpClient *http.Client
}

func NewComposerMirrorService

func NewComposerMirrorService() *ComposerMirrorService

NewComposerMirrorService creates a new Composer mirror service instance

func (*ComposerMirrorService) CheckPackage

func (m *ComposerMirrorService) CheckPackage(
	mirrorURL string,
	packageName string,
	verbose bool,
) (bool, *ComposerCheckPackageData, error)

func (*ComposerMirrorService) CheckSpeed

func (m *ComposerMirrorService) CheckSpeed(
	mirrorURL string,
	timeout int,
	verbose bool,
	params ComposerCheckSpeedParams,
) (float64, *ComposerCheckSpeedData, error)

func (*ComposerMirrorService) CheckStatus

func (m *ComposerMirrorService) CheckStatus(
	url string,
	verbose bool,
) (bool, *ComposerCheckStatusData, error)

type ConfigDescriptor

type ConfigDescriptor struct {
	MediaType string `json:"mediaType"`
	Size      int64  `json:"size"`
	Digest    string `json:"digest"`
}

type DigestManifest

type DigestManifest struct {
	SchemaVersion int               `json:"schemaVersion"`
	MediaType     string            `json:"mediaType"`
	Config        ConfigDescriptor  `json:"config"`
	Layers        []LayerDescriptor `json:"layers"`
}

type DockerCheckSpeedData

type DockerCheckSpeedData struct {
	DownloadMb      float64
	DurationSec     float64
	TimeoutSec      int
	LayerDigest     string
	LayerSize       float64
	Image           string
	SpeedMbps       float64
	SpeedRating     string
	BytesDownloaded int64
	ContentLength   int64
}

type DockerCheckStatusData

type DockerCheckStatusData struct {
	Status     string
	ApiVersion string
	Tags       string
	Url        string
}

type DockerImageData

type DockerImageData struct {
	ImageName string
	Tags      []string
	TotalTags int
}

type DockerMirrorService

type DockerMirrorService struct {
	HttpClient *http.Client
}

func NewDockerMirrorService

func NewDockerMirrorService() *DockerMirrorService

func (*DockerMirrorService) CheckPackage

func (m *DockerMirrorService) CheckPackage(
	mirrorUrl,
	imageName string,
) (bool, *DockerImageData, error)

func (*DockerMirrorService) CheckSpeed

func (m *DockerMirrorService) CheckSpeed(
	mirrorURL string,
	timeout int,
	verbose bool,
	imgName *string,
) (float64, *DockerCheckSpeedData, error)

func (*DockerMirrorService) CheckStatus

func (m *DockerMirrorService) CheckStatus(
	url string,
) (bool, *DockerCheckStatusData, error)

type DockerSpeedParams

type DockerSpeedParams struct {
	ImageName string
}

type GoCheckPackageData

type GoCheckPackageData struct {
	Module   string
	Version  string
	Info     *GoModuleInfo
	Versions []string
	Latest   string
	IsCached bool
}

type GoCheckSpeedData

type GoCheckSpeedData struct {
	DownloadMb      float64
	DurationSec     float64
	TimeoutSec      int
	SpeedMBps       float64
	SpeedRating     string
	BytesDownloaded int64
	ContentLength   int64
	Module          string
	Version         string
	ProxyURL        string
}

type GoCheckSpeedParams

type GoCheckSpeedParams struct {
	Module  string // Module to test speed with (e.g., "github.com/gorilla/mux")
	Version string // Specific version, empty for latest
}

type GoCheckStatusData

type GoCheckStatusData struct {
	Status       bool
	ProxyVersion string
	Ready        bool
	TestPath     string
}

type GoMirrorService

type GoMirrorService struct {
	HttpClient *http.Client
}

func NewGoMirrorService

func NewGoMirrorService() *GoMirrorService

NewGoMirrorService creates a new Go module proxy service instance

func (*GoMirrorService) CheckPackage

func (m *GoMirrorService) CheckPackage(
	mirrorURL string,
	packageName string,
	verbose bool,
) (bool, *GoCheckPackageData, error)

func (*GoMirrorService) CheckSpeed

func (m *GoMirrorService) CheckSpeed(
	mirrorURL string,
	timeout int,
	verbose bool,
	params GoCheckSpeedParams,
) (float64, *GoCheckSpeedData, error)

func (*GoMirrorService) CheckStatus

func (m *GoMirrorService) CheckStatus(
	url string,
	verbose bool,
) (bool, *GoCheckStatusData, error)

type GoModuleInfo

type GoModuleInfo struct {
	Version string `json:"Version"`
	Time    string `json:"Time"`
	Origin  *struct {
		VCS  string `json:"vcs"`
		URL  string `json:"url"`
		Hash string `json:"hash"`
	} `json:"Origin,omitempty"`
}

GoModuleInfo represents the module information from GOPROXY

type HttpRequestError

type HttpRequestError = apt.HttpRequestError

type InvalidMirrorError

type InvalidMirrorError = apt.InvalidMirrorError

type JsonParseError

type JsonParseError = apt.JsonParseError

type LayerDescriptor

type LayerDescriptor struct {
	MediaType string `json:"mediaType"`
	Size      int64  `json:"size"`
	Digest    string `json:"digest"`
}

type Manifest

type Manifest struct {
	Digest    string   `json:"digest"`
	MediaType string   `json:"mediaType"`
	Size      int64    `json:"size"`
	Platform  Platform `json:"platform"`
}

type ManifestList

type ManifestList struct {
	SchemaVersion int        `json:"schemaVersion"`
	MediaType     string     `json:"mediaType"`
	Manifests     []Manifest `json:"manifests"`
}

ManifestList Docker manifest structures

type MirrorType

type MirrorType string
const (
	MirrorTypeApt       MirrorType = "apt"        // Debian, Ubuntu, and derivatives (deb repositories)
	MirrorTypeAptDebian MirrorType = "apt-debian" // Debian package mirrors (deb repositories)
	MirrorTypeAptUbuntu MirrorType = "apt-ubuntu" // Ubuntu package mirrors (deb repositories)
	MirrorTypeYum       MirrorType = "yum"        // RHEL-family RPM repositories (yum / repodata)
	MirrorTypeDnf       MirrorType = "dnf"        // DNF-compatible RPM mirrors (often same layout as yum)
	MirrorTypePacman    MirrorType = "pacman"     // Arch Linux sync databases / package mirrors
	MirrorTypeNpm       MirrorType = "npm"        // npm registry mirrors
	MirrorTypeGo        MirrorType = "go"         // Go module proxy / sumdb mirrors (GOPROXY-style)
	MirrorTypeCargo     MirrorType = "cargo"      // crates.io / sparse index mirrors
	MirrorTypePypi      MirrorType = "pypi"       // Python package index mirrors (PEP 503 / simple)
	MirrorTypeNuget     MirrorType = "nuget"      // NuGet V3 feed mirrors
	MirrorTypeDocker    MirrorType = "docker"     // OCI distribution / Docker registry mirrors
	MirrorTypeComposer  MirrorType = "composer"   // Composer / Packagist mirrors (PHP)
)

Supported mirror ecosystems for mirava-core. Each value should eventually have a dedicated MirrorService implementation in pkg/.

type NpmCheckPackageData

type NpmCheckPackageData struct {
	Version string
	// contains filtered or unexported fields
}

type NpmCheckSpeedData

type NpmCheckSpeedData struct {
	DownloadMb      float64
	DurationSec     float64
	ContentLength   int64
	TimeoutSec      int
	SpeedMbps       float64
	SpeedRating     string
	BytesDownloaded int64
}

type NpmCheckSpeedParams

type NpmCheckSpeedParams struct {
	PackageName string
}

type NpmCheckStatusData

type NpmCheckStatusData struct {
	Status       bool
	TestPath     string
	StatusCode   int
	RedirectPath *string
}

type NpmMirrorService

type NpmMirrorService struct {
	HttpClient *http.Client
}

func NewNpmMirrorService

func NewNpmMirrorService() *NpmMirrorService

NewNpmMirrorService creates a new NPM mirror service instance

func (*NpmMirrorService) CheckPackage

func (m *NpmMirrorService) CheckPackage(
	mirrorUrl,
	packageName string,
	verbose bool,
) (bool, *NpmCheckPackageData, error)

CheckPackage checks if a package exists on an NPM mirror

func (*NpmMirrorService) CheckSpeed

func (m *NpmMirrorService) CheckSpeed(
	mirrorURL string,
	timeout int,
	verbose bool,
	packageName *string,
) (float64, *NpmCheckSpeedData, error)

func (*NpmMirrorService) CheckStatus

func (m *NpmMirrorService) CheckStatus(
	url string,
	verbose bool,
) (bool, *NpmCheckStatusData, error)

type PackageNotFoundError

type PackageNotFoundError = apt.PackageNotFoundError

type PackageVersion

type PackageVersion struct {
	Name        string             `json:"name"`
	Description string             `json:"description"`
	Type        string             `json:"type"`
	License     []string           `json:"license"`
	Homepage    string             `json:"homepage"`
	Time        string             `json:"time"`
	Authors     []ComposerAuthor   `json:"authors"`
	Require     map[string]string  `json:"require"`
	RequireDev  map[string]string  `json:"require-dev"`
	Downloads   *ComposerDownloads `json:"downloads"`
	Abandoned   interface{}        `json:"abandoned"`
	Version     string             `json:"version"`
	Dist        struct {
		URL string `json:"url"`
	} `json:"dist"`
}

PackageVersion represents a single package version from Composer API

type PacmanCheckPackageData

type PacmanCheckPackageData struct {
	Package string
	Version string
	Matches int
}

type PacmanCheckSpeedData

type PacmanCheckSpeedData struct {
	DownloadMb      float64
	DurationSec     float64
	TimeoutSec      int
	SpeedMBps       float64
	SpeedRating     string
	BytesDownloaded int64
	ContentLength   int64
	Repository      string
	Arch            string
	Package         string
}

type PacmanCheckSpeedParams

type PacmanCheckSpeedParams struct {
	Repository string
	Arch       string
	Package    string
}

type PacmanCheckStatusData

type PacmanCheckStatusData struct {
	Status     bool
	TestPath   string
	StatusCode int
}

type PacmanMirrorService

type PacmanMirrorService struct {
	HttpClient *http.Client
}

func NewPacmanMirrorService

func NewPacmanMirrorService() *PacmanMirrorService

NewPacmanMirrorService creates a new Pacman mirror service instance

func (*PacmanMirrorService) CheckPackage

func (m *PacmanMirrorService) CheckPackage(
	mirrorURL,
	packageName string,
	verbose bool,
) (bool, *PacmanCheckPackageData, error)

func (*PacmanMirrorService) CheckSpeed

func (m *PacmanMirrorService) CheckSpeed(
	mirrorURL string,
	timeout int,
	verbose bool,
) (float64, *PacmanCheckSpeedData, error)

func (*PacmanMirrorService) CheckStatus

func (m *PacmanMirrorService) CheckStatus(
	url string,
	verbose bool,
) (bool, *PacmanCheckStatusData, error)

CheckStatus checks if a Pacman mirror is alive

type Platform

type Platform struct {
	Architecture string `json:"architecture"`
	OS           string `json:"os"`
	Variant      string `json:"variant,omitempty"`
}

type PyPIMirrorService

type PyPIMirrorService struct {
	HttpClient *http.Client
}

func NewPyPIMirrorService

func NewPyPIMirrorService() *PyPIMirrorService

NewPyPIMirrorService creates a new PyPI mirror service instance

func (*PyPIMirrorService) CheckPackage

func (m *PyPIMirrorService) CheckPackage(mirrorUrl, packageName string, verbose bool) (bool, *PyPiCheckPackageData, error)

CheckPackage checks if a package exists on a PyPI mirror using the simple API Returns: (exists, version, error)

func (*PyPIMirrorService) CheckSpeed

func (m *PyPIMirrorService) CheckSpeed(mirrorURL string, timeout int, verbose bool) (float64, *PyPiCheckSpeedData, error)

func (*PyPIMirrorService) CheckStatus

func (m *PyPIMirrorService) CheckStatus(url string, verbose bool) (bool, *PyPIStatusResponse, error)

CheckStatus checks if a PyPI mirror is alive and responding

type PyPIStatusResponse

type PyPIStatusResponse struct {
	Status     string `json:"status"`      // Status of the mirror (e.g., "active")
	TestedPath string `json:"tested_path"` // The endpoint that was tested (e.g., "/simple/")
	StatusCode int    `json:"status_code"` // HTTP status code from the response
}

PyPIStatusResponse represents the response from checking a PyPI mirror status

type PyPiCheckPackageData

type PyPiCheckPackageData struct {
	Version       string
	VersionsCount int
	AllVersions   []string
}

type PyPiCheckSpeedData

type PyPiCheckSpeedData struct {
	DownloadedMB float64
	DurationSec  float64
	TimeoutSec   int
	SpeedMbps    float64
	SpeedRating  string
}

type PyPiCheckStatusData

type PyPiCheckStatusData struct {
	Status     bool
	TestPath   string
	StatusCode int
}

type RegistryInfo

type RegistryInfo struct {
	URL               string
	IsAlive           bool
	AuthRequired      bool
	CatalogAccessible bool
	APIVersion        string
}

RegistryInfo holds detailed information about a Docker registry

type ResponseReadError

type ResponseReadError = apt.ResponseReadError

type SpeedTestError

type SpeedTestError = apt.SpeedTestError

type TimeoutError

type TimeoutError = apt.TimeoutError

type ValidationError

type ValidationError = apt.ValidationError

Directories

Path Synopsis
Package apt implements APT mirror internals.
Package apt implements APT mirror internals.

Jump to

Keyboard shortcuts

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