Skip to content
vannt-devPublic

About

DNS privacy guard and ad blocker for Android (iOS in progress): encrypted DNS over DoH, DoT and DoQ, category blocklists and per-app statistics, Flutter UI on a Rust engine.

Topics

Resources

Stars

9 stars

Watchers

1 watching

Forks

Latest commit

Β 

History

123 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AegisNet πŸ›‘οΈ

Downloads Official vannt-dev build

AegisNet is a high-performance, cross-platform system-wide DNS Privacy Guard & Ad-Blocking Mobile Application for Android (iOS in progress), built with Flutter and powered by a high-speed Rust Core Engine.


Official builds are listed at vannt-dev.github.io/official.html; anything else is not published by vannt-dev. The APK signing certificate fingerprints are listed there too.

πŸ“ Architecture Overview

How a DNS query is handled on Android; see Platform Status for iOS, desktop and web.

flowchart LR
  lists["Blocklists<br/>Hosts, EasyList,<br/>AdGuard"]
  yours["Your rules<br/>allow, block,<br/>custom hosts,<br/>quiet hours,<br/>SafeSearch"]
  apps["Apps on<br/>the device"]
  ui["Flutter app<br/>Dashboard, Rules,<br/>Logs, Analytics,<br/>Settings"]
  vpn["Local VPN<br/>on Android<br/>DNS traffic only"]
  upstream["Your DNS provider<br/>DoH, DoT or DoQ"]
  core["Rust Core Engine<br/>aegis-core<br/>(private)"]

  lists -->|"downloaded,<br/>kept in sync"| ui
  yours --> ui
  apps <-->|"DNS queries<br/>and answers"| vpn
  ui -->|"rules,<br/>settings"| core
  core -.->|"stats,<br/>query log"| ui
  vpn <-->|"answered<br/>or blocked"| core
  upstream <-->|"allowed<br/>queries"| core
Loading

