hBlock is a POSIX-compliant shell script that downloads multiple ad, tracking, and malware domain blocklists from curated sources, processes them into a unified hosts file (or alternative formats like dnsmasq, unbound, adblock, Windows PowerShell), and installs it to block those domains at the system level. The core architecture is a single self-contained script (hblock) with a custom option parser, robust error handling, and support for parallel downloads, allow/deny lists, template-based output formatting, and subdomain filtering. It is not a reusable library but a complete CLI tool; however, its companion scripts (resource/alt-formats/*.sh) demonstrate a clean plugin pattern for generating multiple output formats, and the stats script (resources/stats/stats.sh) provides a reusable utility for analyzing domain lists against the Public Suffix List. The project is well-maintained, tested across multiple shells and platforms, and follows strict POSIX shell practices.
SwitchHosts is a cross-platform desktop application for managing the system hosts file (`/etc/hosts`). Built with Tauri (Rust backend) and React (TypeScript frontend), it provides a rich GUI for creating, editing, toggling, and organizing hosts entries into groups, folders, and remote subscriptions. The application supports multiple write modes (append/overwrite), syntax-highlighted editing via CodeMirror, DNS resolution for domain-based entries, import/export with preview and conflict detection, a local HTTP API for third-party integration (e.g., Alfred, Raycast), and a system tray with a mini-window. It also includes a privileged helper daemon on macOS for passwordless writes, atomic file operations with transaction rollback, and crash recovery mechanisms. The architecture follows a clear separation: the Rust backend handles storage (atomic writes, manifest, entries, trashcan, history), hosts application (aggregation, elevation, writing, recovery), DNS resolution, HTTP API server, and system tray lifecycle. The React frontend manages UI state with Jotai, uses Mantine for components, and communicates with the backend via Tauri IPC commands. The codebase is well-tested with unit tests (Vitest, Rust `#[test]`), E2E tests (Playwright), and a shared fixture for append-mode behavior between Rust and JS. Internationalization covers 16 languages with a proxy-based lazy translation system. Key strengths include a robust storage layer with transactional safety, a generic tree component with drag-and-drop, a reusable DNS provider registry, and a find/replace engine with UTF-16 offset handling. The project demonstrates high craftsmanship in data durability (atomic writes, crash recovery tests) and cross-platform considerations (elevation strategies, tray behavior). However, the codebase has some complexity in recovery logic and platform-specific code that may require careful maintenance.
This repository is a lightweight PHP CLI tool that converts ad-blocking filter lists (primarily from AdGuard's CNAME tracker research and EasyPrivacy) into HOSTS-format blocklists. The core script, converter.php, fetches upstream lists from hardcoded URLs, parses domain entries, and outputs files containing '0.0.0.0 <domain>' lines. The generated .txt files (e.g., AdguardMobileAds.txt, EasyPrivacy3rdParty.txt) are committed to the repository and meant to be consumed by HOSTS-file-based ad blockers on mobile devices. The architecture is intentionally minimal: a single PHP script handles conversion, a shell script (.check.sh) automates periodic updates by committing only when the diff is exactly one line, and a GitHub Actions workflow (php.yml) runs the converter on a schedule. The tool is designed for manual or scheduled regeneration, not as a live service. It relies on upstream AdGuard lists, which introduces a maintenance risk if those sources change format or disappear. The repository is a hybrid of application code and generated data artifacts, but the dominant character is a small utility application. The converter is generic enough to accept custom list names and URLs, making it reusable for other filter-list-to-hosts conversions. However, the conversion is lossy—many filter options (e.g., $domain, $third-party, $redirect) are ignored—and there are no tests or CI validation for the converter logic. The project is functional for its niche but shows signs of technical drift and brittle upstream coupling.