cli

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package cli provides the command-line interface for apt-proxy. It re-exports configuration types and parsing functions from internal/config for external use while maintaining the simplified cli.Daemon entry point.

Index

Constants

View Source
const (
	EnvHost        = config.EnvHost
	EnvPort        = config.EnvPort
	EnvMode        = config.EnvMode
	EnvCacheDir    = config.EnvCacheDir
	EnvDebug       = config.EnvDebug
	EnvUbuntu      = config.EnvUbuntu
	EnvUbuntuPorts = config.EnvUbuntuPorts
	EnvDebian      = config.EnvDebian
	EnvCentOS      = config.EnvCentOS
	EnvAlpine      = config.EnvAlpine

	EnvCacheMaxSize         = config.EnvCacheMaxSize
	EnvCacheTTL             = config.EnvCacheTTL
	EnvCacheCleanupInterval = config.EnvCacheCleanupInterval

	EnvTLSEnabled  = config.EnvTLSEnabled
	EnvTLSCertFile = config.EnvTLSCertFile
	EnvTLSKeyFile  = config.EnvTLSKeyFile

	EnvStorageBackend = config.EnvStorageBackend
	EnvS3Endpoint     = config.EnvS3Endpoint
	EnvS3Region       = config.EnvS3Region
	EnvS3Bucket       = config.EnvS3Bucket
	EnvS3Prefix       = config.EnvS3Prefix
	EnvS3AccessKey    = config.EnvS3AccessKey
	EnvS3SecretKey    = config.EnvS3SecretKey
	EnvS3SessionToken = config.EnvS3SessionToken
	EnvS3UseSSL       = config.EnvS3UseSSL
	EnvS3UsePathStyle = config.EnvS3UsePathStyle
	EnvS3InlineMaxMB  = config.EnvS3InlineMaxMB
	EnvS3TempDir      = config.EnvS3TempDir

	StorageBackendDisk = config.StorageBackendDisk
	StorageBackendS3   = config.StorageBackendS3

	DefaultHost     = config.DefaultHost
	DefaultPort     = config.DefaultPort
	DefaultCacheDir = config.DefaultCacheDir

	DefaultCacheMaxSizeGB          = config.DefaultCacheMaxSizeGB
	DefaultCacheTTLHours           = config.DefaultCacheTTLHours
	DefaultCacheCleanupIntervalMin = config.DefaultCacheCleanupIntervalMin

	DefaultStorageBackend = config.DefaultStorageBackend
	DefaultS3InlineMaxMB  = config.DefaultS3InlineMaxMB
	DefaultS3Prefix       = config.DefaultS3Prefix
)

Re-export constants from internal/config for backward compatibility

Variables

This section is empty.

Functions

func BuildInfo added in v0.10.0

func BuildInfo() (version, commit, date string)

BuildInfo returns the recorded build metadata.

func Daemon

func Daemon(flags *config.Config) error

Daemon is the main entry point for starting the application daemon. It validates the configuration, creates and starts the server, and handles any startup errors. This function blocks until the server shuts down. Returns an error so the caller can decide how to exit; callers should not use log.Fatal here because that bypasses tracing flushers and signal-driven cleanup paths inside Server.

func SetBuildInfo added in v0.10.0

func SetBuildInfo(version, commit, date string)

SetBuildInfo records the binary's build metadata so the daemon can log it. Called by main during startup with values injected via -ldflags.

func ValidateConfig

func ValidateConfig(cfg *Config) error

ValidateConfig validates the configuration. This is a wrapper around config.ValidateConfig for backward compatibility.

Types

type CacheConfig

type CacheConfig = config.CacheConfig

CacheConfig holds cache-specific configuration

type Config

type Config = config.Config

Config holds all application configuration

func ParseFlags

func ParseFlags() (*Config, error)

ParseFlags parses command-line flags and (when present) loads configuration from a YAML file. Priority: CLI > ENV > Config File > Default. Wrapper around config.ParseFlagsWithConfigFile, preserving the legacy entry name.

type MirrorConfig

type MirrorConfig = config.MirrorConfig

MirrorConfig holds mirror-specific configuration

type S3Config added in v0.11.0

type S3Config = config.S3Config

S3Config holds the S3-compatible storage credentials and tunables.

type Server

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

Server represents the main application server that handles HTTP requests, manages caching, and coordinates all server components.

func NewServer

func NewServer(cfg *config.Config) (*Server, error)

NewServer creates and initializes a new Server instance with the provided configuration. It sets up caching, proxy routing, logging, and HTTP proxy. Returns an error if initialization fails.

func (*Server) Start

func (s *Server) Start() error

Start begins serving HTTP requests and handles graceful shutdown on SIGINT or SIGTERM. It also handles SIGHUP for configuration hot reload. The server runs in a goroutine while the main goroutine waits for shutdown signals. Returns an error if the server fails to start or encounters a fatal error.

type StorageConfig added in v0.11.0

type StorageConfig = config.StorageConfig

StorageConfig selects and configures the cache storage backend.

type TLSConfig

type TLSConfig = config.TLSConfig

TLSConfig holds TLS/HTTPS configuration

Jump to

Keyboard shortcuts

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