cli

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: Apache-2.0 Imports: 22 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

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

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

Re-export constants from internal/config for backward compatibility

Variables

This section is empty.

Functions

func Daemon

func Daemon(flags *config.Config)

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.

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 returns a Config. This is a wrapper around config.ParseFlags for backward compatibility.

type MirrorConfig

type MirrorConfig = config.MirrorConfig

MirrorConfig holds mirror-specific configuration

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