How nikomalik/esp32-block works
ESP32 AdBlock is a Wi-Fi DNS sinkhole with a browser dashboard and phone-based provisioning. The main workflow is: provision Wi-Fi, receive DNS queries, check blocked domains, then sinkhole or forward them; the dashboard exposes stats and controls, including client bans and blocklist updates. The blocklist builder and firmware reader share a compact format. Some connections rely on README documentation or SOURCE INDEX references because several implementation files were not excerpted.
Main entry points: web.cpp HTTP dashboard API · blocklist.cpp Blocklist lookup · main.cpp Firmware startup · dns.cpp DNS sinkhole
Components 16
Wi-Fi Provisioning
- Firmware startup
src/main.cpp - Wi-Fi and portal
src/wifi.cpp
DNS Filtering
- DNS sinkhole
src/dns.cpp - Domain hashing
src/fxhash.h
Blocklist Lifecycle
- Blocklist lookup
src/blocklist.cpp - Blocklist format
src/blfmt.h - List builder
tools/build_blocklist.cpp - Raw flash list
src/blocklist.cpp
Dashboard Controls
- HTTP dashboard API
src/web.cpp - Dashboard UI
src/page.h
Client State
- Device counters and bans
src/clients.cpp - Runtime state
src/clients.cpp
Other components
- Setup phone
- Network devices
- DNS upstream
- Dashboard browser
Connections 26
- Firmware startup → Wi-Fi and portal: starts
src/main.cpp - Firmware startup → DNS sinkhole: starts
src/main.cpp - Firmware startup → HTTP dashboard API: starts
src/main.cpp - Firmware startup → Blocklist lookup: initializes
src/main.cpp - Firmware startup → Device counters and bans: loads bans
src/main.cpp - Setup phone → Wi-Fi and portal: provisions
README.md - Wi-Fi and portal → Firmware startup: joins network
src/main.cpp - Network devices → DNS sinkhole: sends queries
README.md - DNS sinkhole → Blocklist lookup: checks domains
src/dns.cpp - DNS sinkhole → Device counters and bans: updates counters
src/dns.cpp - DNS sinkhole → DNS upstream: forwards allowed
- Blocklist lookup → Domain hashing: hashes domains
- Blocklist lookup → Raw flash list: maps and reads
README.md - List builder → Domain hashing: hashes domains
tools/build_blocklist.cpp - List builder → Blocklist format: writes format
tools/build_blocklist.cpp - Blocklist format → Blocklist lookup: defines reader layout
src/blfmt.h - List builder → Raw flash list: produces blob
README.md - Dashboard browser → Dashboard UI: loads dashboard
README.md - Dashboard UI → HTTP dashboard API: calls endpoints
src/page.h - HTTP dashboard API → Blocklist lookup: updates custom list
src/web.cpp - HTTP dashboard API → Blocklist lookup: streams list updates
src/web.cpp - HTTP dashboard API → DNS sinkhole: controls pause
src/web.cpp - HTTP dashboard API → Device counters and bans: toggles bans
src/web.cpp - Device counters and bans → Runtime state: persists bans
src/clients.cpp - HTTP dashboard API → Runtime state: stores update config
src/web.cpp - HTTP dashboard API → Wi-Fi and portal: clears credentials
src/web.cpp