Skip to content
Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ¦‡ VPSH - VPN Proxy Share Hotspot

English | فارسی |

Version 3.1.0

VPSH stands for VPN Proxy Share Hotspot – your all-in-one solution for sharing internet connectivity from your Android device.

VPSH Dashboard


Android Kotlin License Version

Turn your Android device into a powerful network sharing hub


πŸ“– Overview

VPSH (VPN Proxy Share Hotspot) is an Android application that transforms your device into a versatile network gateway. Whether you need to share a VPN connection, create a secure proxy server, or build a distributed proxy network with Cloudflare Workers, VPSH has you covered.

Key capabilities:

  • πŸ”„ Share internet connection with other devices
  • πŸ”’ Secure HTTP & SOCKS5 proxy server
  • 🌐 Full VPN NAT routing (root required)
  • πŸš€ Distributed proxy via BatProxy
  • πŸ“Š Real-time client monitoring & management
  • ⚑ Bandwidth limiting per client

✨ Features at a Glance

🎯 Proxy Mode

  • No root required
  • HTTP proxy (default: 8888)
  • Optional SOCKS5 (default: 1080)
  • Username/password authentication
  • Upstream proxy chaining
  • Kill switch protection
  • Client blocking & bandwidth limits

πŸ”’ Full Mode

  • Root required
  • Full VPN NAT routing
  • IPv6 leak protection
  • Per-client bandwidth limiting
  • Auto-restart on failure
  • Health monitoring
  • Shares ANY VPN connection

πŸ¦‡ BatProxy

  • Distributed proxy system
  • Cloudflare Workers integration
  • Automatic failover
  • Smart worker selection
  • Real-time health monitoring
  • Circuit breaker pattern
  • DNS-over-proxy support

πŸ“‹ Table of Contents

Click to expand
  1. Overview
  2. Features at a Glance
  3. Installation
  4. Quick Start Guide
  5. Modes of Operation
  6. Main Dashboard
  7. BatProxy Tab
  8. Settings
  9. Client Setup Guide
  10. Troubleshooting
  11. FAQ

πŸ“¦ Installation

# 1. Download the APK from the official source
# 2. Enable "Install from unknown sources" in Android settings
# 3. Install the APK
# 4. Grant notification permission when prompted (Android 13+)

Requirements:

  • Android 7.0 (API 24) or higher
  • Internet connection
  • Root access (optional, for Full Mode only)

πŸš€ Quick Start Guide

Proxy Mode (No Root Required)