⚑ Key Features

  • πŸš€ Sub-Millisecond DNS Filtering: A Rust engine that reads Hosts files, EasyList DNS and AdGuard domain rules. A rule for a domain covers its subdomains too.
  • ⚑ DNS Cache: Answers already seen are served from memory until they expire, for low latency.
  • πŸ—ΊοΈ Local DNS Mapping & Custom Hosts: Define custom internal DNS host overrides (domain -> IP, e.g. myrouter.local -> 192.168.1.1) with real-time UI control.
  • ⏰ Scheduled Quiet Hours (Parental Controls): Automatic category filter activation during configured quiet hours (e.g. 22:00 - 06:00).
  • πŸ”’ Enforced SafeSearch: Exact-host SafeSearch rewriting for Google & DuckDuckGo (unrelated subdomains such as mail.google.com are never touched).
  • 🌐 DNS-over-HTTPS, DNS-over-TLS & DNS-over-QUIC: Encrypted upstream over DoH (RFC 8484, application/dns-message), DoT (RFC 7858, port 853) or DoQ (RFC 9250, UDP port 853). The built-in providers (Cloudflare, Google, AdGuard, Quad9) use DoH with IP-literal endpoints to avoid resolver bootstrap loops; a custom resolver can be an https:// URL, a tls://host[:port][#name] target or a quic://host[:port][#name] target, where #name is the certificate name to verify when the host is an address.
  • πŸ’» Desktop (experimental): Windows, macOS and Linux builds include a local DNS resolver (DesktopDnsProxy) to point the operating system at. It needs an engine library built by hand; see the platform table.
  • πŸ”Œ Always-on VPN & Quick Settings tile (Android): Choose AegisNet as Android's Always-on VPN to protect from boot, or switch protection from the Quick Settings tile. A tunnel started this way, with the app closed, filters with your lists and settings.
  • πŸ” App lock (PIN): An optional 4-6 digit PIN, asked when the app opens or comes back after 30 seconds away, and before anything that weakens protection: turning it off or pausing it, allowing a domain, switching off a filter, letting an app skip the VPN, or restoring a backup. Only a salted PBKDF2 hash of the PIN is stored, and wrong tries are slowed down. With the lock on, the Quick Settings tile opens the app instead of turning protection off. Android's own VPN settings can still disconnect any VPN.
  • ⏸️ Pause protection: Pause filtering for 5 minutes, 15 minutes or an hour. On Android it comes back on time even if the app has been closed, and the notification shows when. The notification also has a Pause 5 min button, counts down the time left and offers Resume.
  • πŸ“„ Import a blocklist file (Android): Add a hosts file or a one-domain-per-line list from the phone's storage. Lines are checked and repeats dropped; the list blocks at once and is kept on the phone next to the downloaded ones.
  • 🧩 Home-screen widget (Android): Shows whether protection is on, paused or off, and how much was blocked today; tap it to switch protection like the Quick Settings tile.
  • ⏱️ DNS Latency Benchmark: Interactive built-in benchmark tool to test and automatically select the fastest upstream DNS provider.
  • πŸ“± System-Wide Protection: Intercepts OS-level DNS traffic via local split-tunnel VPN (VpnService on Android; the iOS NEPacketTunnelProvider is not finished) without routing web traffic to remote servers.
  • πŸ“Š Real-time Dashboard & Analytics: Interactive traffic graphs, query counters, ad-block stats, bandwidth savings, and detailed category analytics, plus a 30-day history of queries, blocks and the most-blocked domains that survives restarts (Android).
  • 🚫 Block an app (Android 10+): Refuse every DNS lookup a chosen app makes, from the Top apps list in Analytics. It stops name lookups, not connections to fixed IP addresses.
  • πŸ“± Per-app statistics (Android 10+): See which apps make the most DNS queries and how many were blocked, and filter the live query log by app.
  • πŸ›‘οΈ Bypass protection: DNS sent straight to public resolvers is filtered too, and their encrypted DNS is refused so apps fall back to the filter.
  • πŸ“Ά Networks to protect (optional, Android): Filter only on Wi-Fi, only on mobile data, or on both, and leave chosen Wi-Fi networks out by name. Telling Wi-Fi from mobile data needs no permission; the Wi-Fi list asks for location access, which Android requires to read a Wi-Fi name. Off by default.
  • πŸ”€ Look-alike domain protection (optional): Block every internationalized domain name (one with letters beyond plain a-z, accented ones included; xn-- in its technical form), which phishing sites use to imitate real addresses with look-alike letters. Off by default; domains on your allow list still work.
  • πŸ“œ Live Query Log & CSV Export: Real-time query monitoring with status filter chips (ALL LOGS, BLOCKED, ALLOWED), instant domain search and CSV export. Tap an entry to see why it was blocked and to allow or block that domain on the spot, or to allow it for a while (15 min, 1 hour or 1 day): it is blocked again on time, even if the app is closed. Test a domain tells whether a domain would be blocked, and why, before anything asks for it.
  • ⚑ Custom Whitelist & Blacklist: Flexible custom rule management with instant hot-reloading.
  • πŸ”„ Background Auto-Sync: Automatic blocklist updates and background rule synchronization.
  • 🌍 4-Language i18n Support: Full internationalization for English (EN), Vietnamese (VI), Korean (KO), and Japanese (JA).
  • πŸŒ™ Dynamic Dark/Light Theme: Seamless theme switching with customizable app settings.

πŸ“‹ Filter List Sources

The app downloads these lists when it syncs. None of them is bundled with the app; each stays under its own licence and belongs to its maintainers. You can switch any of them off, or add your own list by URL, on the Rules screen.

List Filter On by default
AdGuard DNS filter Ads Yes
StevenBlack Unified Hosts Ads Yes
Peter Lowe's Ad and Tracking Server List Trackers Yes
OISD Small Ads Yes
HaGeZi Multi NORMAL Ads No, adds about 6 MB of memory
URLhaus by abuse.ch, via malware-filter Malware Yes
StevenBlack Adult Hosts Adult No

