Skip to content

Repository files navigation

Socket5 Android — Global Proxy VPN / 全局代理 VPN

Build Release Android License

中文 | English


中文文档

简介

Socket5 Android 是一款无需 Root 的 Android 全局代理应用,基于 Android 系统 VpnService API 创建 TUN 虚拟网卡,将设备所有 TCP/UDP 流量通过 SOCKS5 / HTTP / HTTPS 代理服务器转发,实现类似 OpenVPN、Clash 的全局代理效果。

下载安装

📦 前往 Releases 页面下载最新 APK

安装步骤:

  1. 在 Android 设备「设置 → 安全」中开启「允许安装未知来源应用」
  2. 下载并安装 APK
  3. 首次启动时系统弹出 VPN 权限请求,点击「允许」

功能特性

功能 说明
🌐 全局代理 VpnService + TUN 接口,无需 Root,捕获所有 TCP/UDP 流量
🔌 SOCKS5 完整实现 RFC 1928/1929,支持用户名/密码认证、UDP ASSOCIATE
🔌 HTTP/HTTPS HTTP CONNECT 隧道(RFC 7231),支持 Basic Auth
📋 多配置管理 新增/编辑/删除/切换多个代理配置
📂 OpenVPN 导入 解析 .ovpn 文件中的 http-proxy / socks-proxy 指令
🗂️ Clash 订阅导入 URL 订阅或本地 YAML 文件,提取 socks5/http/https 代理节点
🏠 局域网绕过 自动跳过 10.x / 192.168.x / 172.16.x 等私有地址段
🔧 自定义 DNS 可配置 VPN 网卡使用的 DNS 服务器(默认 8.8.8.8)
🔔 常驻通知 前台服务通知,支持一键快速断开

使用说明

1. 手动添加代理配置

  1. 点击主界面右下角 + 按钮
  2. 选择代理类型(SOCKS5 / HTTP / HTTPS)
  3. 填写服务器地址、端口(必填)
  4. 若需认证,填写用户名和密码
  5. 点击 保存

2. 导入 OpenVPN 配置

点击工具栏 导入 图标 → 「OpenVPN 文件」→ 选取 .ovpn 文件

  • 自动提取 http-proxy / socks-proxy 指令作为代理配置
  • 若文件无代理指令,将 remote 主机作为 SOCKS5 配置导入(需手动核实端口和类型)

3. 导入 Clash 订阅

