Socket5 Android 是一款无需 Root 的 Android 全局代理应用,基于 Android 系统 VpnService API 创建 TUN 虚拟网卡,将设备所有 TCP/UDP 流量通过 SOCKS5 / HTTP / HTTPS 代理服务器转发,实现类似 OpenVPN、Clash 的全局代理效果。
安装步骤:
- 在 Android 设备「设置 → 安全」中开启「允许安装未知来源应用」
- 下载并安装 APK
- 首次启动时系统弹出 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) |
| 🔔 常驻通知 | 前台服务通知,支持一键快速断开 |
- 点击主界面右下角 + 按钮
- 选择代理类型(SOCKS5 / HTTP / HTTPS)
- 填写服务器地址、端口(必填)
- 若需认证,填写用户名和密码
- 点击 保存
点击工具栏 导入 图标 → 「OpenVPN 文件」→ 选取 .ovpn 文件
- 自动提取
http-proxy/socks-proxy指令作为代理配置 - 若文件无代理指令,将
remote主机作为 SOCKS5 配置导入(需手动核实端口和类型)
点击 导入 图标,支持两种方式:
- URL 订阅:粘贴订阅链接(
https://...),点击「拉取并导入」 - 本地文件:选取
.yaml/.yml配置文件
自动解析 proxies: 块,导入 type: socks5 / http / https 节点,不支持的类型(ss/vmess/vless/trojan 等)会显示跳过数量提示。
- 在列表中点击目标配置将其选中(显示
Active: ...) - 点击 Connect 按钮
- 系统弹出 VPN 权限请求 → 允许
- 状态指示器变绿、顶部出现 🔑 图标 → 已连接
- 点击 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 权限。
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 the latest APK from Releases
Installation:
- Enable "Install unknown apps" in Android Settings → Security
- Download and install the APK
- Grant VPN permission when prompted on first launch
| 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 |
- Tap + (FAB) on the main screen
- Select proxy type (SOCKS5 / HTTP / HTTPS)
- Enter server host and port (required)
- Optionally enter username/password for authentication
- Tap Save
Tap toolbar Import icon → "OpenVPN File" → pick a .ovpn file
- Automatically extracts
http-proxy/socks-proxydirectives - Falls back to
remotehost if no proxy directive is found (verify port/type manually)
Tap Import icon — two options:
- URL: paste subscription URL and tap "Fetch & Import"
- Local file: pick
.yaml/.ymlClash 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.
- Tap a profile in the list to select it (shows
Active: ...) - Tap Connect
- Allow VPN permission in the system dialog
- Green status indicator + 🔑 in status bar = connected
Tap Disconnect on the main screen or in the notification.
Every time you push a version tag (v1.0.0, v2.1.3, etc.) to GitHub, the workflow automatically:
- Builds a signed Release APK (or debug-signed if no keystore is configured)
- Creates a GitHub Release with auto-generated changelog
- 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).
# 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 --tagsGitHub Actions will automatically create Release v1.1.0 with the APK attached.
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 releaseStep 2 — Encode the keystore as Base64:
# Linux / macOS
base64 -w0 release.jks
# macOS alternative
base64 -i release.jksStep 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.
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- 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)
git clone https://github.com/gyj99/socket5andorid.git
cd socket5andorid
# Debug APK (no signing needed)
./gradlew assembleDebug
# Release APK (requires keystore.properties)
./gradlew assembleReleaseOutput: app/build/outputs/apk/{debug,release}/Socket5Android-{version}-{buildType}.apk
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
| 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 |
- IPv6 support
- Per-app proxy rules (app whitelist/blacklist)
- Traffic statistics (upload/download speed)
- Shadowsocks protocol support
- Dark theme
MIT License — see LICENSE file for details.