The HaGeZi lists are made by HaGeZi and licensed under GPL-3.0. The malware list is URLhaus data (CC0) as published by malware-filter (CC0 and MIT).


🎯 What DNS Filtering Can and Cannot Block

AegisNet blocks by domain name. It sees which host a device asks for and answers or refuses; it never looks inside the encrypted connection. That draws a hard line around what it can do.

Blocked effectively β€” ads and trackers served from their own domains: banners and interstitials in most free apps and games (AppLovin, Vungle, AdMob and similar networks), analytics and telemetry endpoints, and web ads while browsing.

Not blocked β€” ads served from the same domains as the content itself:

App Why
YouTube Ads and video both come from googlevideo.com. Blocking it blocks the video too. The ad-only domains it also asks for (googleads.g.doubleclick.net and similar) are blocked, but they are not what plays the video ads.
Facebook / Instagram In-feed ads arrive over the same hosts as the feed.
Spotify, TikTok Same pattern: ad content shares the delivery infrastructure.

This is a property of DNS filtering itself, not a gap in the rule list β€” no blocklist can fix it. Removing YouTube ads specifically requires a different approach: YouTube Premium (or Premium Lite), watching in a browser with a content blocker such as Firefox with uBlock Origin, or an alternative client such as NewPipe. Get any of these from their official site, F-Droid or GitHub only, and note that YouTube's terms forbid blocking its ads.


πŸ“Š Platform Status

Platform Native DNS filtering Notes
Android βœ… Working (verified on emulator) TUN β†’ Rust β†’ device pipeline, DNS-only routing, DoH upstream. libaegis_core.so is built by a Gradle cargo-ndk task, or fetched already built when the engine's source is absent.
iOS 🚧 App shell builds in CI; filtering not wired up The Flutter shell compiles on a macOS runner when a PR changes the iOS project, the engine, the plugins or CI, and on every release PR into main. Extension provider, NETunnelProviderManager channel, entitlements, App Group state sharing and the Rust framework script are all in the repo, and the Rust core cross-compiles for iOS. Still missing: the PacketTunnel extension target is not checked into the Xcode project. ios/add_packet_tunnel_target.rb adds it on a Mac (and links the engine framework), but the extension has not yet been compiled in CI or run on a device. Final assembly needs macOS/Xcode + a paid Apple Developer account β€” see ios/IOS_SETUP.md.
Desktop 🚧 Local DNS proxy; engine not bundled (Windows/macOS/Linux) DesktopDnsProxy answers DNS on loopback (port 53, or 5300 without the rights for 53) through the engine, and the operating system has to be pointed at it by hand. The desktop builds do not build or bundle the engine library: put a hand-built aegis_core.dll / libaegis_core.so beside the app (on macOS, link it into the app). Without it the proxy cannot answer and the app runs the pure-Dart fallback.
Web βž– Fallback Engine / WASM Ready Runs the pure-Dart fallback engine (simulation) with WASM target scaffolding for browser testing.

When the native engine is unavailable, the app gracefully falls back to a pure-Dart simulation engine instead of failing β€” useful for UI work without a native toolchain. See CHANGELOG.md for the full list of changes.


πŸ“‚ Project Structure

