Skip to content

SameerArora497/PingGuard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PingGuard

A free, open-source gaming-focused network control app for Android. Uses Android's VpnService to manage per-app internet access — no root, no external servers, no data collection.

Features

  • Gaming Mode — One-tap toggle to restrict internet to only your selected apps (games + voice chat). Everything else gets blocked.
  • TCP Blocker Overlay — Floating button that drops all TCP traffic while forwarding UDP. Perfect for reducing lag by killing background HTTP connections during gameplay.
  • Per-App Control — Select which apps are allowed internet access when Gaming Mode is active.
  • Auto Game Detection — Automatically enables Gaming Mode when a selected game is launched (uses UsageStatsManager).
  • No Root Required — Uses Android's built-in VpnService API.
  • No External Server — All filtering happens locally on your device. Zero data leaves your phone.

How It Works

Gaming Mode (Normal)

  • Creates a local VPN tunnel with no upstream connection (dead-end)
  • Selected apps bypass the tunnel via addDisallowedApplication() → full internet
  • All other apps route through the dead tunnel → blocked

TCP Block Mode (Overlay)

  • All apps route through the VPN tunnel
  • A packet filter reads the TUN file descriptor:
    • TCP packets (protocol 6) → dropped silently
    • UDP packets (protocol 17) → forwarded via protected DatagramChannels
  • Games keep working (most use UDP), background web traffic dies

Tech Stack

  • Kotlin + Jetpack Compose (Material 3)
  • MVVM + Clean Architecture
  • Hilt for dependency injection
  • DataStore for persistence
  • Coroutines + Flow for reactive state
  • Navigation Compose with type-safe routes
  • Android 10+ (API 29)

Building

git clone https://github.com/user/PingGuard.git
cd PingGuard
./gradlew assembleDebug

Install the APK from app/build/outputs/apk/debug/.

For a release build with R8 minification:

./gradlew assembleRelease

Project Structure

com.ping.guard/
├── domain/          # Models (AppInfo, VpnState) + repository interfaces
├── data/            # DataStore persistence + repository implementations
├── service/         # VpnService, TcpBlocker, OverlayService, VpnManager, UsageMonitor
├── di/              # Hilt modules
└── ui/
    ├── home/        # Main screen with Gaming Mode toggle + overlay control
    ├── apps/        # App selection with search + checkboxes
    ├── settings/    # Auto-start, auto-detect toggles
    ├── navigation/  # Type-safe Compose navigation
    └── theme/       # Material 3 theming

Permissions

Permission Why
FOREGROUND_SERVICE Run VPN as foreground service
BIND_VPN_SERVICE Required for VPN
SYSTEM_ALERT_WINDOW Floating TCP blocker button
QUERY_ALL_PACKAGES List installed apps for selection
PACKAGE_USAGE_STATS Auto-detect foreground games
POST_NOTIFICATIONS VPN active notification

License

MIT — see LICENSE

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages