Skip to content

Android app for Technitium DNS Server control. Temporarily disable ad-blocking with one tap, view real-time blocking status, and see when protection resumes. Features auto-connect, configurable disable duration (1-120 min), and Material 3 dark theme. No background services or tracking.

License

Notifications You must be signed in to change notification settings

cbodden/dns-control

Repository files navigation

DNS Control

A modern Android application for controlling DNS blocking on Technitium DNS Server. Temporarily disable ad-blocking and tracker protection with a single tap when you need unrestricted access.

Features

  • One-Tap Disable - Temporarily disable DNS blocking for a configurable duration (1-120 minutes)
  • Real-Time Status - See current blocking status and when it will automatically resume
  • Dashboard Stats - View query statistics with flexible time ranges (Last Hour, Day, Week, Month, Year, or Custom)
  • Custom Date Range - Select specific start/end dates and times for detailed statistics
  • Saved Server Profiles - Save multiple server configurations and quickly switch between them
  • Backup & Restore - Export/import server profiles to JSON files, plus automatic Google Drive backup
  • Auto-Connect - Automatically checks server connectivity and fetches status on app launch
  • Relative Time Display - Shows resume time in human-readable format ("in 5 min", "in 1h 30m")
  • Modern UI - Beautiful Material 3 dark theme with bottom navigation and smooth animations
  • GitHub Link - Quick access to the project repository from Settings
  • Lightweight - Minimal permissions, no background services, no tracking

Screenshots

Main Window     Stats Window     Settings Window

Requirements

  • Android 8.0 (API 26) or higher
  • Technitium DNS Server with API access enabled
  • Network access to your DNS server

Installation

Download APK

Download the latest APK from the Releases page.

Build from Source

Prerequisites

  • Android Studio Hedgehog (2023.1.1) or later
  • JDK 17 or higher
  • Android SDK 34

Build Steps

  1. Clone the repository:

    git clone https://github.com/YOUR_USERNAME/dns-control.git
    cd dns-control
  2. Open in Android Studio and sync Gradle files, or build from command line:

    ./gradlew assembleDebug
  3. The APK will be generated at:

    app/build/outputs/apk/debug/app-debug.apk
    

Release Build

To create a signed release build:

./gradlew assembleRelease

Note: You'll need to configure signing in app/build.gradle.kts for release builds.

Configuration

On first launch, tap the Settings icon to configure:

Setting Description Example
Saved Servers Dropdown to select from saved server configurations Home DNS
Server URL Your Technitium DNS server address (without http://) dns.example.com:5380
API Token Your Technitium API authentication token abc123...
Save Server Save current URL and token as a named profile Save Server Configuration
Disable Duration How long to disable blocking (1-120 minutes) 5
Show Debug Window Display raw JSON response on Control tab Off

Getting Your API Token

  1. Open your Technitium DNS Server web interface
  2. Navigate to Administration > Sessions
  3. Create a new API token or use an existing one
  4. Copy the token and paste it into the app settings

Usage

  1. Launch the app - It will automatically connect to your server and fetch the current status
  2. Control Tab - The main screen shows:
    • Connection status (Connected/Unreachable)
    • Current blocking state (Enabled/Disabled)
    • Resume time if blocking is temporarily disabled
    • "Disable Blocking" button to temporarily disable DNS blocking
    • "Check Status" button to manually refresh the current state
  3. Stats Tab - View dashboard statistics:
    • Select time period from dropdown (Last Hour, Day, Week, Month, Year, or Custom)
    • Custom date range picker with start/end date and time selection
    • Query summary (total queries, errors, NX domain, refused)
    • Resolution types (authoritative, recursive, cached)
    • Blocking stats (blocked, dropped)
    • Server info (clients, zones, cached entries)
    • Zone lists (allowed/blocked zones, allow/block list counts)
  4. Settings Tab - Configure and manage server connections:
    • Save multiple server profiles with custom names
    • Quick-switch between saved servers via dropdown
    • Delete saved server profiles
    • Export/import server profiles to JSON backup files
    • Configure disable duration and debug options
  5. Refresh - Use the refresh icon in the top bar to re-check connectivity

API Endpoints Used

This app communicates with Technitium DNS Server using the following API endpoints:

Endpoint Method Purpose
/api/settings/get GET Retrieve current server settings including blocking status
/api/settings/temporaryDisableBlocking GET Temporarily disable DNS blocking
/api/dashboard/stats/get GET Retrieve dashboard statistics for the last hour

Project Structure

app/
├── build.gradle.kts                 # App module build configuration
├── src/main/
│   ├── AndroidManifest.xml          # App manifest with permissions
│   ├── java/com/dnscontrol/
│   │   ├── MainActivity.kt          # Main entry point
│   │   ├── MainViewModel.kt         # UI state management & business logic
│   │   ├── data/
│   │   │   └── SettingsDataStore.kt # Persistent settings storage
│   │   ├── network/
│   │   │   └── ApiService.kt        # HTTP API client for Technitium
│   │   └── ui/
│   │       ├── screens/
│   │       │   ├── MainScreen.kt    # Main control screen UI
│   │       │   ├── SettingsScreen.kt# Settings configuration UI
│   │       │   └── StatsScreen.kt   # Dashboard statistics UI
│   │       └── theme/
│   │           └── Theme.kt         # Material 3 dark theme
│   └── res/
│       ├── drawable/                # App icons
│       ├── mipmap-anydpi-v26/       # Adaptive icons
│       └── values/                  # Strings and themes
├── build.gradle.kts                 # Root build configuration
├── settings.gradle.kts              # Gradle settings
└── gradle.properties                # Gradle properties

Tech Stack

  • Language: Kotlin
  • UI Framework: Jetpack Compose with Material 3
  • Architecture: MVVM with StateFlow
  • HTTP Client: OkHttp
  • Storage: DataStore Preferences
  • Minimum SDK: 26 (Android 8.0)
  • Target SDK: 34 (Android 14)

Permissions

Permission Purpose
INTERNET Communicate with DNS server API
ACCESS_NETWORK_STATE Check network connectivity

No location, camera, storage, or other sensitive permissions required.

Troubleshooting

"Server unreachable" error

  • Verify the server URL is correct (without http:// prefix)
  • Ensure your device is on the same network as the DNS server, or the server is accessible remotely
  • Check that the Technitium web interface is accessible at the configured port
  • Verify your API token is valid

Buttons not responding

  • Check that "isLoading" spinner is not stuck - try refreshing
  • Ensure you have network connectivity
  • Check the debug output for API response details

Wrong blocking status displayed

  • The app reads the enableBlocking field from the Technitium API response
  • Use the "Check Status" button to manually refresh
  • Check the raw JSON in the debug section to verify server response

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Changelog

See CHANGELOG.md for detailed version history.

About

Android app for Technitium DNS Server control. Temporarily disable ad-blocking with one tap, view real-time blocking status, and see when protection resumes. Features auto-connect, configurable disable duration (1-120 min), and Material 3 dark theme. No background services or tracking.

Topics

Resources

License

Stars

Watchers

Forks

Languages