aegis-net/
β”œβ”€β”€ android/                   # Native Android VpnService & MethodChannel
β”‚   └── app/
β”‚       β”œβ”€β”€ build.gradle.kts   # cargo-ndk preBuild task -> jniLibs
β”‚       └── src/main/
β”‚           β”œβ”€β”€ jniLibs/       # libaegis_core.so per ABI (built, git-ignored)
β”‚           └── kotlin/com/aegisnet/app/
β”‚               β”œβ”€β”€ AegisVpnService.kt
β”‚               └── MainActivity.kt
β”œβ”€β”€ ios/                       # Native iOS NEPacketTunnelProvider (WIP)
β”‚   β”œβ”€β”€ PacketTunnel/           # Extension sources β€” not built or run on a device yet
β”‚   β”‚   └── PacketTunnelProvider.swift
β”‚   β”œβ”€β”€ add_packet_tunnel_target.rb # Adds the PacketTunnel target to the Xcode project
β”‚   └── Runner/
β”‚       β”œβ”€β”€ AppDelegate.swift   # registers the channel from didInitializeImplicitFlutterEngine
β”‚       β”œβ”€β”€ SceneDelegate.swift # UIScene lifecycle (Flutter 3.35+)
β”‚       └── VpnManager.swift    # com.aegisnet/vpn MethodChannel <-> NETunnelProviderManager
β”œβ”€β”€ rust/aegis_core/           # Rust engine β€” private submodule (vannt-dev/aegis-core)
β”œβ”€β”€ lib/                       # Flutter Application (Dart)
β”‚   β”œβ”€β”€ main.dart
β”‚   └── src/
β”‚       β”œβ”€β”€ bridge/            # Flutter-Rust FFI & Native VPN Channel
β”‚       β”œβ”€β”€ i18n/              # 4-language string localization (EN, VI, KO, JA)
β”‚       β”œβ”€β”€ providers/         # State management (VpnProvider, ThemeProvider)
β”‚       β”œβ”€β”€ screens/           # Dashboard, Analytics, Rules, Logs, Settings
β”‚       └── services/          # DNS Benchmark & Rule Downloader Services
β”œβ”€β”€ .githooks/                 # Pre-commit & Pre-push Git hooks
β”œβ”€β”€ .github/workflows/         # CI/CD workflows (Build & Test matrix)
β”œβ”€β”€ pubspec.yaml
└── README.md

πŸ“š Documentation & Guides

For detailed setup, building, testing, and deployment instructions, refer to the project documentation:


πŸ› οΈ Getting Started (Local Development)

Prerequisites

  1. Flutter SDK (v3.0.0+ for Android/Web; iOS needs 3.35+ β€” the iOS shell uses the UIScene lifecycle APIs FlutterSceneDelegate / FlutterImplicitEngineDelegate, which older SDKs do not have. CI builds on the latest stable release; the version is not pinned.)
  2. Rust Toolchain (rustup, cargo)
  3. Google Chrome / MS Edge (for Web local testing) or Android Studio / Visual Studio 2022 (for platform native builds)

πŸš€ Quick Start Steps

Step 1: Install Flutter Dependencies

flutter pub get

Step 2: Build Rust Core Engine (Optional for Web)

Note: If the native engine is not compiled, AegisNet automatically falls back to its built-in Pure Dart Engine, allowing UI testing without native compilation.

The engine's source is not in this repository. rust/aegis_core is a git submodule of the private repository vannt-dev/aegis-core. With read access to it, fetch it with git submodule update --init rust/aegis_core (or clone with --recurse-submodules). Without access the directory stays empty, and the build uses the engine already built: see Building without the engine's source below. You can then skip the rest of this step.

cd rust/aegis_core
cargo build --release   # host build (desktop/tests)
cd ../..

Android: the native library is built automatically. The Gradle preBuild task runs cargo-ndk and drops libaegis_core.so into jniLibs for every ABI, so a normal flutter build apk / flutter run produces a filtering-capable build. It requires the Rust Android targets and cargo-ndk:

rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android
cargo install cargo-ndk

If cargo-ndk is not on PATH, the task is skipped and the app runs in the pure-Dart fallback (no crash).

πŸ’‘ Windows Troubleshooting (os error 4551): If Windows Smart App Control blocks cargo.exe, add an exclusion for ~/.cargo and ~/.rustup in Windows Security > App & browser control, or switch toolchain to GNU (rustup default stable-x86_64-pc-windows-gnu).

Building without the engine's source