flowchart LR
    A[Open VPSH] --> B[Tap START]
    B --> C[Proxy runs on port 8888]
    C --> D[Connect devices to<br>http://YOUR_IP:8888]
Loading
  1. Open the app
  2. Ensure you're connected to the internet (Wi-Fi or mobile data)
  3. Tap START on the Dashboard
  4. The HTTP proxy will start on port 8888
  5. Connect other devices using:
    • Proxy: http://[your-phone-ip]:8888
    • SOCKS5 (if enabled): [your-phone-ip]:1080

Full Mode (Requires Root)

flowchart LR
    A[Enable Root] --> B[Connect VPN]
    B --> C[Select FULL mode]
    C --> D[Tap START]
    D --> E[All hotspot traffic<br>routes through VPN]
Loading
  1. Enable root access
  2. Make sure your VPN is connected
  3. On the Dashboard, select FULL mode
  4. Tap START
  5. The app will route all hotspot traffic through your VPN

βš™οΈ Modes of Operation

Proxy Mode

Property Value
Root required ❌ No
How it works Runs HTTP/SOCKS5 proxy server
Default HTTP port 8888
Default SOCKS5 port 1080

Features:

  • βœ… HTTP proxy on configurable port
  • βœ… Optional SOCKS5 proxy
  • βœ… Authentication (username/password)
  • βœ… Upstream proxy chaining
  • βœ… Kill switch
  • βœ… Client blocking & bandwidth limiting

Limitation: Cannot share traffic from system-level VPNs (like Viva) because it cannot intercept traffic already routed to the VPN interface.


Full Mode (VPN NAT)

Property Value
Root required βœ… Yes
How it works Routes hotspot traffic through VPN using iptables
Use case Sharing VPN connection with multiple devices

Features:

  • βœ… Full NAT routing through VPN
  • βœ… IPv6 leak protection
  • βœ… Per-client bandwidth limiting (tc)
  • βœ… Health monitoring & auto-restart
  • βœ… Shares ANY VPN connection

Advantage: Can share traffic from any VPN, including system-level apps like Viva, as it manipulates network routing at the system level.


πŸ“Š Main Dashboard

Status & Controls

Status Running Mode Full Root Available

  • Status indicator: Shows current state (Stopped/Starting/Running/Paused/Error)
  • Mode selector: Switch between PROXY and FULL modes
  • Start/Stop button: Controls the service
  • Interface info: Shows detected hotspot and VPN interfaces

Client Management

When the service is running, connected clients appear in the list with:

flowchart LR
    Client[Connected Client] --> IP[IP Address]
    Client --> MAC[MAC Address]
    Client --> Nickname[Custom Nickname]
    Client --> Block[Block/Unblock]
    Client --> Limit[Bandwidth Limit]
Loading

Client controls:

  • ✏️ Tap the pencil icon to rename a device
  • ⏱️ Tap the clock icon to set a bandwidth limit
  • πŸ”’ Tap the checkmark/block icon to block or unblock a device

QR Code Sharing

In Proxy Mode, tap the QR button to display a QR code containing:

PROXY http://[username:password@][phone-ip]:[port]

Scan this with another device to instantly configure proxy settings.

Tethering Support

The Dashboard includes a tethering helper section:

  • πŸ“Ά Detects Wi-Fi, USB, or Bluetooth tethering
  • πŸ”Œ USB tether enable button (root required)
  • βš™οΈ Opens system tethering settings
  • πŸ“± Shows USB cable connection status

πŸ¦‡ BatProxy Tab

What is BatProxy?

BatProxy is an enterprise-grade, intelligent proxy tunnel that turns your Android device into a resilient gateway. Instead of relying on a single proxy server, it uses a pool of distributed "workers" – typically deployed as Cloudflare Workers – to route your traffic.

flowchart TB
    subgraph Client[VPSH Android Client]
        A[HTTP/SOCKS5<br>Proxy Server]
    end
    
    subgraph Workers[Worker Pool]
        B[Worker 1<br>wss://us-worker.workers.dev]
        C[Worker 2<br>wss://eu-worker.workers.dev]
        D[Worker 3<br>wss://asia-worker.workers.dev]
    end
    
    subgraph Targets[Target Servers]
        E[example.com]
        F[api.github.com]
        G[Target N]
    end
    
    A -->|Intelligent Selection| B
    A -->|Intelligent Selection| C
    A -->|Intelligent Selection| D
    B --> E
    B --> F
    C --> F
    C --> G
    D --> E
    D --> G
Loading

The system intelligently:

  1. 🎯 Routes connections through the healthiest, fastest available worker
  2. πŸ“Š Monitors worker performance using EWMA (latency, success rate)
  3. πŸ”„ Automatically fails over to other workers if one becomes slow
  4. πŸ” Reopens connections through recovered workers (circuit breaker with exponential backoff)
flowchart LR
    subgraph WorkerSelection[Worker Selection Algorithm]
        S[Score Calculation] --> F1[Success Rate EWMA]
        S --> F2[RTT EWMA]
        S --> F3[Active Connections]
        S --> F4[Cooldown Status]
        S --> F5[Slow Streak Penalty]
        F1 & F2 & F3 & F4 & F5 --> Final[Weighted Score]
        Final --> Best[Select Best Worker]
    end
Loading

For a complete technical deep-dive into the architecture, worker selection algorithms, and deployment, visit the official project repository:
πŸ‘‰ BatProxy on GitHub

How it Works (Briefly):

  1. Workers are servers (running on Cloudflare's edge network) that accept WebSocket connections
  2. The Android app (Client) connects to these workers using a secure, HMAC-authenticated handshake
  3. When you or a connected client makes a request, the app selects the optimal worker based on a real-time score
  4. Data is relayed through the worker to the target server, with built-in optimizations like data coalescing to reduce overhead

This setup provides exceptional reliability, low latency through Cloudflare's global network, and automatic recovery from failures.

Adding Workers

  1. Go to the BatProxy tab
  2. Tap the + button
  3. Enter worker URL and password (the same PASSWD you set on your Cloudflare Worker)
  4. Tap Save

Worker URL format: wss://your-worker-name.workers.dev (Secure WebSocket)

Worker Health & Stats

Each worker displays:

Status Description
🟒 Closed Healthy and available
🟑 Half-open Recovering from a failure, under probation
πŸ”΄ Open Failed, in a cooldown period (excluded from selection)

Additional metrics:

  • ⏱️ Cooldown: Time remaining before retry
  • πŸ“‘ RTT: Average round-trip time in milliseconds
  • πŸ“ˆ Score: Real-time performance score (higher is better)
  • πŸ”— Active connections: Current connections through this worker
  • βœ…βŒ OK/Fail: Success and failure counts

DNS Configuration

  • Set custom DNS for DNS-over-proxy resolution
  • Default: 1.1.1.1:53
  • DNS queries are sent through the BatProxy tunnel

βš™οΈ Settings

Port Configuration

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  HTTP Proxy Port:  [ 8888 ]         β”‚
β”‚  Enable SOCKS5:    [βœ“]              β”‚
β”‚  SOCKS5 Port:      [ 1080 ]         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Authentication

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Require Auth:     [βœ“]              β”‚
β”‚  Username:         [ admin ]        β”‚
β”‚  Password:         [ β€’β€’β€’β€’β€’β€’β€’β€’ ]     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Upstream Proxy Chaining

Chain VPSH through another proxy:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Upstream Type:  [ None β–Ό ]  [ SOCKS5 ]  [ HTTP ]  β”‚
β”‚  Address:        [ 192.168.1.100 ]                  β”‚
β”‚  Port:           [ 1080 ]                          β”‚
β”‚  Username:       [ optional ]                      β”‚
β”‚  Password:       [ optional ]                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Health Monitoring

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Auto Restart:     [βœ“]              β”‚
β”‚  Health Interval:  [ 25 ] seconds   β”‚
β”‚  Kill Switch:      [βœ“]              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Full Mode Settings

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Force VPN Only:   [βœ“]              β”‚
β”‚  Block IPv6 Leak:  [βœ“]              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Interface Overrides

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Hotspot Interface: [ wlan0 ]       β”‚
β”‚  VPN Interface:     [ tun0 ]        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‹ Logs & Health Checks

The Logs tab shows:

  • πŸ“ Service start/stop events
  • πŸ”Œ Client connections
  • ⚠️ Errors and warnings
  • πŸ’š Health check results

Health Check button: Manually triggers a health check and logs the result.


πŸ”˜ Quick Settings Tile

Add VPSH to your Quick Settings panel for one-tap control:

  1. Swipe down twice to open Quick Settings
  2. Tap the edit/pencil icon
  3. Find "VPSH" and drag it to your active tiles
  4. Tap the tile to start/stop the service

The tile shows:

  • Active: Service is running
  • Inactive: Service is stopped
  • Subtitle: Current state (Running/Stopped/Paused/Error)

πŸ”Œ Client Setup Guide

Connecting via HTTP Proxy

Windows:

netsh winhttp set proxy [phone-ip]:8888

Linux/macOS:

export http_proxy=http://[phone-ip]:8888
export https_proxy=http://[phone-ip]:8888

Android (manual):

Settings β†’ Wi-Fi β†’ Tap network β†’ Proxy β†’ Manual
  Proxy hostname: [phone-ip]
  Proxy port: 8888

Connecting via SOCKS5

Windows:

# Firefox: Settings β†’ Network Settings β†’ SOCKS5

Linux/macOS:

export ALL_PROXY=socks5://[phone-ip]:1080

Using the QR Code

flowchart LR
    A[Start Proxy Mode] --> B[Tap QR Button]
    B --> C[Scan with Other Device]
    C --> D[Auto-Configure Proxy]
Loading

Automated Client Setup Scripts

For quick and easy proxy configuration on your desktop, VPSH provides automated scripts for both Windows and Linux:

Platform Script Description
πŸͺŸ Windows client-windows.bat Interactive and command-line proxy manager for Windows
🐧 Linux client-linux.sh Interactive and command-line proxy manager for Linux

Windows Usage:

# Interactive mode (double-click or run without arguments)
client-windows.bat

# Command-line mode
client-windows.bat connect 192.168.1.100 8888
client-windows.bat connect 10.0.0.1 1080 myuser mypass
client-windows.bat disconnect
client-windows.bat status
client-windows.bat test

Linux Usage:

# Make executable
chmod +x client-linux.sh

# Interactive mode
./client-linux.sh

# Command-line mode
./client-linux.sh connect 192.168.1.100 8888
./client-linux.sh connect 10.0.0.1 1080 myuser mypass
./client-linux.sh disconnect
./client-linux.sh status
./client-linux.sh test

What these scripts do:

  • πŸ”§ Configure system proxy settings
  • 🌐 Set HTTP_PROXY and HTTPS_PROXY environment variables
  • βœ… Test connection through the proxy
  • πŸ“Š Display current proxy status
  • πŸ”„ One-command disconnect

Using BatProxy Clients

BatProxy workers are servers that connect to VPSH. To set up a worker:

  1. On the worker server (Cloudflare):

    • Follow the deployment guide in the BatProxy repository
    • Deploy the worker.js code to Cloudflare Workers
    • Set the PASSWD environment variable
  2. On your VPSH Android app:

    • Go to BatProxy tab
    • Add the worker URL (e.g., wss://your-worker.workers.dev) and password
    • Start the BatProxy service
  3. Connect clients:

    • Configure clients to use the VPSH proxy (HTTP/SOCKS5)
    • All traffic will be intelligently routed through healthy workers

πŸ”§ Troubleshooting

Common Issues

Issue Solution
❌ Proxy not starting Check if port is already in use. Change port in Settings.
πŸ”Œ Clients can't connect Verify you're on the same network. Check firewall settings.
πŸ”’ Full Mode not working Ensure root is available. Check VPN is active.
🌐 BatProxy workers failing Verify worker URLs are correct. Check worker password matches. Check internet connection.
πŸ”‘ Permission errors Grant all requested permissions (notifications, VPN).
πŸ”Œ USB tether not working Enable USB tethering in system settings first.

Logs

Always check the Logs tab for detailed error messages when troubleshooting.


❓ FAQ

Do I need root? Only for Full Mode (VPN NAT routing). Proxy Mode works without root.
What's the difference between Proxy and Full mode? Proxy mode runs a proxy server. Full mode routes all hotspot traffic through the VPN using system-level routing.
Why can't I share certain VPNs (like Viva) using Proxy Mode without root?

This is a fundamental limitation of Android's networking architecture:

1. VPNs Work at the System Level

  • Most VPN apps create a virtual network interface (e.g., tun0)
  • They use Android's VpnService API to route all device traffic through this interface
  • This routing happens at the OS level, before any user-space proxy can intercept

2. Proxy Mode is a User-Space Application

  • VPSH's Proxy Mode runs an HTTP/SOCKS5 proxy server
  • It can only accept traffic explicitly directed to it by a client app
  • It cannot see traffic already routed to the VPN interface

3. The "Chicken and Egg" Problem

  • When you activate a VPN, the system directs all traffic to the VPN interface
  • The VPN app encrypts and forwards this traffic to its own server
  • A proxy running on the same device is "downstream" of this system-level decision

The Only Solution: Full Mode (Requires Root)

  • VPSH's Full Mode uses iptables and routing rules, requiring root access
  • With root, VPSH can manipulate the system's routing table and firewall to force all traffic through the VPN
  • This effectively shares the VPN connection with other devices on your hotspot

In summary:

  • Without root: You can only share the internet connection for apps that choose to use your proxy
  • With root (Full Mode): You can share any internet connection, including system-level VPNs like Viva
How do I find my phone's IP address? Look in the app's Dashboard under hotspot interface info, or check your Wi-Fi settings.
Can I run both HTTP and SOCKS5 simultaneously? Yes, enable SOCKS5 in Settings and both will run on their respective ports.
How do I limit bandwidth per client? On the Dashboard, tap the clock icon next to any client and set a limit in Kbps.
What does BatProxy do? BatProxy routes traffic through a pool of distributed workers (like Cloudflare Workers), automatically selecting the healthiest one for each request. This provides high reliability and performance.
Why are my workers showing "half_open" status? A worker is in half-open state if it failed but is being retried. It will either recover (closed) or fail completely (open) and enter a cooldown period.
How does the health monitor work? It periodically checks if the service is healthy. If it fails, it attempts to restart up to 5 times before giving up. For BatProxy, it also performs health checks on each worker.
Can I use my own BatProxy workers? Yes! You can deploy the BatProxy worker code (available on GitHub) to Cloudflare Workers or any compatible WebSocket server and add the URL to the VPSH app.
What are the client scripts for? The `client-windows.bat` and `client-linux.sh` scripts automatically configure your desktop's proxy settings to connect to VPSH. They support interactive and command-line modes for easy connection management.
[![Android](https://img.shields.io/badge/Android-3DDC84?style=for-the-badge&logo=android&logoColor=white)](https://www.android.com/)

About

VPSH (VPN Proxy Share Hotspot)

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages