How shubhamoy/socktunnel works
Project Type & Purpose
• Type: A cross‑platform desktop application (Qt/C++17)
• Purpose: Provide a GUI wrapper around ssh -D for SOCKS5 tunneling, auto‑detect SSH hosts, toggle system proxy, and show public IP before/after tunnel.
File Structure
• src/app: Entry point and application‑level orchestration
– SocksProxyApp (C++ class) initializes core modules and UI
– main.cpp boots the Qt application
• src/core: Business logic modules
– SshConfigParser: reads ~/.ssh/config
– SshProxyManager: spawns/manages ssh -D subprocess (via QProcess)
– PublicIPChecker: fetches public IP (via QtNetwork)
– SystemProxyConfigurer: toggles OS proxy (macOS via networksetup, Linux via DBus)
– Logger: centralized logging
• src/ui: Presentation layer
– SocksProxyUI: main widgets & dialogs
– CenterAlignDelegate: custom item delegate for host list
Key Architecture Insights from README
• Qt6 Widgets, Network, SvgWidgets, DBus
• CMake for build configuration
• MVC‑like separation: UI ↔ Core ↔ External OS/Network
a. Main Components
1. UI Layer (SocksProxyUI, Delegates)
2. Application Controller (SocksProxyApp)
3. Core Module Suite
– SshConfigParser
– SshProxyManager
– PublicIPChecker
– SystemProxyConfigurer
– Logger
4. External Systems
– SSH CLI (ssh -D)
– OS Proxy Settings (system services or DBus)
– Internet (for PublicIPChecker)
b. Interactions & Data Flow
1. User clicks “Connect” in UI → emits signal to SocksProxyApp
2. SocksProxyApp calls SshConfigParser to load hosts → UI dropdown populates
3. On “Start Tunnel,” SocksProxyApp invokes SshProxyManager → launches SSH process
4. Once SSH is up, SystemProxyConfigurer toggles OS proxy to localhost:port
5. PublicIPChecker polls “before” and “after” IPs → updates UI
6. Logger records actions/errors throughout all modules
7. On “Stop Tunnel,” reverse steps; teardown SSH, restore proxy
c. Architectural Patterns & Principles
• Modular separation: each core concern in its own class
• Signal/slot for loose coupling between UI and core
• Single Responsibility: parser, manager, configurer, checker, logger
• Resource bundling via Qt’s QRC system
d. Relevant Technologies
• Qt6 (Widgets, Network, DBus, SvgWidgets)
• QProcess (for SSH)
• QtNetworkAccessManager (for IP checks)
• CMake
Detail Without Overthinking
• How the SSH subprocess lives outside the main Qt process
• Logger is represented as a cross‑cutting service