点击 导入 图标,支持两种方式:

  • URL 订阅:粘贴订阅链接(https://...),点击「拉取并导入」
  • 本地文件:选取 .yaml / .yml 配置文件

自动解析 proxies: 块,导入 type: socks5 / http / https 节点,不支持的类型(ss/vmess/vless/trojan 等)会显示跳过数量提示。

4. 连接代理

  1. 在列表中点击目标配置将其选中(显示 Active: ...)
  2. 点击 Connect 按钮
  3. 系统弹出 VPN 权限请求 → 允许
  4. 状态指示器变绿、顶部出现 🔑 图标 → 已连接

5. 断开连接

  • 点击 Disconnect 按钮,或从通知栏点击「Disconnect」

架构设计

┌─────────────────────────────────────────────────────────┐
│                      Android 设备                        │
│  所有 App ──TCP/UDP──▶ VpnService(TUN 10.0.0.2/32)     │
└──────────────────────────┬──────────────────────────────┘
                           │ 读取原始 IP 数据包
                           ▼
                    TunForwarder
              ┌─────────────────────┐
          TCP │                     │ UDP
              ▼                     ▼
        TcpSession              UdpSession
      (TCP 状态机)           (UDP ASSOCIATE)
              │                     │
         ProxyConnector.create(config)
         ┌──────────────────────┐
    Socks5Connector    HttpProxyConnector
         └──────────────────────┘
                    │
               远端代理服务器

常见问题

Q: Clash 订阅导入提示"全部跳过"?

订阅中均为 ss/vmess 等加密协议节点,本应用仅支持 socks5/http/https 明文代理。

Q: 连接后某些应用无法上网?

检查代理服务器是否支持 UDP。不支持则在配置中关闭「Enable UDP」。

Q: 提示 VPN permission denied?

进入系统「设置 → 更多连接 → VPN」,确认本应用有 VPN 权限。


English Documentation

Introduction

Socket5 Android is a root-free Android global proxy app. It uses the Android VpnService API to create a TUN virtual network interface, routing all device TCP/UDP traffic through a SOCKS5 / HTTP / HTTPS proxy server — similar in concept to OpenVPN or Clash for Android.

Download

📦 Download the latest APK from Releases

Installation:

  1. Enable "Install unknown apps" in Android Settings → Security
  2. Download and install the APK
  3. Grant VPN permission when prompted on first launch

Features

Feature Description
🌐 Global proxy VpnService + TUN — no root required, captures all TCP/UDP
🔌 SOCKS5 Full RFC 1928/1929 — username/password auth, UDP ASSOCIATE
🔌 HTTP/HTTPS HTTP CONNECT tunnel (RFC 7231), Basic Auth
📋 Profile management Add/edit/delete/switch multiple proxy profiles
📂 OpenVPN import Parses http-proxy / socks-proxy from .ovpn files
🗂️ Clash import URL subscription or local YAML file — imports socks5/http/https nodes
🏠 LAN bypass Skips private address ranges (10.x, 192.168.x, 172.16.x)
🔧 Custom DNS Configurable DNS server for the VPN interface
🔔 Persistent notification Foreground service notification with quick disconnect

Usage

Add a proxy profile manually

  1. Tap + (FAB) on the main screen
  2. Select proxy type (SOCKS5 / HTTP / HTTPS)
  3. Enter server host and port (required)
  4. Optionally enter username/password for authentication
  5. Tap Save

Import from OpenVPN file

Tap toolbar Import icon → "OpenVPN File" → pick a .ovpn file

  • Automatically extracts http-proxy / socks-proxy directives
  • Falls back to remote host if no proxy directive is found (verify port/type manually)

Import Clash subscription

Tap Import icon — two options:

  • URL: paste subscription URL and tap "Fetch & Import"
  • Local file: pick .yaml / .yml Clash config file

Parses the proxies: block and imports socks5/http/https type entries. Unsupported types (ss/vmess/vless/trojan) are skipped with a count shown.

Connect

  1. Tap a profile in the list to select it (shows Active: ...)
  2. Tap Connect
  3. Allow VPN permission in the system dialog
  4. Green status indicator + 🔑 in status bar = connected

Disconnect

Tap Disconnect on the main screen or in the notification.


CI/CD — Automatic APK Build & Release

How it works

Every time you push a version tag (v1.0.0, v2.1.3, etc.) to GitHub, the workflow automatically:

  1. Builds a signed Release APK (or debug-signed if no keystore is configured)
  2. Creates a GitHub Release with auto-generated changelog
  3. Attaches the APK file to the release

Push to main/master branches also triggers a Debug build saved as a workflow artifact (7-day retention).

Creating a new release

# Update versionCode/versionName in app/build.gradle first, then:
git add -A
git commit -m "chore: bump version to 1.1.0"
git tag v1.1.0
git push origin main --tags

GitHub Actions will automatically create Release v1.1.0 with the APK attached.

Configure APK signing (optional but recommended)

Without a keystore, the APK is signed with the debug key — fine for testing but not for distribution via app stores.

Step 1 — Generate a keystore (one-time setup):

keytool -genkeypair -v \
  -keystore release.jks \
  -keyalg RSA -keysize 2048 -validity 10000 \
  -alias release

Step 2 — Encode the keystore as Base64:

# Linux / macOS
base64 -w0 release.jks

# macOS alternative
base64 -i release.jks

Step 3 — Add GitHub Secrets

Go to GitHub repo → Settings → Secrets and variables → Actions → New repository secret:

Secret name Value
KEYSTORE_BASE64 Output from Step 2
KEYSTORE_PASSWORD Keystore password
KEY_ALIAS release (or your alias)
KEY_PASSWORD Key password

Step 4 — Push a tag — the workflow handles the rest automatically.

Local signing setup

For local ./gradlew assembleRelease, create keystore.properties in the project root (already in .gitignore):

storeFile=../release.jks
storePassword=YOUR_STORE_PASS
keyAlias=release
keyPassword=YOUR_KEY_PASS

Building from Source

Prerequisites

  • Android Studio Hedgehog (2023.1.1) or newer
  • JDK 17
  • Android SDK API 34 (build tools 34.x)
  • Device / emulator running Android 5.0+ (API 21)

Clone & build

git clone https://github.com/gyj99/socket5andorid.git
cd socket5andorid

# Debug APK (no signing needed)
./gradlew assembleDebug

# Release APK (requires keystore.properties)
./gradlew assembleRelease

Output: app/build/outputs/apk/{debug,release}/Socket5Android-{version}-{buildType}.apk


Project Structure

app/src/main/java/com/gyj99/socket5android/
├── App.kt
├── model/                      Data classes
│   ├── ProxyConfig.kt
│   ├── ProxyType.kt
│   └── VpnStatus.kt
├── tunnel/                     Pure-Kotlin tun2socks
│   ├── PacketUtils.kt          IPv4/TCP/UDP parse & build
│   ├── ChecksumUtils.kt        IP/TCP/UDP checksums
│   ├── TunForwarder.kt         Packet reader & dispatcher
│   ├── TcpSession.kt           TCP state machine + proxy bridge
│   ├── UdpSession.kt           UDP + SOCKS5 UDP ASSOCIATE
│   ├── SessionManager.kt       Session pool & cleanup
│   └── TunWriter.kt            Thread-safe TUN write-back
├── proxy/                      Proxy protocol connectors
│   ├── ProxyConnector.kt       Interface
│   ├── Socks5Connector.kt      RFC 1928/1929
│   └── HttpProxyConnector.kt   RFC 7231 CONNECT
├── service/
│   ├── ProxyVpnService.kt      Android VPN service
│   └── VpnManager.kt           Singleton controller + LiveData
├── importer/
│   ├── OpenVpnParser.kt        .ovpn parser
│   ├── ClashParser.kt          Clash YAML mini-parser
│   └── ImportManager.kt        Unified import entry point
└── ui/
    ├── MainActivity.kt
    ├── MainViewModel.kt
    ├── ProfileAdapter.kt
    ├── ProfileEditDialogFragment.kt
    ├── ImportDialogFragment.kt
    └── SettingsDialogFragment.kt

Dependencies

Library Version Purpose
Kotlin 1.9.22 Primary language
AndroidX Core KTX 1.12.0 Kotlin extensions
Material Components 1.11.0 UI components
ViewModel + LiveData 2.7.0 MVVM architecture
Kotlinx Coroutines 1.7.3 Async I/O
Gson 2.10.1 Config persistence

Roadmap

  • IPv6 support
  • Per-app proxy rules (app whitelist/blacklist)
  • Traffic statistics (upload/download speed)
  • Shadowsocks protocol support
  • Dark theme

License

MIT License — see LICENSE file for details.

About

一个手机版支持socket5,https的代理软件,类似openvpn

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages