AptLarder
Top-level module — holds global config and logging state.
Startup sequence (called from CLI::Server#run):
init_app!(config_file)— load YAML, apply env overrides, validate, open logServer.new(config).start— bind, listen, run background loops
Signal handlers update state here: SIGUSR1 calls reopen_log_file!,
SIGTERM calls server.stop.
Constants
Shared buffer size for all IO copy operations. 64 KB reduces syscall overhead by 8× vs Crystal's default 8 KB.
Class methods
Closes the log file if logging to a file (no-op when writing to stdout).
Called from CLI::Server#run's ensure block after Server#start returns.
Formats n bytes as a human-readable string (1.2 KB, 45.3 MB, …).
Returns true for cache keys that APT guarantees are immutable once
published: .deb packages and content-addressed paths (/pool/,
/by-hash/).
Bootstraps the application: load config → apply env vars → validate → open log.
Raises ArgumentError if the config is invalid.
Parses a CONNECT authority (host:port) into {host, port}.
Handles IPv6 literals: the brackets of [::1]:8443 are stripped and the
port that follows the closing bracket is parsed, so an address containing
colons is never split on the wrong one. A bracketed literal without a port
([::1]) and a bare host without a port both fall back to port 443.