Tun2Socks

Tun2Socks

A lightweight socks5 proxy client for Android

Screenshot 1
Screenshot 2
Screenshot 3
Screenshot 4

Tun2Socks is a lightweight SOCKS5 proxy client, providing stable, low-latency global transparent proxy services for Android devices. By creating a TUN virtual network interface via Android VpnService, it automatically routes all device network traffic through a SOCKS5 proxy server — no per-app manual configuration required.

Use Cases

  • Privacy Protection: Route all device traffic through a SOCKS5 proxy to hide your real IP address
  • Network Access: Access restricted network resources via proxy servers
  • LAN Sharing: Enable LAN proxy sharing to let computers, tablets, and other devices browse the internet through your phone's proxy
  • Granular Control: Use Per-App VPN mode to route only specific applications through the proxy while others maintain a direct connection
  • Power Efficient: High-efficiency C native implementation that avoids overheating during extended use, ideal for mobile devices

Features

1. SOCKS5 Protocol Proxy

  • Full support for the SOCKS5 proxy protocol, compatible with all standard SOCKS5 proxy servers
  • Anonymous (No Authentication) mode: connect directly without username or password
  • Username/Password Authentication mode: provide credentials for proxy server authentication
  • IPv4 and IPv6 dual-stack proxy connections to accommodate different network environments

2. UDP over TCP

  • UDP over TCP encapsulation mode: transmits UDP traffic through a TCP tunnel
  • Ideal for proxy environments that only allow TCP forwarding (e.g., SSH tunnels, restricted networks)
  • One-tap toggle — enable or disable directly in the Proxy section of the configuration page

3. Global Proxy Mode

  • Creates a TUN virtual network interface via Android VpnService to take over all device network traffic
  • In global mode, all application traffic is automatically routed through the SOCKS5 proxy — no per-app configuration needed
  • Automatically requests VPN permission on first use via the system authorization dialog

4. Per-App VPN

  • Per-App Proxy mode: freely select which applications route their traffic through the proxy while others stay on a direct connection
  • Displays a full list of installed applications with app icons, names, and package names
  • Search functionality to quickly locate target applications
  • Select apps via checkboxes for a simple, intuitive experience
  • A Segmented Button at the top allows one-tap switching between Global Mode and Per-App Mode

5. Multi-Proxy Configuration Management

  • Save multiple SOCKS5 proxy configurations for different scenarios (e.g., home, office, various server nodes)
  • Each configuration supports the following fields:
    • Profile Name: custom name for easy identification (e.g., "Home Server", "Office Node")
    • SOCKS5 Address: proxy server IP or domain name
    • SOCKS5 Port: proxy server port number
    • Username/Password: optional proxy authentication credentials
  • Add, edit, and delete proxy configurations
  • A confirmation dialog appears before deleting to prevent accidental removal
  • One-tap proxy switching: tap any entry in the proxy list to instantly apply it as the active configuration
  • The currently active proxy is highlighted with a checkmark icon
  • An empty state is displayed when no configurations exist, guiding users to add their first proxy

6. Network Control

  • IPv4 toggle: independently enable or disable the IPv4 tunnel route (0.0.0.0/0)
  • IPv6 toggle: independently enable or disable the IPv6 tunnel route (::/0)
  • IPv4 enabled by default, IPv6 disabled by default — users can adjust as needed
  • The IPv6 toggle is accessible directly from the home page quick toggles, no need to enter the configuration page

7. DNS Configuration

  • Customizable IPv4 DNS server address (default: 8.8.8.8)
  • Customizable IPv6 DNS server address (default: 2001:4860:4860::8888)
  • Editable via input fields in the Network section of the configuration page

8. Remote DNS (MapDNS)

  • Remote DNS (MapDNS) mode: resolves DNS queries remotely through the proxy server
  • Effectively prevents DNS leaks by ensuring DNS queries travel through the same proxy path
  • Configurable parameters:
    • MapDNS Address: mapped address (default: 198.18.0.2)
    • MapDNS Port: DNS service port (default: 53)
    • DNS Cache Size: number of cached entries (default: 10,000)
  • Toggle Remote DNS on/off directly from the home page quick toggles
  • When Remote DNS is disabled, the local DNS server is used for direct resolution

9. LAN Proxy Sharing

  • Built-in SOCKS5 Relay Server that turns your device into a proxy gateway for other devices on the local network
  • When enabled, listens on a specified port (default: 7890) — other LAN devices can connect using your device's IP address
  • Supports customizable relay port
  • Supports SOCKS5 anonymous and username/password authentication
  • Forwards proxy requests for IPv4 addresses, domain names, and IPv6 addresses
  • Relay traffic bypasses the TUN tunnel and is forwarded directly to the upstream SOCKS5 proxy for higher efficiency
  • Toggle LAN sharing on/off directly from the home page quick toggles

10. Custom MTU

  • Customizable MTU (Maximum Transmission Unit) value (default: 8500)
  • Adjusting MTU for different network environments can optimize transfer efficiency
  • Configurable in the Advanced section of the configuration page

11. Real-Time Traffic Statistics

  • Home page displays real-time upload/download byte counts and packet counts for the tunnel
  • Precise statistics obtained via native JNI calls to hev_socks5_tunnel_stats()
  • Data refreshes automatically once per second, reflecting current connection usage in real time
  • Upload and download are distinguished by blue and green icons for intuitive readability

12. One-Tap Connect/Disconnect & Connection Status

  • A prominent circular button centered on the home page for one-tap VPN tunnel start/stop
  • Real-time connection status with dual visual feedback (color and text):
    • Gray — Disconnected
    • Blue — Connecting
    • Green — Connected
    • Orange — Disconnecting
  • Home page also displays the current proxy server address and port — tap to navigate to the proxy list when disconnected

13. Quick Toggle Row

  • A quick toggle card at the bottom of the home page for fast access to commonly used settings without entering the configuration page
  • Includes the following four toggle switches:
    • Global Mode: switch between global proxy and per-app proxy
    • IPv6: enable or disable IPv6 routing
    • Remote DNS: enable or disable remote DNS resolution
    • Allow LAN Connection: enable or disable LAN proxy sharing

14. Grouped Configuration Page

  • All configurable items are organized into five clearly structured sections:
    • Proxy: current proxy info (read-only), UDP over TCP toggle, proxy list entry
    • Network: IPv4 toggle, IPv6 toggle, IPv4 DNS, IPv6 DNS
    • DNS: Remote DNS toggle, MapDNS address, MapDNS port, DNS cache size
    • LAN Sharing: allow LAN connection toggle, relay port
    • Advanced: MTU setting
  • All configurations are persisted via SharedPreferences — settings survive app kills and restarts
  • Modifying configuration while VPN is running automatically restarts the tunnel — no need to manually disconnect and reconnect
  • A "Save Configuration" button triggers a success notification after saving