A clone of this repository alone builds a working app. Every release from 1.6.0 on carries the engine as binaries, and the build fetches them when rust/aegis_core is empty. No Rust toolchain is needed.

  • Android: nothing to do. flutter build apk / flutter run fetches aegis-engine-android.zip (the three libaegis_core.so of that release's APK) into android/app/src/main/jniLibs and checks it against the published SHA-256. The release of this checkout's version is tried first, then the latest one. -Paegis.prebuilt=false builds without an engine instead; -Paegis.engineUrl=<url> takes the two files from another place.
  • iOS (on a Mac): ./ios/fetch_prebuilt_engine.sh puts AegisCore.xcframework into ios/Frameworks, where ./ios/build_rust_ios.sh would have written it. The app shell builds without it too; see the platform table above for what iOS does today.
  • Desktop and Web run the pure-Dart fallback engine, as they do with the source.

The binaries are the ones the release itself shipped, and they are what the build falls back to whenever the source is missing. Without a network the build still succeeds, in fallback mode: the app installs and runs but filters nothing, and the build log says so.

Step 3: Run Locally

  • Run Web Debug Mode (Hot Reload):

    flutter run -d chrome

    (or flutter run -d edge)

  • Run Web Production Server:

    flutter build web --release
    npx serve build/web -l 8080

    Then open http://localhost:8080 in your browser.

  • Run on iOS (macOS + Xcode 15+ only):

    flutter build ios --no-codesign      # verify the shell compiles
    flutter run -d <simulator-id>        # flutter devices to list them

    There is no CocoaPods in this project β€” the only native plugin goes through Swift Package Manager, so pod install is not a step and will fail with No Podfile found. If you open Xcode, open ios/Runner.xcworkspace, not Runner.xcodeproj; opening the project directly leaves Xcode unable to resolve the generated package and it reports Missing package product 'FlutterGeneratedPluginSwiftPackage'.

    DNS filtering does not work on iOS yet β€” the PacketTunnel target has to be added with ruby ios/add_packet_tunnel_target.rb, and the extension has not been built or run on a device yet. See ios/IOS_SETUP.md.


πŸ§ͺ Testing & Code Quality

Run Tests

  • Flutter Unit Tests:
    flutter test
  • Rust Core Tests:
    cd rust/aegis_core
    cargo test

Code Formatting & Quality Checks

# Flutter Analysis & Format
flutter analyze
dart format --output=none --set-exit-if-changed .

# Rust Format & Lints
cd rust/aegis_core
cargo fmt --check
cargo clippy -- -D warnings

πŸ”„ CI/CD & Automation

AegisNet uses GitHub Actions for CI/CD with parallel job execution, Cargo & Gradle caching, and automated verification:

  • Git Hooks: Pre-commit formatting & strict pre-push test gate (.githooks/).
  • Build & Test (build.yml): Rust cargo check/test, Flutter analyze/test/web build, and Android debug APK build. Runs on every push to develop, every PR, and on a Monday/Thursday schedule that keeps the Gradle cache warm. A PR that only touches docs skips the jobs.
  • iOS Build Verification (ios.yml): cross-compiles the Rust core for iOS targets and builds the Flutter iOS shell (flutter build ios --no-codesign) on a macOS runner. Both jobs gate β€” a broken iOS shell fails the run. It runs only when build.yml calls it: when the iOS project, the engine, the plugins or CI change, and on every release PR into main.
  • Release (release.yml): builds, signs and publishes the Android release APK (GitHub Release + Firebase App Distribution). Only runs on main β€” a PR into main builds a downloadable artifact without publishing, a push/merge to main publishes for real.

πŸ“œ License

Distributed under the MIT License. See LICENSE for more information.

About

DNS privacy guard and ad blocker for Android (iOS in progress): encrypted DNS over DoH, DoT and DoQ, category blocklists and per-app statistics, Flutter UI on a Rust engine.

Topics

Resources

Stars

9 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages