Repository navigation
Development
No installation or root needed. The daemon listens on an unprivileged port and does not touch the firewall:
# daemon on port 5300, with its own D-Bus name on the session bus
BLOCKADS_STATE_DIR=/tmp/state PYTHONPATH=src python3 -m blockads_linux.daemon \
--dev --listen 127.0.0.1:5300 --state-dir /tmp/state --log-queries \
--dbus session --dbus-allow-all
# download and compile the enabled lists through it
BLOCKADS_STATE_DIR=/tmp/state PYTHONPATH=src python3 -m blockads_linux.updater --resolver 127.0.0.1:5300
# CLI and GUI against the session bus
PYTHONPATH=src python3 -m blockads_linux.ctl --bus session status
PYTHONPATH=src python3 -m blockads_linux.gui --bus session # --hidden, --page log--list FILE loads a hosts or adblock file directly, without the updater. Query it with any DNS client on port 5300.
src/blockads_linux/
common/ paths, settings schema, D-Bus API names, Android importer, diagnostics
filters/ parser, custom rules, artifact, matcher, overlap, catalog (data/catalog.json)
daemon/ server, pipeline, upstreams (plain, TCP, DoT, DoH, stamps, policy), cache,
health, log store, statistics, D-Bus service, polkit, trusted networks, bridge ACL
updater/ fetch, compile, manifest
ctl/ blockadsctl
gui/ PyQt6 app, pages, tray, wizard, charts, i18n
helper/ blockads-fw (root helper, stdlib only), blockads-fw-emergency.sh
data/ systemd units, sysusers, tmpfiles, D-Bus and polkit policy, firewall.conf,
launchers, desktop files, icons
packaging/ arch/ (PKGBUILD), debian/, manifest.sh (make install / uninstall)
tools/ gen_catalog.py, record_netmon.py, i18n/, ci/, release/
tests/ unit/, golden/, netns/, vm/, ci/, fixtures/
| Suite | Command | Needs |
|---|---|---|
| Unit | python -m pytest -q tests/unit |
nothing (no root, no network); GUI tests need QT_QPA_PLATFORM=offscreen
|
| Firewall and offline |
tests/netns/*.sh (interception, offline_resolver, storage_enospc, fw_helper, self_healing, bridge, gui_offline) |
rootless user + network namespaces (unshare -Urn); never touches the host firewall |
| Platform / system |
tests/vm/run_platform.sh IMAGE..., tests/vm/run_system.sh IMAGE...
|
qemu/KVM; disposable VMs from the distributions' cloud images (tests/vm/vm.sh lists them) |
| Packages | tests/vm/run_package.sh IMAGE... |
qemu/KVM; builds the real package, then install, upgrade, downgrade, remove and purge under a running daemon |
The system suite installs the real units and injects faults: kill -9, SIGSTOP (watchdog), flushed rules, firewalld/ufw/Docker reloads, reboot, uninstall while running, port taken, resolved DoT, captive portal, clock in 2001, the bridge redirect with Docker/podman/libvirt, and more. SECTIONS="start api" runs only some sections; KEEP=1 keeps the VM for inspection.
Parity with upstream: the list parser is a line-by-line port of blockads-android's Go parser at the revision pinned in NOTICE, with its test vectors in tests/unit. A change that alters what a list compiles to must bump PARSER_VERSION in filters/parser.py, so that every installed list is recompiled. Regenerate the catalog and the DoH blocklist only with tools/gen_catalog.py; never edit them by hand.
.github/workflows/ci.yml:
-
Every push and pull request:
unitandnetnsin the official containers of Debian 12/13, Ubuntu 24.04/26.04, Fedora 44 and Arch, each with its own packages (tests/ci/container.sh). The legacy iptables modules are loaded on the runner, so a SKIP fails the job.packagebuilds, lints, installs and removes the real package on Debian 12/13, Ubuntu 24.04/26.04 and Arch (tests/ci/package.sh). -
Push to
main, weekly and manual dispatch:systemnatively on the Ubuntu 24.04/26.04 runners (tests/ci/system.sh), andvmin qemu/KVM for Debian 12/13, Fedora 44 and Arch. -
tools/ci/report.pyturns the logs into error annotations and a summary table per job, starting with the distribution's package versions. Logs and VM consoles are uploaded as artifacts for 14 days.
The GUI uses Qt Linguist. English is the source; Brazilian Portuguese is complete.
- Translate in
tools/i18n/<lang>.py(a source → translation table), then runpython3 tools/i18n/update.py. It extracts the strings (pylupdate6), fills the.tsand compiles the.qm(lrelease).--checkexits 1 when a string has no translation. - The
.tsfiles are committed; the.qmfiles are build products.python3 tools/i18n/update.py --compileonly compiles them (used by CI and packaging). - A unit test fails when the shipped
.tsis stale.
tools/release/bump.py writes the version into every file that carries it (the package's __version__, the PKGBUILD, the Debian changelog, the AppStream metadata, CHANGELOG.md). tools/release/build.sh builds every package in Docker from the committed HEAD, plus the source tarball and SHA256SUMS. A release is tagged only from a commit whose CI run, including the system and vm jobs, is green.