Commit Graph

3 Commits

Author SHA1 Message Date
Sing Dev
365f743741 v0.3: Helper process for node speed testing + A/B swap + DNS fix
Helper process (NodeTester):
- sing-box helper runs at app launch with mixed inbound + Clash API (:9090)
- All nodes configured as urltest group for auto speed testing
- Delay results shown in Nodes tab (green <300ms / orange <600ms / red)
- Queries via Clash REST API GET /proxies

A/B node swap:
- ACTION_SWITCH in SingVpnService: kill old sing-box, start new with same TUN fd
- NodesFragment triggers A/B swap when selecting node while VPN is connected
- ~200ms gap, packets buffered in kernel TUN queue

DNS hijack-dns fix:
- Add route rule {"action": "sniff"} before {"protocol": "dns", "action": "hijack-dns"}
- Required for sing-box 1.13+ where inbound sniff field is deprecated
- Fallback port 53 hijack rule for safety

Other (from previous worker):
- Splash screen, Reality/uTLS support, dual DNS (DoT remote + UDP local)
- 3 default nodes (HK01 VLESS, JMS SS, SOCKS5)
- network_security_config.xml for localhost cleartext HTTP (Clash API)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 18:22:01 +00:00
Sing Dev
b204db589a Remove tun2socks: sing-box now reads TUN fd directly
- Patch sing-box source to add `file_descriptor` field to tun inbound config
  (2 lines changed in option/tun.go + protocol/tun/inbound.go)
- Rebuild sing-box binary with fd:// support (android/arm64, full tags)
- SingVpnService: single-process architecture (sing-box only, no tun2socks)
  - Create TUN first, pass fd to sing-box config, start sing-box with keepFd=tunFd
- SingBoxConfig: switch from mixed inbound to tun inbound with file_descriptor
- Startup time improved: 0.166s vs 0.88s+tun2socks

Architecture: TUN fd → sing-box (tun inbound fd://N → outbound) → upstream
Tested: HTTPS works, exit IP = 156.225.28.220, single process confirmed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 16:11:15 +00:00
Sing Dev
d63dbf4ab0 Sing v0.2: multi-page navigation + sing-box engine
- Add 4-tab navigation (Home/Nodes/Logs/Settings) with BottomNavigationView
- Replace tun2socks direct proxy with sing-box engine for multi-protocol support
  (socks5, shadowsocks, vmess, vless)
- Dual-process architecture: sing-box (mixed inbound :10801) + tun2socks (TUN fd bridge)
- Add node management: NodeStore (SharedPreferences), add/delete/select nodes
- Add SingBoxConfig: dynamic sing-box JSON config generation (1.13+ format)
- Add real-time log viewer with incremental reading
- Add settings page (DNS, auto-connect, about)
- Migrate to AppCompatActivity + MaterialComponents theme
- Fix fork_exec.c: guard keepFd=-1 for sing-box (no TUN fd needed)
- Delete unused files: TcpProxy, Socks5Client, ConfigReader, config.jsonc

Tested: VPN connects, exit IP = 156.225.28.220, HTTPS works, all tabs functional.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 15:56:57 +00:00