How userjoo9/netrex works
Netrex is a home-gateway product that meters traffic per person and enforces fair-use quotas across that person’s devices. The main workflow runs from household devices through kernel traffic counting to quota calculation and enforcement, with the dashboard exposing live usage and controls. The repository also documents security, sharing, VPN, remote access, and network-management capabilities. Source excerpts are partial; dashed links mark documented features whose exact runtime wiring was not shown.
Main entry points: app.py REST and WebSocket API · run.py Gateway runtime · vpn_manager.py VPN management · service.py Quota calculations
Components 25
Gateway Runtime
- Gateway runtime
run.py - REST and WebSocket API
api/app.py - SQLite persistence
quota/db.py - Traffic snapshots
quota/engine.py
Quota and Policy
- Quota calculations
quota/service.py - Kernel metering
quota/nftables.py - Daily plans
quota/daily_plan.py
Network Services
- DNS blocking
quota/dns_rules.py - Firewall controls
quota/firewall.py - Speed shaping
quota/shaping.py - Network management
quota/netmgr.py
Gateway Features
- File sharing
quota/disk_share.py - Local sharing
quota/local_share.py - VPN management
quota/vpn_manager.py - VPN profiles
quota/vpn_parser.py - VPN routing
quota/vpnshare.py - Remote access
quota/tailscale.py
Dashboard
- Dashboard shell
web/js/main.js - Feature pages
web/js/pages/overview.js - API client
web/js/core/api.js - UI components
web/js/components/ui.js - DOM rendering
web/js/core/dom.js - Localization
web/js/core/i18n.js
Other components
- Household devices
- Household admin
Connections 28
- Household devices → Kernel metering: sends traffic
README.md - Kernel metering → Traffic snapshots: publishes counters
quota/engine.py - Traffic snapshots → Quota calculations: supplies usage
- Quota calculations → SQLite persistence: reads and updates
quota/service.py - Quota calculations → Kernel metering: sets enforcement
- Daily plans → Quota calculations: supports plans
quota/service.py - Gateway runtime → REST and WebSocket API: wires application
run.py - Gateway runtime → Kernel metering: starts engine
run.py - Gateway runtime → Firewall controls: configures firewall
run.py - REST and WebSocket API → SQLite persistence: uses persistence
api/app.py - REST and WebSocket API → Traffic snapshots: pushes live snapshots
api/app.py - REST and WebSocket API → Local sharing: serves share routes
api/app.py - Gateway runtime → DNS blocking: wires DNS rules
run.py - Household admin → Dashboard shell: opens dashboard
README.md - Dashboard shell → Feature pages: loads feature pages
web/js/main.js - Feature pages → API client: requests data
- API client → REST and WebSocket API: sends HTTP requests
web/js/core/api.js - Dashboard shell → UI components: renders shell
web/js/main.js - UI components → DOM rendering: builds elements
web/js/components/ui.js - UI components → Localization: formats labels
web/js/components/ui.js - File sharing → Local sharing: supports sharing
- VPN management → SQLite persistence: reads VPN settings
quota/vpn_manager.py - VPN management → VPN profiles: loads profiles
quota/vpn_manager.py - VPN management → VPN routing: reconciles routing
quota/vpn_manager.py - Household admin → DNS blocking: configures blocking
- Household admin → Speed shaping: sets speed limits
- Household admin → Remote access: manages remote access
- Household admin → VPN management: manages VPN